From 79bb5de426be3aede824433bad92205cc0fc28c6 Mon Sep 17 00:00:00 2001 From: morris Date: Fri, 22 Mar 2019 14:21:15 +0800 Subject: [PATCH] derive esp_wifi from esp32 component --- .gitlab-ci.yml | 2 +- .gitmodules | 8 ++-- .../subproject/main/Makefile.projbuild | 2 +- components/esp32/CMakeLists.txt | 35 +--------------- components/esp32/component.mk | 13 +----- components/esp32/esp_adapter.c | 4 +- components/esp32/linker.lf | 31 ++------------ components/esp32/system_api.c | 2 +- components/esp32/test/CMakeLists.txt | 22 ---------- components/esp32/test/component.mk | 12 ------ components/esp_event/event_default_handlers.c | 2 +- components/esp_wifi/CMakeLists.txt | 41 +++++++++++++++++++ components/esp_wifi/component.mk | 21 ++++++++++ .../{esp32 => esp_wifi}/include/esp_coexist.h | 0 .../include/esp_coexist_adapter.h | 0 .../include/esp_coexist_internal.h | 0 .../{esp32 => esp_wifi}/include/esp_mesh.h | 0 .../include/esp_mesh_internal.h | 2 +- .../{esp32 => esp_wifi}/include/esp_now.h | 0 .../include/esp_phy_init.h | 0 .../include/esp_private/wifi.h} | 0 .../include/esp_private/wifi_os_adapter.h} | 0 .../include/esp_smartconfig.h | 0 .../{esp32 => esp_wifi}/include/esp_wifi.h | 2 +- .../include/esp_wifi_crypto_types.h | 0 .../include/esp_wifi_types.h | 0 .../{esp32 => esp_wifi}/include/esp_wpa2.h | 0 .../{esp32 => esp_wifi}/include/esp_wps.h | 0 components/{esp32 => esp_wifi/include}/phy.h | 0 .../include}/phy_init_data.h | 0 components/{esp32/lib => esp_wifi/lib_esp32} | 0 components/esp_wifi/linker.lf | 22 ++++++++++ components/{esp32 => esp_wifi/src}/coexist.c | 0 .../{esp32 => esp_wifi/src}/fast_crypto_ops.c | 0 .../{esp32 => esp_wifi/src}/lib_printf.c | 0 components/{esp32 => esp_wifi/src}/phy_init.c | 2 +- components/{esp32 => esp_wifi/src}/restore.c | 0 .../{esp32 => esp_wifi/src}/wifi_init.c | 2 +- components/esp_wifi/test/CMakeLists.txt | 28 +++++++++++++ components/esp_wifi/test/component.mk | 19 +++++++++ .../test/test_header_files_md5.c | 2 +- .../{esp32 => esp_wifi}/test/test_phy_rtc.c | 0 .../{esp32 => esp_wifi}/test/test_wifi.c | 0 .../test/test_wifi_lib_git_commit.c | 2 +- components/lwip/CMakeLists.txt | 2 +- .../lwip/port/esp32/include/netif/wlanif.h | 2 +- docs/Doxyfile | 10 ++--- tools/ci/mirror-list.txt | 2 +- 48 files changed, 162 insertions(+), 130 deletions(-) create mode 100644 components/esp_wifi/CMakeLists.txt create mode 100644 components/esp_wifi/component.mk rename components/{esp32 => esp_wifi}/include/esp_coexist.h (100%) rename components/{esp32 => esp_wifi}/include/esp_coexist_adapter.h (100%) rename components/{esp32 => esp_wifi}/include/esp_coexist_internal.h (100%) rename components/{esp32 => esp_wifi}/include/esp_mesh.h (100%) rename components/{esp32 => esp_wifi}/include/esp_mesh_internal.h (99%) rename components/{esp32 => esp_wifi}/include/esp_now.h (100%) rename components/{esp32 => esp_wifi}/include/esp_phy_init.h (100%) rename components/{esp32/include/esp_wifi_internal.h => esp_wifi/include/esp_private/wifi.h} (100%) rename components/{esp32/include/esp_wifi_os_adapter.h => esp_wifi/include/esp_private/wifi_os_adapter.h} (100%) rename components/{esp32 => esp_wifi}/include/esp_smartconfig.h (100%) rename components/{esp32 => esp_wifi}/include/esp_wifi.h (99%) rename components/{esp32 => esp_wifi}/include/esp_wifi_crypto_types.h (100%) rename components/{esp32 => esp_wifi}/include/esp_wifi_types.h (100%) rename components/{esp32 => esp_wifi}/include/esp_wpa2.h (100%) rename components/{esp32 => esp_wifi}/include/esp_wps.h (100%) rename components/{esp32 => esp_wifi/include}/phy.h (100%) rename components/{esp32 => esp_wifi/include}/phy_init_data.h (100%) rename components/{esp32/lib => esp_wifi/lib_esp32} (100%) create mode 100644 components/esp_wifi/linker.lf rename components/{esp32 => esp_wifi/src}/coexist.c (100%) rename components/{esp32 => esp_wifi/src}/fast_crypto_ops.c (100%) rename components/{esp32 => esp_wifi/src}/lib_printf.c (100%) rename components/{esp32 => esp_wifi/src}/phy_init.c (99%) rename components/{esp32 => esp_wifi/src}/restore.c (100%) rename components/{esp32 => esp_wifi/src}/wifi_init.c (99%) create mode 100644 components/esp_wifi/test/CMakeLists.txt create mode 100644 components/esp_wifi/test/component.mk rename components/{esp32 => esp_wifi}/test/test_header_files_md5.c (97%) rename components/{esp32 => esp_wifi}/test/test_phy_rtc.c (100%) rename components/{esp32 => esp_wifi}/test/test_wifi.c (100%) rename components/{esp32 => esp_wifi}/test/test_wifi_lib_git_commit.c (85%) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index da7db2a35..75d56d9f9 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -163,7 +163,7 @@ build_template_app: - sed -i.bak -e's/CONFIG_OPTIMIZATION_LEVEL_DEBUG\=y/CONFIG_OPTIMIZATION_LEVEL_RELEASE=y/' sdkconfig - make all V=1 # Check if there are any stray printf/ets_printf references in WiFi libs - - cd ../components/esp32/lib + - cd ../components/esp_wifi/lib_esp32 - test $(xtensa-esp32-elf-nm *.a | grep -w printf | wc -l) -eq 0 - test $(xtensa-esp32-elf-nm *.a | grep -w ets_printf | wc -l) -eq 0 diff --git a/.gitmodules b/.gitmodules index a9489d8a1..9c1e24c7b 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,7 +1,3 @@ -[submodule "components/esp32/lib"] - path = components/esp32/lib - url = https://github.com/espressif/esp32-wifi-lib.git - [submodule "components/esptool_py/esptool"] path = components/esptool_py/esptool url = https://github.com/espressif/esptool.git @@ -69,3 +65,7 @@ [submodule "examples/build_system/cmake/import_lib/main/lib/tinyxml2"] path = examples/build_system/cmake/import_lib/main/lib/tinyxml2 url = https://github.com/leethomason/tinyxml2 + +[submodule "components/esp_wifi/lib_esp32"] + path = components/esp_wifi/lib_esp32 + url = https://github.com/espressif/esp32-wifi-lib.git diff --git a/components/bootloader/subproject/main/Makefile.projbuild b/components/bootloader/subproject/main/Makefile.projbuild index c368c6841..2e628b6d5 100644 --- a/components/bootloader/subproject/main/Makefile.projbuild +++ b/components/bootloader/subproject/main/Makefile.projbuild @@ -1,4 +1,4 @@ # Submodules normally added in component.mk, but fully qualified # paths can be added at this level (we need binary librtc to be # available to link bootloader). -COMPONENT_SUBMODULES += $(IDF_PATH)/components/esp32/lib +COMPONENT_SUBMODULES += $(IDF_PATH)/components/esp_wifi/lib_esp32 diff --git a/components/esp32/CMakeLists.txt b/components/esp32/CMakeLists.txt index 5b418269d..e16888ac6 100644 --- a/components/esp32/CMakeLists.txt +++ b/components/esp32/CMakeLists.txt @@ -13,7 +13,6 @@ else() "cache_err_int.c" "cache_sram_mmu.c" "clk.c" - "coexist.c" "cpu_start.c" "crosscore_int.c" "dport_access.c" @@ -21,26 +20,21 @@ else() "esp_adapter.c" "esp_timer_esp32.c" "esp_himem.c" - "fast_crypto_ops.c" "freertos_hooks.c" "gdbstub.c" "hw_random.c" "int_wdt.c" "intr_alloc.c" "ipc.c" - "lib_printf.c" "panic.c" - "phy_init.c" "pm_esp32.c" "pm_trace.c" "reset_reason.c" - "restore.c" "sleep_modes.c" "spiram.c" "spiram_psram.c" "system_api.c" - "task_wdt.c" - "wifi_init.c") + "task_wdt.c") set(COMPONENT_ADD_INCLUDEDIRS "include") set(COMPONENT_REQUIRES driver esp_event efuse) @@ -48,16 +42,12 @@ else() # app_update is added here because cpu_start.c uses esp_ota_get_app_description() function. set(COMPONENT_PRIV_REQUIRES app_trace app_update bootloader_support log mbedtls nvs_flash - pthread smartconfig_ack spi_flash vfs wpa_supplicant espcoredump esp_common) + pthread smartconfig_ack spi_flash vfs wpa_supplicant espcoredump esp_common esp_wifi) set(COMPONENT_ADD_LDFRAGMENTS linker.lf ld/esp32_fragments.lf) register_component() - target_link_libraries(${COMPONENT_TARGET} "-L ${CMAKE_CURRENT_SOURCE_DIR}/lib") - if(NOT CONFIG_NO_BLOBS) - target_link_libraries(${COMPONENT_TARGET} coexist core espnow mesh net80211 phy pp rtc smartconfig wpa2 wpa wps) - endif() target_linker_script(${COMPONENT_TARGET} "${CMAKE_CURRENT_BINARY_DIR}/esp32_out.ld") if(CONFIG_SPIRAM_ALLOW_BSS_SEG_EXTERNAL_MEMORY) @@ -101,27 +91,6 @@ else() add_custom_target(esp32_linker_script DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/esp32_out.ld) add_dependencies(${COMPONENT_TARGET} esp32_linker_script) - if(CONFIG_ESP32_PHY_INIT_DATA_IN_PARTITION AND IDF_BUILD_ARTIFACTS) - partition_table_get_partition_info(phy_partition_offset "--partition-type data --partition-subtype phy" "offset") - set(phy_init_data_bin "${IDF_BUILD_ARTIFACTS_DIR}/phy_init_data.bin") - - # To get the phy_init_data.bin file, compile phy_init_data.h as a C file and then objcopy - # the object file to a raw binary - add_custom_command( - OUTPUT ${phy_init_data_bin} - DEPENDS ${CMAKE_CURRENT_LIST_DIR}/phy_init_data.h - COMMAND ${CMAKE_C_COMPILER} -x c -c - -I ${CMAKE_CURRENT_LIST_DIR} -I ${CMAKE_CURRENT_LIST_DIR}/include -I ${IDF_BUILD_ARTIFACTS_DIR} - -o phy_init_data.obj - ${CMAKE_CURRENT_LIST_DIR}/phy_init_data.h - COMMAND ${CMAKE_OBJCOPY} -O binary phy_init_data.obj ${phy_init_data_bin} - ) - add_custom_target(phy_init_data ALL DEPENDS ${phy_init_data_bin}) - add_dependencies(flash phy_init_data) - - esptool_py_flash_project_args(phy ${phy_partition_offset} ${phy_init_data_bin} FLASH_IN_PROJECT) - endif() - # Enable dynamic esp_timer overflow value if building unit tests if(esp32_test IN_LIST BUILD_TEST_COMPONENTS) add_definitions(-DESP_TIMER_DYNAMIC_OVERFLOW_VAL) diff --git a/components/esp32/component.mk b/components/esp32/component.mk index abba9bbaf..a067b6035 100644 --- a/components/esp32/component.mk +++ b/components/esp32/component.mk @@ -3,10 +3,6 @@ # COMPONENT_SRCDIRS := . -LIBS ?= -ifndef CONFIG_NO_BLOBS -LIBS += core rtc net80211 pp wpa smartconfig coexist wps wpa2 espnow phy mesh -endif ifdef CONFIG_SPIRAM_ALLOW_BSS_SEG_EXTERNAL_MEMORY # This linker script must come before esp32.project.ld @@ -22,8 +18,6 @@ LINKER_SCRIPTS += $(COMPONENT_BUILD_DIR)/esp32.project.ld esp32.peripherals.ld #linker will ignore panic_highint_hdl.S as it has no other files depending on any #symbols in it. COMPONENT_ADD_LDFLAGS += $(COMPONENT_PATH)/libhal.a \ - -L$(COMPONENT_PATH)/lib \ - $(addprefix -l,$(LIBS)) \ -L $(COMPONENT_PATH)/ld \ -T esp32_out.ld \ -u ld_include_panic_highint_hdl \ @@ -31,14 +25,9 @@ COMPONENT_ADD_LDFLAGS += $(COMPONENT_PATH)/libhal.a \ COMPONENT_ADD_LDFRAGMENTS += ld/esp32_fragments.lf linker.lf -ALL_LIB_FILES := $(patsubst %,$(COMPONENT_PATH)/lib/lib%.a,$(LIBS)) - -COMPONENT_SUBMODULES += lib - # final linking of project ELF depends on all binary libraries, and # all linker scripts (except esp32_out.ld, as this is code generated here.) -COMPONENT_ADD_LINKER_DEPS := $(ALL_LIB_FILES) \ - $(addprefix ld/, $(filter-out $(COMPONENT_BUILD_DIR)/esp32.project.ld, $(LINKER_SCRIPTS))) \ +COMPONENT_ADD_LINKER_DEPS := $(addprefix ld/, $(filter-out $(COMPONENT_BUILD_DIR)/esp32.project.ld, $(LINKER_SCRIPTS))) \ $(COMPONENT_BUILD_DIR)/esp32.project.ld # Preprocess esp32.ld linker script into esp32_out.ld diff --git a/components/esp32/esp_adapter.c b/components/esp32/esp_adapter.c index 342494233..7224414e8 100644 --- a/components/esp32/esp_adapter.c +++ b/components/esp32/esp_adapter.c @@ -33,8 +33,8 @@ #include "esp_attr.h" #include "esp_log.h" #include "esp_heap_caps.h" -#include "esp_wifi_os_adapter.h" -#include "esp_wifi_internal.h" +#include "esp_private/wifi_os_adapter.h" +#include "esp_private/wifi.h" #include "esp_phy_init.h" #include "crypto/md5.h" #include "crypto/sha1.h" diff --git a/components/esp32/linker.lf b/components/esp32/linker.lf index 040e29336..f4b9a5d5f 100644 --- a/components/esp32/linker.lf +++ b/components/esp32/linker.lf @@ -1,42 +1,19 @@ [mapping] archive: libesp32.a -entries: +entries: panic (noflash) -[mapping] -archive: libphy.a -entries: - * (noflash_data) - [mapping] archive: libhal.a -entries: - * (noflash_text) - -[mapping] -archive: librtc.a -entries: +entries: * (noflash_text) [mapping] archive: libgcc.a -entries: +entries: lib2funcs (noflash_text) [mapping] archive: libgcov.a -entries: +entries: * (noflash) - -[mapping] -archive: libpp.a -entries: - : ESP32_WIFI_IRAM_OPT = y - * (wifi_iram) - -[mapping] -archive: libnet80211.a -entries: - : ESP32_WIFI_IRAM_OPT = y - * (wifi_iram) - diff --git a/components/esp32/system_api.c b/components/esp32/system_api.c index cf6f74b41..120e9ec46 100644 --- a/components/esp32/system_api.c +++ b/components/esp32/system_api.c @@ -17,7 +17,7 @@ #include "esp_system.h" #include "esp_attr.h" #include "esp_wifi.h" -#include "esp_wifi_internal.h" +#include "esp_private/wifi.h" #include "esp_log.h" #include "sdkconfig.h" #include "esp32/rom/efuse.h" diff --git a/components/esp32/test/CMakeLists.txt b/components/esp32/test/CMakeLists.txt index bae2493d3..56ef10f5e 100644 --- a/components/esp32/test/CMakeLists.txt +++ b/components/esp32/test/CMakeLists.txt @@ -10,28 +10,6 @@ add_custom_command(OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/test_tjpgd_logo.h" WORKING_DIRECTORY ${COMPONENT_PATH} DEPENDS "${CMAKE_CURRENT_LIST_DIR}/logo.jpg") -# Calculate MD5 value of header file esp_wifi_os_adapter.h -execute_process(COMMAND md5sum ${IDF_PATH}/components/esp32/include/esp_wifi_os_adapter.h - COMMAND cut -c 1-7 - OUTPUT_VARIABLE WIFI_OS_ADAPTER_MD5 - OUTPUT_STRIP_TRAILING_WHITESPACE) - -# Calculate MD5 value of header file esp_wifi_crypto_types.h -execute_process(COMMAND md5sum ${IDF_PATH}/components/esp32/include/esp_wifi_crypto_types.h - COMMAND cut -c 1-7 - OUTPUT_VARIABLE WIFI_CRYPTO_MD5 - OUTPUT_STRIP_TRAILING_WHITESPACE) - -# Calculate MD5 value of header file esp_coexist_adapter.h -execute_process(COMMAND md5sum ${IDF_PATH}/components/esp32/include/esp_coexist_adapter.h - COMMAND cut -c 1-7 - OUTPUT_VARIABLE COEX_ADAPTER_MD5 - OUTPUT_STRIP_TRAILING_WHITESPACE) - -add_definitions(-DWIFI_OS_ADAPTER_MD5=\"${WIFI_OS_ADAPTER_MD5}\") -add_definitions(-DWIFI_CRYPTO_MD5=\"${WIFI_CRYPTO_MD5}\") -add_definitions(-DCOEX_ADAPTER_MD5=\"${COEX_ADAPTER_MD5}\") - add_custom_target(esp32_test_logo DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/test_tjpgd_logo.h") add_dependencies(${COMPONENT_TARGET} esp32_test_logo) diff --git a/components/esp32/test/component.mk b/components/esp32/test/component.mk index 6fb41f30a..eefb592ac 100644 --- a/components/esp32/test/component.mk +++ b/components/esp32/test/component.mk @@ -8,18 +8,6 @@ COMPONENT_ADD_LDFLAGS = -Wl,--whole-archive -l$(COMPONENT_NAME) -Wl,--no-whole-a COMPONENT_SRCDIRS := . -# Calculate MD5 value of header file esp_wifi_os_adapter.h -WIFI_OS_ADAPTER_MD5_VAL=\"$(shell md5sum $(IDF_PATH)/components/esp32/include/esp_wifi_os_adapter.h | cut -c 1-7)\" -CFLAGS+=-DWIFI_OS_ADAPTER_MD5=$(WIFI_OS_ADAPTER_MD5_VAL) - -# Calculate MD5 value of header file esp_wifi_crypto_types.h -WIFI_CRYPTO_MD5_VAL=\"$(shell md5sum $(IDF_PATH)/components/esp32/include/esp_wifi_crypto_types.h | cut -c 1-7)\" -CFLAGS+=-DWIFI_CRYPTO_MD5=$(WIFI_CRYPTO_MD5_VAL) - -# Calculate MD5 value of header file esp_coexist_adapter.h -COEX_ADAPTER_MD5_VAL=\"$(shell md5sum $(IDF_PATH)/components/esp32/include/esp_coexist_adapter.h | cut -c 1-7)\" -CFLAGS+=-DCOEX_ADAPTER_MD5=$(COEX_ADAPTER_MD5_VAL) - test_tjpgd.o: test_tjpgd_logo.h test_tjpgd_logo.h: $(COMPONENT_PATH)/logo.jpg diff --git a/components/esp_event/event_default_handlers.c b/components/esp_event/event_default_handlers.c index 1a08e7e48..7506d9614 100644 --- a/components/esp_event/event_default_handlers.c +++ b/components/esp_event/event_default_handlers.c @@ -18,7 +18,7 @@ #include "esp_err.h" #include "esp_wifi.h" -#include "esp_wifi_internal.h" +#include "esp_private/wifi.h" #include "esp_event.h" #include "esp_event_loop.h" #include "esp_task.h" diff --git a/components/esp_wifi/CMakeLists.txt b/components/esp_wifi/CMakeLists.txt new file mode 100644 index 000000000..433d20f72 --- /dev/null +++ b/components/esp_wifi/CMakeLists.txt @@ -0,0 +1,41 @@ +set(COMPONENT_SRCS + "src/coexist.c" + "src/fast_crypto_ops.c" + "src/lib_printf.c" + "src/phy_init.c" + "src/restore.c" + "src/wifi_init.c") +set(COMPONENT_ADD_INCLUDEDIRS "include") +set(COMPONENT_PRIV_INCLUDEDIRS) +set(COMPONENT_REQUIRES) +set(COMPONENT_PRIV_REQUIRES "wpa_supplicant" "nvs_flash") +set(COMPONENT_ADD_LDFRAGMENTS "linker.lf") + +register_component() + +target_link_libraries(${COMPONENT_TARGET} "-L ${CMAKE_CURRENT_SOURCE_DIR}/lib_${IDF_TARGET}") + +if(NOT CONFIG_NO_BLOBS) + target_link_libraries(${COMPONENT_TARGET} coexist core espnow mesh net80211 phy pp rtc smartconfig wpa2 wpa wps) +endif() + +if(CONFIG_ESP32_PHY_INIT_DATA_IN_PARTITION AND IDF_BUILD_ARTIFACTS) + partition_table_get_partition_info(phy_partition_offset "--partition-type data --partition-subtype phy" "offset") + set(phy_init_data_bin "${IDF_BUILD_ARTIFACTS_DIR}/phy_init_data.bin") + # To get the phy_init_data.bin file, compile phy_init_data.h as a C file and then objcopy + # the object file to a raw binary + add_custom_command( + OUTPUT ${phy_init_data_bin} + DEPENDS ${CMAKE_CURRENT_LIST_DIR}/include/phy_init_data.h + COMMAND ${CMAKE_C_COMPILER} -x c -c + -I ${CMAKE_CURRENT_LIST_DIR} -I ${CMAKE_CURRENT_LIST_DIR}/include -I ${IDF_BUILD_ARTIFACTS_DIR} + -o phy_init_data.obj + ${CMAKE_CURRENT_LIST_DIR}/include/phy_init_data.h + COMMAND ${CMAKE_OBJCOPY} -O binary phy_init_data.obj ${phy_init_data_bin} + ) + add_custom_target(phy_init_data ALL DEPENDS ${phy_init_data_bin}) + add_dependencies(flash phy_init_data) + + esptool_py_flash_project_args(phy ${phy_partition_offset} ${phy_init_data_bin} FLASH_IN_PROJECT) + +endif() diff --git a/components/esp_wifi/component.mk b/components/esp_wifi/component.mk new file mode 100644 index 000000000..cc865ea51 --- /dev/null +++ b/components/esp_wifi/component.mk @@ -0,0 +1,21 @@ +# +# Component Makefile +# + +COMPONENT_ADD_INCLUDEDIRS := include +COMPONENT_SRCDIRS := src + +LIBS ?= +ifndef CONFIG_NO_BLOBS +LIBS += core rtc net80211 pp wpa smartconfig coexist wps wpa2 espnow phy mesh +endif + +COMPONENT_ADD_LDFLAGS += -L$(COMPONENT_PATH)/lib_esp32 \ + $(addprefix -l,$(LIBS)) \ + +COMPONENT_ADD_LDFRAGMENTS += linker.lf + +COMPONENT_SUBMODULES += lib_esp32 + +ALL_LIB_FILES := $(patsubst %,$(COMPONENT_PATH)/lib_esp32/lib%.a,$(LIBS)) +COMPONENT_ADD_LINKER_DEPS += $(ALL_LIB_FILES) diff --git a/components/esp32/include/esp_coexist.h b/components/esp_wifi/include/esp_coexist.h similarity index 100% rename from components/esp32/include/esp_coexist.h rename to components/esp_wifi/include/esp_coexist.h diff --git a/components/esp32/include/esp_coexist_adapter.h b/components/esp_wifi/include/esp_coexist_adapter.h similarity index 100% rename from components/esp32/include/esp_coexist_adapter.h rename to components/esp_wifi/include/esp_coexist_adapter.h diff --git a/components/esp32/include/esp_coexist_internal.h b/components/esp_wifi/include/esp_coexist_internal.h similarity index 100% rename from components/esp32/include/esp_coexist_internal.h rename to components/esp_wifi/include/esp_coexist_internal.h diff --git a/components/esp32/include/esp_mesh.h b/components/esp_wifi/include/esp_mesh.h similarity index 100% rename from components/esp32/include/esp_mesh.h rename to components/esp_wifi/include/esp_mesh.h diff --git a/components/esp32/include/esp_mesh_internal.h b/components/esp_wifi/include/esp_mesh_internal.h similarity index 99% rename from components/esp32/include/esp_mesh_internal.h rename to components/esp_wifi/include/esp_mesh_internal.h index e061c4577..89b03e7f2 100644 --- a/components/esp32/include/esp_mesh_internal.h +++ b/components/esp_wifi/include/esp_mesh_internal.h @@ -18,7 +18,7 @@ #include "esp_err.h" #include "esp_wifi.h" #include "esp_wifi_types.h" -#include "esp_wifi_internal.h" +#include "esp_private/wifi.h" #include "esp_wifi_crypto_types.h" #ifdef __cplusplus diff --git a/components/esp32/include/esp_now.h b/components/esp_wifi/include/esp_now.h similarity index 100% rename from components/esp32/include/esp_now.h rename to components/esp_wifi/include/esp_now.h diff --git a/components/esp32/include/esp_phy_init.h b/components/esp_wifi/include/esp_phy_init.h similarity index 100% rename from components/esp32/include/esp_phy_init.h rename to components/esp_wifi/include/esp_phy_init.h diff --git a/components/esp32/include/esp_wifi_internal.h b/components/esp_wifi/include/esp_private/wifi.h similarity index 100% rename from components/esp32/include/esp_wifi_internal.h rename to components/esp_wifi/include/esp_private/wifi.h diff --git a/components/esp32/include/esp_wifi_os_adapter.h b/components/esp_wifi/include/esp_private/wifi_os_adapter.h similarity index 100% rename from components/esp32/include/esp_wifi_os_adapter.h rename to components/esp_wifi/include/esp_private/wifi_os_adapter.h diff --git a/components/esp32/include/esp_smartconfig.h b/components/esp_wifi/include/esp_smartconfig.h similarity index 100% rename from components/esp32/include/esp_smartconfig.h rename to components/esp_wifi/include/esp_smartconfig.h diff --git a/components/esp32/include/esp_wifi.h b/components/esp_wifi/include/esp_wifi.h similarity index 99% rename from components/esp32/include/esp_wifi.h rename to components/esp_wifi/include/esp_wifi.h index bc8d0a844..05265257a 100644 --- a/components/esp32/include/esp_wifi.h +++ b/components/esp_wifi/include/esp_wifi.h @@ -67,7 +67,7 @@ #include "esp_wifi_types.h" #include "esp_wifi_crypto_types.h" #include "esp_event.h" -#include "esp_wifi_os_adapter.h" +#include "esp_private/wifi_os_adapter.h" #ifdef __cplusplus extern "C" { diff --git a/components/esp32/include/esp_wifi_crypto_types.h b/components/esp_wifi/include/esp_wifi_crypto_types.h similarity index 100% rename from components/esp32/include/esp_wifi_crypto_types.h rename to components/esp_wifi/include/esp_wifi_crypto_types.h diff --git a/components/esp32/include/esp_wifi_types.h b/components/esp_wifi/include/esp_wifi_types.h similarity index 100% rename from components/esp32/include/esp_wifi_types.h rename to components/esp_wifi/include/esp_wifi_types.h diff --git a/components/esp32/include/esp_wpa2.h b/components/esp_wifi/include/esp_wpa2.h similarity index 100% rename from components/esp32/include/esp_wpa2.h rename to components/esp_wifi/include/esp_wpa2.h diff --git a/components/esp32/include/esp_wps.h b/components/esp_wifi/include/esp_wps.h similarity index 100% rename from components/esp32/include/esp_wps.h rename to components/esp_wifi/include/esp_wps.h diff --git a/components/esp32/phy.h b/components/esp_wifi/include/phy.h similarity index 100% rename from components/esp32/phy.h rename to components/esp_wifi/include/phy.h diff --git a/components/esp32/phy_init_data.h b/components/esp_wifi/include/phy_init_data.h similarity index 100% rename from components/esp32/phy_init_data.h rename to components/esp_wifi/include/phy_init_data.h diff --git a/components/esp32/lib b/components/esp_wifi/lib_esp32 similarity index 100% rename from components/esp32/lib rename to components/esp_wifi/lib_esp32 diff --git a/components/esp_wifi/linker.lf b/components/esp_wifi/linker.lf new file mode 100644 index 000000000..4c01c3135 --- /dev/null +++ b/components/esp_wifi/linker.lf @@ -0,0 +1,22 @@ +[mapping] +archive: libphy.a +entries: + * (noflash_data) + +[mapping] +archive: librtc.a +entries: + * (noflash_text) + +[mapping] +archive: libpp.a +entries: + : ESP32_WIFI_IRAM_OPT = y + * (wifi_iram) + +[mapping] +archive: libnet80211.a +entries: + : ESP32_WIFI_IRAM_OPT = y + * (wifi_iram) + diff --git a/components/esp32/coexist.c b/components/esp_wifi/src/coexist.c similarity index 100% rename from components/esp32/coexist.c rename to components/esp_wifi/src/coexist.c diff --git a/components/esp32/fast_crypto_ops.c b/components/esp_wifi/src/fast_crypto_ops.c similarity index 100% rename from components/esp32/fast_crypto_ops.c rename to components/esp_wifi/src/fast_crypto_ops.c diff --git a/components/esp32/lib_printf.c b/components/esp_wifi/src/lib_printf.c similarity index 100% rename from components/esp32/lib_printf.c rename to components/esp_wifi/src/lib_printf.c diff --git a/components/esp32/phy_init.c b/components/esp_wifi/src/phy_init.c similarity index 99% rename from components/esp32/phy_init.c rename to components/esp_wifi/src/phy_init.c index 6dfe83795..2fade4e35 100644 --- a/components/esp32/phy_init.c +++ b/components/esp_wifi/src/phy_init.c @@ -38,7 +38,7 @@ #include "phy_init_data.h" #include "esp_coexist_internal.h" #include "driver/periph_ctrl.h" -#include "esp_wifi_internal.h" +#include "esp_private/wifi.h" extern wifi_mac_time_update_cb_t s_wifi_mac_time_update_cb; diff --git a/components/esp32/restore.c b/components/esp_wifi/src/restore.c similarity index 100% rename from components/esp32/restore.c rename to components/esp_wifi/src/restore.c diff --git a/components/esp32/wifi_init.c b/components/esp_wifi/src/wifi_init.c similarity index 99% rename from components/esp32/wifi_init.c rename to components/esp_wifi/src/wifi_init.c index cf5d79b7b..2115dc614 100644 --- a/components/esp32/wifi_init.c +++ b/components/esp_wifi/src/wifi_init.c @@ -15,7 +15,7 @@ #include #include #include "esp_log.h" -#include "esp_wifi_internal.h" +#include "esp_private/wifi.h" #include "esp_pm.h" #include "soc/rtc.h" #include "esp_mesh.h" diff --git a/components/esp_wifi/test/CMakeLists.txt b/components/esp_wifi/test/CMakeLists.txt new file mode 100644 index 000000000..4c300eadc --- /dev/null +++ b/components/esp_wifi/test/CMakeLists.txt @@ -0,0 +1,28 @@ +set(COMPONENT_SRCDIRS ".") +set(COMPONENT_ADD_INCLUDEDIRS ". ${CMAKE_CURRENT_BINARY_DIR}") + +set(COMPONENT_REQUIRES unity test_utils nvs_flash ulp esp_common) + +register_component() + +# Calculate MD5 value of header file esp_wifi_os_adapter.h +execute_process(COMMAND md5sum ${IDF_PATH}/components/esp_wifi/include/esp_private/wifi_os_adapter.h + COMMAND cut -c 1-7 + OUTPUT_VARIABLE WIFI_OS_ADAPTER_MD5 + OUTPUT_STRIP_TRAILING_WHITESPACE) + +# Calculate MD5 value of header file esp_wifi_crypto_types.h +execute_process(COMMAND md5sum ${IDF_PATH}/components/esp_wifi/include/esp_wifi_crypto_types.h + COMMAND cut -c 1-7 + OUTPUT_VARIABLE WIFI_CRYPTO_MD5 + OUTPUT_STRIP_TRAILING_WHITESPACE) + +# Calculate MD5 value of header file esp_coexist_adapter.h +execute_process(COMMAND md5sum ${IDF_PATH}/components/esp_wifi/include/esp_coexist_adapter.h + COMMAND cut -c 1-7 + OUTPUT_VARIABLE COEX_ADAPTER_MD5 + OUTPUT_STRIP_TRAILING_WHITESPACE) + +add_definitions(-DWIFI_OS_ADAPTER_MD5=\"${WIFI_OS_ADAPTER_MD5}\") +add_definitions(-DWIFI_CRYPTO_MD5=\"${WIFI_CRYPTO_MD5}\") +add_definitions(-DCOEX_ADAPTER_MD5=\"${COEX_ADAPTER_MD5}\") diff --git a/components/esp_wifi/test/component.mk b/components/esp_wifi/test/component.mk new file mode 100644 index 000000000..88f939f81 --- /dev/null +++ b/components/esp_wifi/test/component.mk @@ -0,0 +1,19 @@ +# +#Component Makefile +# + +COMPONENT_ADD_LDFLAGS = -Wl,--whole-archive -l$(COMPONENT_NAME) -Wl,--no-whole-archive + +COMPONENT_SRCDIRS := . + +# Calculate MD5 value of header file esp_wifi_os_adapter.h +WIFI_OS_ADAPTER_MD5_VAL=\"$(shell md5sum $(IDF_PATH)/components/esp_wifi/include/esp_private/wifi_os_adapter.h | cut -c 1-7)\" +CFLAGS+=-DWIFI_OS_ADAPTER_MD5=$(WIFI_OS_ADAPTER_MD5_VAL) + +# Calculate MD5 value of header file esp_wifi_crypto_types.h +WIFI_CRYPTO_MD5_VAL=\"$(shell md5sum $(IDF_PATH)/components/esp_wifi/include/esp_wifi_crypto_types.h | cut -c 1-7)\" +CFLAGS+=-DWIFI_CRYPTO_MD5=$(WIFI_CRYPTO_MD5_VAL) + +# Calculate MD5 value of header file esp_coexist_adapter.h +COEX_ADAPTER_MD5_VAL=\"$(shell md5sum $(IDF_PATH)/components/esp_wifi/include/esp_coexist_adapter.h | cut -c 1-7)\" +CFLAGS+=-DCOEX_ADAPTER_MD5=$(COEX_ADAPTER_MD5_VAL) diff --git a/components/esp32/test/test_header_files_md5.c b/components/esp_wifi/test/test_header_files_md5.c similarity index 97% rename from components/esp32/test/test_header_files_md5.c rename to components/esp_wifi/test/test_header_files_md5.c index c2d80350a..cccf7028a 100644 --- a/components/esp32/test/test_header_files_md5.c +++ b/components/esp_wifi/test/test_header_files_md5.c @@ -3,7 +3,7 @@ */ #include "unity.h" #include "esp_log.h" -#include "esp_wifi_internal.h" +#include "esp_private/wifi.h" #include "esp_coexist_internal.h" static const char* TAG = "test_header_files_md5"; diff --git a/components/esp32/test/test_phy_rtc.c b/components/esp_wifi/test/test_phy_rtc.c similarity index 100% rename from components/esp32/test/test_phy_rtc.c rename to components/esp_wifi/test/test_phy_rtc.c diff --git a/components/esp32/test/test_wifi.c b/components/esp_wifi/test/test_wifi.c similarity index 100% rename from components/esp32/test/test_wifi.c rename to components/esp_wifi/test/test_wifi.c diff --git a/components/esp32/test/test_wifi_lib_git_commit.c b/components/esp_wifi/test/test_wifi_lib_git_commit.c similarity index 85% rename from components/esp32/test/test_wifi_lib_git_commit.c rename to components/esp_wifi/test/test_wifi_lib_git_commit.c index fbf1dea0e..f8e6f3940 100644 --- a/components/esp32/test/test_wifi_lib_git_commit.c +++ b/components/esp_wifi/test/test_wifi_lib_git_commit.c @@ -3,7 +3,7 @@ */ #include "unity.h" #include "esp_log.h" -#include "esp_wifi_internal.h" +#include "esp_private/wifi.h" TEST_CASE("wifi lib git commit id","[wifi]") { diff --git a/components/lwip/CMakeLists.txt b/components/lwip/CMakeLists.txt index aa53a6fec..b5e1ee8a2 100644 --- a/components/lwip/CMakeLists.txt +++ b/components/lwip/CMakeLists.txt @@ -121,7 +121,7 @@ if(CONFIG_PPP_SUPPORT) "lwip/src/netif/ppp/polarssl/sha1.c") endif() -set(COMPONENT_REQUIRES vfs) +set(COMPONENT_REQUIRES vfs esp_wifi) set(COMPONENT_PRIV_REQUIRES ethernet tcpip_adapter nvs_flash) set(COMPONENT_ADD_LDFRAGMENTS linker.lf) diff --git a/components/lwip/port/esp32/include/netif/wlanif.h b/components/lwip/port/esp32/include/netif/wlanif.h index 9c79f5b0a..21fa91c34 100644 --- a/components/lwip/port/esp32/include/netif/wlanif.h +++ b/components/lwip/port/esp32/include/netif/wlanif.h @@ -18,7 +18,7 @@ #include "esp_wifi.h" -#include "esp_wifi_internal.h" +#include "esp_private/wifi.h" #include "lwip/err.h" diff --git a/docs/Doxyfile b/docs/Doxyfile index aa3096bad..250384d2e 100644 --- a/docs/Doxyfile +++ b/docs/Doxyfile @@ -24,12 +24,12 @@ INPUT = \ ## ## Wi-Fi - API Reference ## - ../../components/esp32/include/esp_wifi.h \ - ../../components/esp32/include/esp_wifi_types.h \ - ../../components/esp32/include/esp_smartconfig.h \ - ../../components/esp32/include/esp_now.h \ + ../../components/esp_wifi/include/esp_wifi.h \ + ../../components/esp_wifi/include/esp_wifi_types.h \ + ../../components/esp_wifi/include/esp_smartconfig.h \ + ../../components/esp_wifi/include/esp_now.h \ ## Mesh - API Reference - ../../components/esp32/include/esp_mesh.h \ + ../../components/esp_wifi/include/esp_mesh.h \ ## Bluetooth - API Reference ## Controller && VHCI ../../components/bt/include/esp_bt.h \ diff --git a/tools/ci/mirror-list.txt b/tools/ci/mirror-list.txt index 8495ee139..fbb8f1544 100644 --- a/tools/ci/mirror-list.txt +++ b/tools/ci/mirror-list.txt @@ -1,4 +1,4 @@ -components/esp32/lib @GENERAL_MIRROR_SERVER@/idf/esp32-wifi-lib.git +components/esp_wifi/lib_esp32 @GENERAL_MIRROR_SERVER@/idf/esp32-wifi-lib.git components/bt/lib @GENERAL_MIRROR_SERVER@/idf/esp32-bt-lib.git components/esptool_py/esptool @GENERAL_MIRROR_SERVER@/idf/esptool.git components/aws_iot/aws-iot-device-sdk-embedded-C @GENERAL_MIRROR_SERVER@/idf/aws-iot-device-sdk-embedded-C.git ALLOW_TO_SYNC_FROM_PUBLIC