Skip to content

Commit 64e9337

Browse files
committed
Added esp_hosted, esp_wifi_remote and network_coprocessor components
- esp_hosted + esp_wifi_remote enabled chipsets not having wifi/BT to use it via n/w adapter - network_coprocessor component can be use with network_adapter
1 parent 7504fba commit 64e9337

File tree

300 files changed

+85678
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

300 files changed

+85678
-0
lines changed
Lines changed: 237 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,237 @@
1+
if(CONFIG_SOC_WIFI_SUPPORTED)
2+
message(STATUS "Not using Hosted Wi-Fi")
3+
else()
4+
message(STATUS "Using Hosted Wi-Fi")
5+
6+
# #### slave
7+
#
8+
# set(app_name "slave")
9+
# set(slave_app_name "network_adapter.bin")
10+
# set(slave_build_target "slave-build")
11+
# set(slave_flash_target "slave-flash")
12+
# set(slave_clean_target "slave-clean")
13+
# set(slave_fullclean_target "slave-fullclean")
14+
# set(slave_menuconfig_target "slave-menuconfig")
15+
# idf_build_get_property(idf_path IDF_PATH)
16+
# set(slave_idf_target "${CONFIG_IDF_SLAVE_TARGET}")
17+
#
18+
# set(slave_build_dep "slave_build_dep")
19+
# idf_build_get_property(python PYTHON)
20+
# idf_build_get_property(extra_cmake_args EXTRA_CMAKE_ARGS)
21+
# set(ESPTOOLPY ${python} "$ENV{ESPTOOL_WRAPPER}" "${IDF_PATH}/components/esptool_py/esptool/esptool.py" --chip ${slave_idf_target})
22+
#
23+
# #set(component_dir "${IDF_PATH}/components")
24+
# #execute_process (
25+
# #COMMAND bash -c "echo IDFPath: ${IDF_PATH};pwd; ls -lrt ${component_dir}; ls -lrt ${component_dir}/esp_slave"
26+
# #COMMAND bash -c "echo toolchain: ${CMAKE_TOOLCHAIN_FILE}"
27+
# #)
28+
#
29+
# #execute_process ( COMMAND bash -c "echo SDKCONFIG: ${SDKCONFIG}")
30+
# #message("CMAKE_CURRENT_BINARY_DIR: ${CMAKE_CURRENT_BINARY_DIR} build dir: ${CMAKE_CURRENT_BINARY_DIR}/${app_name} COMPONENT_DIR: ${component_dir}")
31+
# #execute_process ( COMMAND bash -c "echo 1------------- ${CMAKE_CURRENT_BINARY_DIR}/slave")
32+
#
33+
# if(NOT CMAKE_BUILD_EARLY_EXPANSION)
34+
#
35+
# idf_build_set_property(SLAVE_BUILD_DIR ${CMAKE_CURRENT_BINARY_DIR}/${app_name}/build) #/src/${slave_build_target})
36+
#
37+
# include(ExternalProject)
38+
# ExternalProject_add(${slave_build_dep}
39+
# PREFIX ${CMAKE_CURRENT_BINARY_DIR}/slave
40+
# SOURCE_DIR ${CMAKE_CURRENT_LIST_DIR}/slave
41+
# BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/${app_name}/build
42+
# INSTALL_COMMAND ""
43+
# CMAKE_ARGS -DCMAKE_GENERATOR=${CMAKE_GENERATOR}
44+
# -DIDF_TARGET=${slave_idf_target}
45+
# -DIDF_PATH=${idf_path}
46+
# -DSDKCONFIG=${CMAKE_CURRENT_BINARY_DIR}/slave/sdkconfig
47+
# -DPYTHON=${python}
48+
# ${extra_cmake_args}
49+
# #BUILD_BYPRODUCTS ${slave_artifacts} ${slave_artifacts_extras} ${slave_ps_sources}
50+
# #${CMAKE_CURRENT_BINARY_DIR}/${app_name}/${app_name}
51+
# #BUILD_ALWAYS 1
52+
# # These options are set so that Ninja immediately outputs
53+
# # the subproject build to the terminal. Otherwise it looks like the
54+
# # build process "hangs" while the subproject is being built.
55+
# USES_TERMINAL_DOWNLOAD TRUE
56+
# USES_TERMINAL_CONFIGURE TRUE
57+
# USES_TERMINAL_BUILD TRUE
58+
# )
59+
#
60+
# #add_custom_command(TARGET ${app_name} PRE_BUILD
61+
# #COMMAND "${CMAKE_COMMAND} -E remove_directory ${CMAKE_CURRENT_BINARY_DIR}/slave"
62+
# #DEPENDS ${PROJECT_DIR}/sdkconfig)
63+
# #add_dependencies(${PROJECT_DIR}/sdkconfig ${app_name})
64+
#
65+
# #add_library(host_sdkconfig ${PROJECT_DIR}/sdkconfig)
66+
# set_source_files_properties(
67+
# ${PROJECT_DIR}/sdkconfig
68+
# PROPERTIES GENERATED TRUE)
69+
#
70+
# add_custom_target(${slave_build_target}
71+
# DEPENDS ${slave_build_dep})
72+
#
73+
# #add_custom_command(TARGET ${app_name} PRE_BUILD
74+
# # #file(REMOVE_RECURSE ${CMAKE_CURRENT_BINARY_DIR}/slave)
75+
# # #COMMAND bash -c "echo ------------- $PWD, ${CMAKE_CURRENT_BINARY_DIR}/slave"
76+
# # COMMAND "${CMAKE_COMMAND} -E rm -r ${CMAKE_CURRENT_BINARY_DIR}/slave/sdkconfig"
77+
# # DEPENDS ../../../../sdkconfig)
78+
#
79+
#
80+
# #add_custom_target(slave-build
81+
# # DEPENDS ${ULP_APP_NAME} ${ULP_APP_NAME}.bin ${ULP_APP_NAME}.sym
82+
# # ${CMAKE_CURRENT_BINARY_DIR}/${ULP_APP_NAME}.ld
83+
# # ${CMAKE_CURRENT_BINARY_DIR}/${ULP_APP_NAME}.h
84+
# # WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
85+
#
86+
# # add_custom_target(
87+
# # WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/slave
88+
# # #COMMAND "${python} esptool.py --chip ${slave_idf_target} write_flash @build/flash_project_args"
89+
# # COMMAND ${CMAKE_COMMAND}
90+
# # -D ESP_DFU_LIST="1"
91+
# # -P ${idf_path}/tools/cmake/run_dfu_util.cmake
92+
# # USES_TERMINAL
93+
# # VERBATIM)
94+
#
95+
# idf_build_get_property(slave_build_dir SLAVE_BUILD_DIR)
96+
# #idf_build_get_property(build_dir ${CMAKE_CURRENT_BINARY_DIR}/slave/src/${slave_build_target})
97+
# idf_component_get_property(esptool_py_dir esptool_py COMPONENT_DIR)
98+
# idf_component_get_property(main_args esptool_py FLASH_ARGS)
99+
# idf_component_get_property(sub_args esptool_py FLASH_SUB_ARGS)
100+
#
101+
# # CMAKE_POLICY(PUSH)
102+
# # CMAKE_POLICY(SET CMP0005 NEW)
103+
# # ADD_DEFINITIONS(-DSLAVE_ESPPORT=$ENV{SLAVE_ESPPORT})
104+
# # CMAKE_POLICY(POP)
105+
#
106+
# add_custom_target(${slave_flash_target}
107+
# COMMAND
108+
# ${CMAKE_COMMAND} -E env "ESPPORT=$ENV{SLAVE_ESPPORT}"
109+
# ${CMAKE_COMMAND}
110+
# -D "IDF_PATH=${idf_path}"
111+
# #-D "ESPPORT=$ENV{SLAVE_ESPPORT}"
112+
# -D "SERIAL_TOOL=${ESPTOOLPY}"
113+
# -D "SERIAL_TOOL_ARGS=${main_args};write_flash;@flash_project_args"
114+
# -D "WORKING_DIRECTORY=${slave_build_dir}"
115+
# -P ${esptool_py_dir}/run_serial_tool.cmake
116+
# WORKING_DIRECTORY ${slave_build_dir}
117+
# USES_TERMINAL
118+
# VERBATIM
119+
# )
120+
# #set_target_properties(${slave_flash_target} PROPERTIES ESPPORT $ENV{SLAVE_ESPPORT})
121+
#
122+
#
123+
# add_dependencies(${slave_flash_target} ${slave_build_target})
124+
#
125+
#
126+
# # Cleanup only slqve build directories. retain sdkconfig
127+
# add_custom_target(${slave_clean_target}
128+
# COMMAND ${CMAKE_COMMAND} -E remove_directory ${app_name}/build
129+
# COMMAND ${CMAKE_COMMAND} -E remove_directory ${app_name}/src
130+
# COMMAND ${CMAKE_COMMAND} -E remove_directory ${app_name}/tmp
131+
# WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
132+
# USES_TERMINAL
133+
# VERBATIM
134+
# )
135+
#
136+
# # Cleanup slave sdkconfig and all build files
137+
# add_custom_target(${slave_fullclean_target}
138+
# COMMAND ${CMAKE_COMMAND} -E remove_directory ${app_name}
139+
# WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
140+
# USES_TERMINAL
141+
# VERBATIM
142+
# )
143+
#
144+
# add_custom_target(${slave_menuconfig_target}
145+
# COMMAND ${CMAKE_COMMAND}
146+
# CMAKE_ARGS -DCMAKE_GENERATOR=${CMAKE_GENERATOR}
147+
# -DIDF_TARGET=${slave_idf_target}
148+
# -DIDF_PATH=${idf_path}
149+
# -DSDKCONFIG=${CMAKE_CURRENT_BINARY_DIR}/slave/sdkconfig
150+
# -DPYTHON=${python}
151+
# ${extra_cmake_args} --target menuconfig
152+
# #COMMAND "ninja menuconfig"
153+
# #CMAKE_ARGS -DCMAKE_GENERATOR=${CMAKE_GENERATOR}
154+
# WORKING_DIRECTORY ${slave_build_dir}
155+
# USES_TERMINAL
156+
# VERBATIM
157+
# )
158+
# endif()
159+
#
160+
#
161+
# #add_dependencies(${SLAVE_BUILD_DIR}/network_adapter.bin ${slave_flash_target}
162+
#
163+
# # add_custom_target(set-slave-target DEPENDS set_slave_target)
164+
#
165+
# #add_custom_command(TARGET ${app_name} PRE_BUILD
166+
# # COMMAND
167+
# # if(NOT "${CMAKE_TOOLCHAIN_FILE}" matches "toolchain-${slave_idf_target}")
168+
# # "${CMAKE_COMMAND} -E remove_directory build"
169+
# # endif()
170+
# # WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/slave
171+
# # VERBATIM)
172+
#
173+
# # add_custom_target(slave-clean
174+
# # WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
175+
# # COMMAND "${CMAKE_COMMAND} -E remove_directory slave"
176+
# # VERBATIM)
177+
178+
### Host
179+
set(FG_root_dir ".")
180+
set(host_dir "${FG_root_dir}/host")
181+
182+
set(COMPONENT_ADD_INCLUDEDIRS "${host_dir}" "${host_dir}/port" "${host_dir}/api")
183+
set(COMPONENT_SRCS "${host_dir}/esp_hosted_host_init.c" "${host_dir}/api/esp_hosted_api.c" "${host_dir}/drivers/transport/transport_drv.c" "${host_dir}/drivers/serial/serial_ll_if.c" "${host_dir}/utils/common.c" "${host_dir}/utils/util.c" "${host_dir}/utils/stats.c" "${host_dir}/port/os_wrapper.c" "${host_dir}/drivers/serial/serial_drv.c")
184+
185+
list(APPEND COMPONENT_ADD_INCLUDEDIRS "." "${host_dir}/api" "${host_dir}/drivers/transport" "${host_dir}/drivers/transport/spi" "${host_dir}/drivers/transport/sdio" "${host_dir}/drivers/serial" "${host_dir}/utils")
186+
187+
# rpc files - wrap -> slaveif -> core
188+
set(rpc_dir "${host_dir}/drivers/rpc")
189+
set(rpc_core_dir "${rpc_dir}/core")
190+
set(rpc_slaveif_dir "${rpc_dir}/slaveif")
191+
set(rpc_wrap_dir "${rpc_dir}/wrap")
192+
list(APPEND COMPONENT_SRCS "${rpc_core_dir}/rpc_core.c" "${rpc_core_dir}/rpc_req.c" "${rpc_core_dir}/rpc_rsp.c" "${rpc_core_dir}/rpc_evt.c"
193+
"${rpc_slaveif_dir}/rpc_slave_if.c"
194+
"${rpc_wrap_dir}/rpc_wrap.c")
195+
list(APPEND COMPONENT_ADD_INCLUDEDIRS "${rpc_core_dir}" "${rpc_slaveif_dir}" "${rpc_wrap_dir}")
196+
197+
# virtual serial
198+
set(virt_serial_dir "${host_dir}/drivers/virtual_serial_if")
199+
list(APPEND COMPONENT_SRCS "${virt_serial_dir}/serial_if.c")
200+
list(APPEND COMPONENT_ADD_INCLUDEDIRS "${virt_serial_dir}")
201+
202+
# mempool
203+
list(APPEND COMPONENT_SRCS "${host_dir}/drivers/mempool/mempool.c")
204+
list(APPEND COMPONENT_ADD_INCLUDEDIRS "${host_dir}/drivers/mempool" )
205+
206+
# slave and host common files
207+
set(common_dir "${FG_root_dir}/common")
208+
list(APPEND COMPONENT_SRCS "${common_dir}/protobuf-c/protobuf-c/protobuf-c.c" "${common_dir}/proto/esp_hosted_rpc.pb-c.c" )
209+
list(APPEND COMPONENT_ADD_INCLUDEDIRS "${common_dir}/include" "${common_dir}/protobuf-c" "${common_dir}/proto" )
210+
211+
# bt (NimBLE)
212+
### TODO config for HCI over UART
213+
list(APPEND COMPONENT_ADD_INCLUDEDIRS "${host_dir}/drivers/bt")
214+
if(CONFIG_ESP_HCI_VHCI)
215+
list(APPEND COMPONENT_SRCS "${host_dir}/drivers/bt/vhci_drv.c")
216+
else()
217+
list(APPEND COMPONENT_SRCS "${host_dir}/drivers/bt/hci_stub_drv.c")
218+
endif()
219+
220+
# power save
221+
list(APPEND COMPONENT_ADD_INCLUDEDIRS "${host_dir}/drivers/power_save")
222+
list(APPEND COMPONENT_SRCS "${host_dir}/drivers/power_save/power_save_drv.c")
223+
224+
# transport files
225+
if(CONFIG_ESP_SDIO_HOST_INTERFACE)
226+
list(APPEND COMPONENT_SRCS "${host_dir}/drivers/transport/sdio/sdio_drv.c" "${host_dir}/port/sdio_wrapper.c")
227+
else(CONFIG_ESP_SPI_HOST_INTERFACE)
228+
list(APPEND COMPONENT_SRCS "${host_dir}/drivers/transport/spi/spi_drv.c" "${host_dir}/port/spi_wrapper.c")
229+
endif()
230+
endif()
231+
232+
idf_component_register(SRCS ${COMPONENT_SRCS}
233+
REQUIRES soc esp_event esp_netif esp_timer driver esp_wifi sdmmc bt esp_http_client esp_gdbstub
234+
EXCLUDE_SRCS ${EXCLUDE_COMPONENT_SRCS}
235+
INCLUDE_DIRS ${COMPONENT_ADD_INCLUDEDIRS})
236+
237+
idf_component_set_property(${COMPONENT_NAME} WHOLE_ARCHIVE TRUE)

0 commit comments

Comments
 (0)