diff --git a/.gitlab/CODEOWNERS b/.gitlab/CODEOWNERS index 3bf42b510d..66dc78c682 100644 --- a/.gitlab/CODEOWNERS +++ b/.gitlab/CODEOWNERS @@ -87,6 +87,7 @@ /components/esp_lcd/ @esp-idf-codeowners/peripherals /components/esp_local_ctrl/ @esp-idf-codeowners/app-utilities /components/esp_netif/ @esp-idf-codeowners/network +/components/esp_phy/ @esp-idf-codeowners/bluetooth @esp-idf-codeowners/wifi @esp-idf-codeowners/ieee802154 /components/esp_pm/ @esp-idf-codeowners/power-management /components/esp_ringbuf/ @esp-idf-codeowners/system /components/esp_rom/ @esp-idf-codeowners/system diff --git a/.gitlab/ci/rules.yml b/.gitlab/ci/rules.yml index 8c2d26730e..b10a61eea8 100644 --- a/.gitlab/ci/rules.yml +++ b/.gitlab/ci/rules.yml @@ -137,6 +137,7 @@ - "components/cmock/CMock/vendor/unity" - "components/coap/libcoap" - "components/coap/libcoap/ext/tinydtls" + - "components/esp_phy/lib" - "components/esp_wifi/lib" - "components/esptool_py/esptool" - "components/expat/expat" diff --git a/.gitmodules b/.gitmodules index b67e83bd87..09b86fe88e 100644 --- a/.gitmodules +++ b/.gitmodules @@ -98,3 +98,7 @@ [submodule "components/bt/controller/lib_esp32c3_family"] path = components/bt/controller/lib_esp32c3_family url = ../../espressif/esp32c3-bt-lib.git + +[submodule "components/esp_phy/lib"] + path = components/esp_phy/lib + url = ../../espressif/esp-phy-lib.git diff --git a/components/bt/CMakeLists.txt b/components/bt/CMakeLists.txt index 7bc0522f1c..0f8d13df63 100644 --- a/components/bt/CMakeLists.txt +++ b/components/bt/CMakeLists.txt @@ -582,7 +582,7 @@ endif() idf_component_register(SRCS "${srcs}" INCLUDE_DIRS "${include_dirs}" PRIV_INCLUDE_DIRS "${priv_include_dirs}" - REQUIRES nvs_flash soc esp_timer esp_pm + REQUIRES nvs_flash soc esp_timer esp_pm esp_phy PRIV_REQUIRES esp_ipc LDFRAGMENTS "linker.lf") @@ -594,11 +594,11 @@ if(CONFIG_BT_ENABLED) elseif(CONFIG_IDF_TARGET_ESP32C3) target_link_libraries(${COMPONENT_LIB} INTERFACE "-L${CMAKE_CURRENT_LIST_DIR}/controller/lib_esp32c3_family/esp32c3") - target_link_libraries(${COMPONENT_LIB} PUBLIC btdm_app btbb) + target_link_libraries(${COMPONENT_LIB} PUBLIC btdm_app) elseif(CONFIG_IDF_TARGET_ESP32S3) target_link_libraries(${COMPONENT_LIB} INTERFACE "-L${CMAKE_CURRENT_LIST_DIR}/controller/lib_esp32c3_family/esp32s3") - target_link_libraries(${COMPONENT_LIB} PUBLIC btdm_app btbb) + target_link_libraries(${COMPONENT_LIB} PUBLIC btdm_app) endif() endif() diff --git a/components/bt/controller/lib_esp32c3_family b/components/bt/controller/lib_esp32c3_family index 90b025633a..41be310daa 160000 --- a/components/bt/controller/lib_esp32c3_family +++ b/components/bt/controller/lib_esp32c3_family @@ -1 +1 @@ -Subproject commit 90b025633add12d18ab056ce8db20d06deb40f06 +Subproject commit 41be310daa209dbaafdbf68426becabcda6c95fc diff --git a/components/esp_phy/CMakeLists.txt b/components/esp_phy/CMakeLists.txt new file mode 100644 index 0000000000..4d98099422 --- /dev/null +++ b/components/esp_phy/CMakeLists.txt @@ -0,0 +1,70 @@ +idf_build_get_property(idf_target IDF_TARGET) + +if(CONFIG_ESP32_NO_BLOBS OR CONFIG_ESP32S2_NO_BLOBS) + set(link_binary_libs 0) + set(ldfragments) +else() + set(link_binary_libs 1) + set(ldfragments "linker.lf") +endif() + +idf_component_register(SRCS "src/phy_init.c" + INCLUDE_DIRS "include" "${idf_target}/include" + PRIV_REQUIRES nvs_flash + LDFRAGMENTS "${ldfragments}") + +idf_build_get_property(build_dir BUILD_DIR) + +set(target_name "${idf_target}") +target_link_libraries(${COMPONENT_LIB} PUBLIC "-L ${CMAKE_CURRENT_SOURCE_DIR}/lib/${target_name}") + +if(link_binary_libs) + target_link_libraries(${COMPONENT_LIB} PUBLIC phy) + + idf_component_get_property(esp_phy_lib esp_phy COMPONENT_LIB) + target_link_libraries(${COMPONENT_LIB} INTERFACE $ libphy.a + $) + + if(CONFIG_IDF_TARGET_ESP32) + target_link_libraries(${COMPONENT_LIB} PUBLIC rtc) + endif() + + if(CONFIG_IDF_TARGET_ESP32C3 OR CONFIG_IDF_TARGET_ESP32S3) + target_link_libraries(${COMPONENT_LIB} PUBLIC btbb) + endif() +endif() + +if(CONFIG_ESP32_PHY_INIT_DATA_IN_PARTITION) + idf_component_get_property(esp_common_dir esp_common COMPONENT_DIR) + partition_table_get_partition_info(phy_partition_offset "--partition-type data --partition-subtype phy" "offset") + + if(CONFIG_ESP32_SUPPORT_MULTIPLE_PHY_INIT_DATA_BIN) + set(phy_init_data_bin "${CMAKE_CURRENT_SOURCE_DIR}/phy_multiple_init_data.bin") + else() + set(phy_init_data_bin "${build_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 + idf_build_get_property(config_dir CONFIG_DIR) + add_custom_command( + OUTPUT ${phy_init_data_bin} + DEPENDS ${CMAKE_CURRENT_LIST_DIR}/${idf_target}/include/phy_init_data.h + COMMAND ${CMAKE_C_COMPILER} -x c -c + -I ${esp_common_dir}/include -I ${CMAKE_CURRENT_LIST_DIR}/include -I ${config_dir} + -o phy_init_data.obj + ${CMAKE_CURRENT_LIST_DIR}/${idf_target}/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) + + idf_component_get_property(main_args esptool_py FLASH_ARGS) + idf_component_get_property(sub_args esptool_py FLASH_SUB_ARGS) + endif() + + set(phy_name "phy") + + esptool_py_flash_target(${phy_name}-flash "${main_args}" "${sub_args}") + esptool_py_flash_target_image(${phy_name}-flash ${phy_name} "${phy_partition_offset}" "${phy_init_data_bin}") + esptool_py_flash_target_image(flash ${phy_name} "${phy_partition_offset}" "${phy_init_data_bin}") +endif() diff --git a/components/esp_phy/Kconfig b/components/esp_phy/Kconfig new file mode 100644 index 0000000000..19e969170d --- /dev/null +++ b/components/esp_phy/Kconfig @@ -0,0 +1,99 @@ +menu "PHY" + + config ESP32_PHY_CALIBRATION_AND_DATA_STORAGE + bool "Store phy calibration data in NVS" + default y + help + If this option is enabled, NVS will be initialized and calibration data will be loaded from there. + PHY calibration will be skipped on deep sleep wakeup. If calibration data is not found, full calibration + will be performed and stored in NVS. Normally, only partial calibration will be performed. + If this option is disabled, full calibration will be performed. + + If it's easy that your board calibrate bad data, choose 'n'. + Two cases for example, you should choose 'n': + 1.If your board is easy to be booted up with antenna disconnected. + 2.Because of your board design, each time when you do calibration, the result are too unstable. + If unsure, choose 'y'. + + menuconfig ESP32_PHY_INIT_DATA_IN_PARTITION + bool "Use a partition to store PHY init data" + default n + help + If enabled, PHY init data will be loaded from a partition. + When using a custom partition table, make sure that PHY data + partition is included (type: 'data', subtype: 'phy'). + With default partition tables, this is done automatically. + If PHY init data is stored in a partition, it has to be flashed there, + otherwise runtime error will occur. + + If this option is not enabled, PHY init data will be embedded + into the application binary. + + If unsure, choose 'n'. + + config ESP32_PHY_DEFAULT_INIT_IF_INVALID + bool "Reset default PHY init data if invalid" + default n + depends on ESP32_PHY_INIT_DATA_IN_PARTITION + help + If enabled, PHY init data will be restored to default if + it cannot be verified successfully to avoid endless bootloops. + + If unsure, choose 'n'. + + if ESP32_PHY_INIT_DATA_IN_PARTITION + config ESP32_SUPPORT_MULTIPLE_PHY_INIT_DATA_BIN + bool "Support multiple PHY init data bin" + depends on ESP32_PHY_INIT_DATA_IN_PARTITION + default n + help + If enabled, the corresponding PHY init data type can be automatically switched + according to the country code. China's PHY init data bin is used by default. + Can be modified by country information in API esp_wifi_set_country(). + The priority of switching the PHY init data type is: + 1. Country configured by API esp_wifi_set_country() + and the parameter policy is WIFI_COUNTRY_POLICY_MANUAL. + 2. Country notified by the connected AP. + 3. Country configured by API esp_wifi_set_country() + and the parameter policy is WIFI_COUNTRY_POLICY_AUTO. + + config ESP32_PHY_INIT_DATA_ERROR + bool "Terminate operation when PHY init data error" + depends on ESP32_SUPPORT_MULTIPLE_PHY_INIT_DATA_BIN + default n + help + If enabled, when an error occurs while the PHY init data is updated, + the program will terminate and restart. + If not enabled, the PHY init data will not be updated when an error occurs. + endif + + config ESP32_PHY_MAX_WIFI_TX_POWER + int "Max WiFi TX power (dBm)" + range 10 20 + default 20 + help + Set maximum transmit power for WiFi radio. Actual transmit power for high + data rates may be lower than this setting. + + config ESP32_PHY_MAX_TX_POWER + int + default ESP32_PHY_MAX_WIFI_TX_POWER + + config ESP32_PHY_MAC_BB_PD + bool "Power down MAC and baseband of Wi-Fi and Bluetooth when PHY is disabled" + depends on (IDF_TARGET_ESP32C3 && FREERTOS_USE_TICKLESS_IDLE) + default n + help + If enabled, the MAC and baseband of Wi-Fi and Bluetooth will be powered + down when PHY is disabled. Enabling this setting reduces power consumption + by a small amount but increases RAM use by approximately 4 KB(Wi-Fi only), + 2 KB(Bluetooth only) or 5.3 KB(Wi-Fi + Bluetooth). + + config ESP32_REDUCE_PHY_TX_POWER + bool "Reduce PHY TX power when brownout reset" + depends on ESP32_BROWNOUT_DET + default y + help + When brownout reset occurs, reduce PHY TX power to keep the code running. + +endmenu # PHY diff --git a/components/esp_wifi/Makefile.projbuild b/components/esp_phy/Makefile.projbuild similarity index 71% rename from components/esp_wifi/Makefile.projbuild rename to components/esp_phy/Makefile.projbuild index a6c4a35591..d759446c3e 100644 --- a/components/esp_wifi/Makefile.projbuild +++ b/components/esp_phy/Makefile.projbuild @@ -1,16 +1,16 @@ ifdef CONFIG_ESP32_PHY_INIT_DATA_IN_PARTITION -ESP_WIFI_COMPONENT_PATH := $(COMPONENT_PATH) +ESP_PHY_COMPONENT_PATH := $(COMPONENT_PATH) ifdef CONFIG_ESP32_SUPPORT_MULTIPLE_PHY_INIT_DATA_BIN -PHY_INIT_DATA_BIN = $(ESP_WIFI_COMPONENT_PATH)/phy_multiple_init_data.bin +PHY_INIT_DATA_BIN = $(ESP_PHY_COMPONENT_PATH)/phy_multiple_init_data.bin else PHY_INIT_DATA_OBJ = $(BUILD_DIR_BASE)/phy_init_data.o PHY_INIT_DATA_BIN = $(BUILD_DIR_BASE)/phy_init_data.bin -$(PHY_INIT_DATA_OBJ): $(ESP_WIFI_COMPONENT_PATH)/$(IDF_TARGET)/include/phy_init_data.h $(BUILD_DIR_BASE)/include/sdkconfig.h +$(PHY_INIT_DATA_OBJ): $(ESP_PHY_COMPONENT_PATH)/$(IDF_TARGET)/include/phy_init_data.h $(BUILD_DIR_BASE)/include/sdkconfig.h $(summary) CC $(notdir $@) - printf "#include \"phy_init_data.h\"\n" | $(CC) -I $(BUILD_DIR_BASE)/include -I $(ESP_WIFI_COMPONENT_PATH)/../esp_common/include -I $(ESP_WIFI_COMPONENT_PATH)/include -I $(ESP_WIFI_COMPONENT_PATH)/$(IDF_TARGET)/include -c -o $@ -xc - + printf "#include \"phy_init_data.h\"\n" | $(CC) -I $(BUILD_DIR_BASE)/include -I $(ESP_PHY_COMPONENT_PATH)/../esp_common/include -I $(ESP_PHY_COMPONENT_PATH)/include -I $(ESP_PHY_COMPONENT_PATH)/$(IDF_TARGET)/include -c -o $@ -xc - $(PHY_INIT_DATA_BIN): $(PHY_INIT_DATA_OBJ) $(summary) BIN $(notdir $@) diff --git a/components/esp_phy/component.mk b/components/esp_phy/component.mk new file mode 100644 index 0000000000..b795371041 --- /dev/null +++ b/components/esp_phy/component.mk @@ -0,0 +1,20 @@ +# +# Component Makefile +# + +COMPONENT_ADD_INCLUDEDIRS := include $(IDF_TARGET)/include +COMPONENT_SRCDIRS := src + +ifndef CONFIG_ESP32_NO_BLOBS + LIBS := phy rtc + + COMPONENT_ADD_LDFLAGS += -L$(COMPONENT_PATH)/lib/$(IDF_TARGET) \ + $(addprefix -l,$(LIBS)) + + COMPONENT_ADD_LDFRAGMENTS += linker.lf + + COMPONENT_SUBMODULES += lib + + ALL_LIB_FILES := $(patsubst %,$(COMPONENT_PATH)/lib/$(IDF_TARGET)/lib%.a,$(LIBS)) + COMPONENT_ADD_LINKER_DEPS += $(ALL_LIB_FILES) +endif diff --git a/components/esp_wifi/esp32/include/phy_init_data.h b/components/esp_phy/esp32/include/phy_init_data.h similarity index 100% rename from components/esp_wifi/esp32/include/phy_init_data.h rename to components/esp_phy/esp32/include/phy_init_data.h diff --git a/components/esp_wifi/esp32c3/include/phy_init_data.h b/components/esp_phy/esp32c3/include/phy_init_data.h similarity index 100% rename from components/esp_wifi/esp32c3/include/phy_init_data.h rename to components/esp_phy/esp32c3/include/phy_init_data.h diff --git a/components/esp_wifi/esp32s2/include/phy_init_data.h b/components/esp_phy/esp32s2/include/phy_init_data.h similarity index 100% rename from components/esp_wifi/esp32s2/include/phy_init_data.h rename to components/esp_phy/esp32s2/include/phy_init_data.h diff --git a/components/esp_wifi/esp32s3/include/phy_init_data.h b/components/esp_phy/esp32s3/include/phy_init_data.h similarity index 100% rename from components/esp_wifi/esp32s3/include/phy_init_data.h rename to components/esp_phy/esp32s3/include/phy_init_data.h diff --git a/components/esp_wifi/include/esp_phy_init.h b/components/esp_phy/include/esp_phy_init.h similarity index 100% rename from components/esp_wifi/include/esp_phy_init.h rename to components/esp_phy/include/esp_phy_init.h diff --git a/components/esp_wifi/include/phy.h b/components/esp_phy/include/phy.h similarity index 100% rename from components/esp_wifi/include/phy.h rename to components/esp_phy/include/phy.h diff --git a/components/esp_phy/lib b/components/esp_phy/lib new file mode 160000 index 0000000000..3148305ef9 --- /dev/null +++ b/components/esp_phy/lib @@ -0,0 +1 @@ +Subproject commit 3148305ef948a539f9724443cd432a9980087755 diff --git a/components/esp_phy/linker.lf b/components/esp_phy/linker.lf new file mode 100644 index 0000000000..53125053d8 --- /dev/null +++ b/components/esp_phy/linker.lf @@ -0,0 +1,27 @@ +if IDF_TARGET_ESP32 = y: + [scheme:phy_iram] + entries: + phy_iram -> iram0_text + + [sections:phy_iram] + entries: + .phyiram+ + +[mapping:phy] +archive: libphy.a +entries: + * (noflash_data) + if ESP_WIFI_SLP_IRAM_OPT = y && IDF_TARGET_ESP32 = y: + * (phy_iram) + +[mapping:rtc] +archive: librtc.a +entries: + * (noflash_text) + +[mapping:esp_phy] +archive: libesp_phy.a +entries: + if ESP_WIFI_SLP_IRAM_OPT =y: + phy_init:esp_phy_enable (noflash) + phy_init:esp_phy_disable (noflash) diff --git a/components/esp_wifi/phy_multiple_init_data.bin b/components/esp_phy/phy_multiple_init_data.bin similarity index 100% rename from components/esp_wifi/phy_multiple_init_data.bin rename to components/esp_phy/phy_multiple_init_data.bin diff --git a/components/esp_phy/sdkconfig.rename b/components/esp_phy/sdkconfig.rename new file mode 100644 index 0000000000..64085678ce --- /dev/null +++ b/components/esp_phy/sdkconfig.rename @@ -0,0 +1,5 @@ +# sdkconfig replacement configurations for deprecated options formatted as +# CONFIG_DEPRECATED_OPTION CONFIG_NEW_OPTION + +CONFIG_MAC_BB_PD CONFIG_ESP32_PHY_MAC_BB_PD +CONFIG_REDUCE_PHY_TX_POWER CONFIG_ESP32_REDUCE_PHY_TX_POWER diff --git a/components/esp_wifi/src/phy_init.c b/components/esp_phy/src/phy_init.c similarity index 100% rename from components/esp_wifi/src/phy_init.c rename to components/esp_phy/src/phy_init.c diff --git a/components/esp_phy/test/CMakeLists.txt b/components/esp_phy/test/CMakeLists.txt new file mode 100644 index 0000000000..e42c082c2d --- /dev/null +++ b/components/esp_phy/test/CMakeLists.txt @@ -0,0 +1,4 @@ +idf_component_register(SRC_DIRS . + PRIV_INCLUDE_DIRS . ${CMAKE_CURRENT_BINARY_DIR} + PRIV_REQUIRES cmock test_utils nvs_flash ulp esp_common esp_phy + ) diff --git a/components/esp_phy/test/component.mk b/components/esp_phy/test/component.mk new file mode 100644 index 0000000000..b90f8732cb --- /dev/null +++ b/components/esp_phy/test/component.mk @@ -0,0 +1,7 @@ +# +#Component Makefile +# + +COMPONENT_ADD_LDFLAGS = -Wl,--whole-archive -l$(COMPONENT_NAME) -Wl,--no-whole-archive + +COMPONENT_SRCDIRS := . diff --git a/components/esp_wifi/test/test_phy_rtc.c b/components/esp_phy/test/test_phy_rtc.c similarity index 100% rename from components/esp_wifi/test/test_phy_rtc.c rename to components/esp_phy/test/test_phy_rtc.c diff --git a/components/esp_system/CMakeLists.txt b/components/esp_system/CMakeLists.txt index 25e55dfd0c..c1607cbf68 100644 --- a/components/esp_system/CMakeLists.txt +++ b/components/esp_system/CMakeLists.txt @@ -33,7 +33,7 @@ else() # should be removable once using component init functions # link-time registration is used. esp_pm app_update nvs_flash pthread app_trace esp_gdbstub - espcoredump + espcoredump esp_phy LDFRAGMENTS "linker.lf" "app.lf") add_subdirectory(port) diff --git a/components/esp_system/component.mk b/components/esp_system/component.mk index 0a3cfa5984..07bc231bb4 100644 --- a/components/esp_system/component.mk +++ b/components/esp_system/component.mk @@ -14,6 +14,7 @@ COMPONENT_SRCDIRS := . COMPONENT_ADD_INCLUDEDIRS := include port/public_compat COMPONENT_PRIV_INCLUDEDIRS := port/include port COMPONENT_ADD_LDFRAGMENTS += linker.lf app.lf +COMPONENT_DEPENDS := esp_phy ifndef CONFIG_IDF_ENV_FPGA COMPONENT_OBJEXCLUDE += fpga_overrides.o diff --git a/components/esp_wifi/CMakeLists.txt b/components/esp_wifi/CMakeLists.txt index 0d8a8a4d1a..7574160035 100644 --- a/components/esp_wifi/CMakeLists.txt +++ b/components/esp_wifi/CMakeLists.txt @@ -18,15 +18,14 @@ endif() idf_component_register(SRCS "src/coexist.c" "src/lib_printf.c" "src/mesh_event.c" - "src/phy_init.c" "src/smartconfig.c" "src/smartconfig_ack.c" "src/wifi_init.c" "src/wifi_default.c" "src/wifi_netif.c" "${idf_target}/esp_adapter.c" - INCLUDE_DIRS "include" "${idf_target}/include" - REQUIRES esp_event + INCLUDE_DIRS "include" + REQUIRES esp_event esp_phy PRIV_REQUIRES driver esptool_py esp_netif esp_pm esp_timer nvs_flash wpa_supplicant hal ${extra_priv_requires} LDFRAGMENTS "${ldfragments}") @@ -37,11 +36,7 @@ set(target_name "${idf_target}") target_link_libraries(${COMPONENT_LIB} PUBLIC "-L ${CMAKE_CURRENT_SOURCE_DIR}/lib/${target_name}") if(link_binary_libs) - set(phy phy) - set(blobs coexist core espnow mesh net80211 pp smartconfig wapi ${phy}) - if(${idf_target} STREQUAL "esp32") - list(APPEND blobs rtc) - endif() + set(blobs coexist core espnow mesh net80211 pp smartconfig wapi) foreach(blob ${blobs}) add_prebuilt_library(${blob} "${CMAKE_CURRENT_SOURCE_DIR}/lib/${target_name}/lib${blob}.a" @@ -52,38 +47,3 @@ if(link_binary_libs) target_link_libraries(${COMPONENT_LIB} PUBLIC ${blob}) endforeach() endif() - -if(CONFIG_ESP32_PHY_INIT_DATA_IN_PARTITION) - idf_component_get_property(esp_common_dir esp_common COMPONENT_DIR) - partition_table_get_partition_info(phy_partition_offset "--partition-type data --partition-subtype phy" "offset") - - if(CONFIG_ESP32_SUPPORT_MULTIPLE_PHY_INIT_DATA_BIN) - set(phy_init_data_bin "${CMAKE_CURRENT_SOURCE_DIR}/phy_multiple_init_data.bin") - else() - set(phy_init_data_bin "${build_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 - idf_build_get_property(config_dir CONFIG_DIR) - add_custom_command( - OUTPUT ${phy_init_data_bin} - DEPENDS ${CMAKE_CURRENT_LIST_DIR}/${idf_target}/include/phy_init_data.h - COMMAND ${CMAKE_C_COMPILER} -x c -c - -I ${esp_common_dir}/include -I ${CMAKE_CURRENT_LIST_DIR}/include -I ${config_dir} - -o phy_init_data.obj - ${CMAKE_CURRENT_LIST_DIR}/${idf_target}/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) - - idf_component_get_property(main_args esptool_py FLASH_ARGS) - idf_component_get_property(sub_args esptool_py FLASH_SUB_ARGS) - endif() - - set(phy_name "phy") - - esptool_py_flash_target(${phy_name}-flash "${main_args}" "${sub_args}") - esptool_py_flash_target_image(${phy_name}-flash ${phy_name} "${phy_partition_offset}" "${phy_init_data_bin}") - esptool_py_flash_target_image(flash ${phy_name} "${phy_partition_offset}" "${phy_init_data_bin}") -endif() diff --git a/components/esp_wifi/Kconfig b/components/esp_wifi/Kconfig index d66aa250aa..ba7550273e 100644 --- a/components/esp_wifi/Kconfig +++ b/components/esp_wifi/Kconfig @@ -372,104 +372,3 @@ menu "Wi-Fi" Chip will do modem-sleep when rf module is not in use any more. endmenu # Wi-Fi - -menu "PHY" - - config ESP32_PHY_CALIBRATION_AND_DATA_STORAGE - bool "Store phy calibration data in NVS" - default y - help - If this option is enabled, NVS will be initialized and calibration data will be loaded from there. - PHY calibration will be skipped on deep sleep wakeup. If calibration data is not found, full calibration - will be performed and stored in NVS. Normally, only partial calibration will be performed. - If this option is disabled, full calibration will be performed. - - If it's easy that your board calibrate bad data, choose 'n'. - Two cases for example, you should choose 'n': - 1.If your board is easy to be booted up with antenna disconnected. - 2.Because of your board design, each time when you do calibration, the result are too unstable. - If unsure, choose 'y'. - - menuconfig ESP32_PHY_INIT_DATA_IN_PARTITION - bool "Use a partition to store PHY init data" - default n - help - If enabled, PHY init data will be loaded from a partition. - When using a custom partition table, make sure that PHY data - partition is included (type: 'data', subtype: 'phy'). - With default partition tables, this is done automatically. - If PHY init data is stored in a partition, it has to be flashed there, - otherwise runtime error will occur. - - If this option is not enabled, PHY init data will be embedded - into the application binary. - - If unsure, choose 'n'. - - config ESP32_PHY_DEFAULT_INIT_IF_INVALID - bool "Reset default PHY init data if invalid" - default n - depends on ESP32_PHY_INIT_DATA_IN_PARTITION - help - If enabled, PHY init data will be restored to default if - it cannot be verified successfully to avoid endless bootloops. - - If unsure, choose 'n'. - - if ESP32_PHY_INIT_DATA_IN_PARTITION - config ESP32_SUPPORT_MULTIPLE_PHY_INIT_DATA_BIN - bool "Support multiple PHY init data bin" - depends on ESP32_PHY_INIT_DATA_IN_PARTITION - default n - help - If enabled, the corresponding PHY init data type can be automatically switched - according to the country code. China's PHY init data bin is used by default. - Can be modified by country information in API esp_wifi_set_country(). - The priority of switching the PHY init data type is: - 1. Country configured by API esp_wifi_set_country() - and the parameter policy is WIFI_COUNTRY_POLICY_MANUAL. - 2. Country notified by the connected AP. - 3. Country configured by API esp_wifi_set_country() - and the parameter policy is WIFI_COUNTRY_POLICY_AUTO. - - config ESP32_PHY_INIT_DATA_ERROR - bool "Terminate operation when PHY init data error" - depends on ESP32_SUPPORT_MULTIPLE_PHY_INIT_DATA_BIN - default n - help - If enabled, when an error occurs while the PHY init data is updated, - the program will terminate and restart. - If not enabled, the PHY init data will not be updated when an error occurs. - endif - - config ESP32_PHY_MAX_WIFI_TX_POWER - int "Max WiFi TX power (dBm)" - range 10 20 - default 20 - help - Set maximum transmit power for WiFi radio. Actual transmit power for high - data rates may be lower than this setting. - - config ESP32_PHY_MAX_TX_POWER - int - default ESP32_PHY_MAX_WIFI_TX_POWER - - config ESP32_PHY_MAC_BB_PD - bool "Power down MAC and baseband of Wi-Fi and Bluetooth when PHY is disabled" - depends on (IDF_TARGET_ESP32C3 && FREERTOS_USE_TICKLESS_IDLE) - default n - help - If enabled, the MAC and baseband of Wi-Fi and Bluetooth will be powered - down when PHY is disabled. Enabling this setting reduces power consumption - by a small amount but increases RAM use by approximately 4 KB(Wi-Fi only), - 2 KB(Bluetooth only) or 5.3 KB(Wi-Fi + Bluetooth). - - #Reduce PHY TX power when brownout reset - config ESP32_REDUCE_PHY_TX_POWER - bool "Reduce PHY TX power when brownout reset" - depends on ESP32_BROWNOUT_DET - default y - help - When brownout reset occurs, reduce PHY TX power to keep the code running. - -endmenu # PHY diff --git a/components/esp_wifi/component.mk b/components/esp_wifi/component.mk index a739fa8b0a..9efc356ecc 100644 --- a/components/esp_wifi/component.mk +++ b/components/esp_wifi/component.mk @@ -2,11 +2,11 @@ # Component Makefile # -COMPONENT_ADD_INCLUDEDIRS := include $(IDF_TARGET)/include +COMPONENT_ADD_INCLUDEDIRS := include COMPONENT_SRCDIRS := src $(IDF_TARGET) ifndef CONFIG_ESP32_NO_BLOBS - LIBS := core rtc net80211 pp smartconfig coexist espnow phy mesh + LIBS := core net80211 pp smartconfig coexist espnow mesh COMPONENT_ADD_LDFLAGS += -L$(COMPONENT_PATH)/lib/$(IDF_TARGET) \ $(addprefix -l,$(LIBS)) diff --git a/components/esp_wifi/lib b/components/esp_wifi/lib index f20bc56641..16d3eb3205 160000 --- a/components/esp_wifi/lib +++ b/components/esp_wifi/lib @@ -1 +1 @@ -Subproject commit f20bc56641908e5f588b53571cc1d78192dfe0b8 +Subproject commit 16d3eb32053bf2eadb4e1541bf6e96281657046a diff --git a/components/esp_wifi/linker.lf b/components/esp_wifi/linker.lf index 05444cbcd1..8b2c35d86a 100644 --- a/components/esp_wifi/linker.lf +++ b/components/esp_wifi/linker.lf @@ -43,15 +43,6 @@ entries: entries: wifi_slp_rx_iram -> iram0_text -if IDF_TARGET_ESP32 = y: - [scheme:phy_iram] - entries: - phy_iram -> iram0_text - - [sections:phy_iram] - entries: - .phyiram+ - [scheme:wifi_default] entries: wifi_slp_iram -> flash_text @@ -59,26 +50,12 @@ entries: wifi_slp_rx_iram -> flash_text wifi_iram -> flash_text wifi_rx_iram -> flash_text - if IDF_TARGET_ESP32 = y: - phy_iram -> flash_text [mapping:wifi_default] archive: * entries: * (wifi_default) -[mapping:phy] -archive: libphy.a -entries: - * (noflash_data) - if ESP_WIFI_SLP_IRAM_OPT = y && IDF_TARGET_ESP32 = y: - * (phy_iram) - -[mapping:rtc] -archive: librtc.a -entries: - * (noflash_text) - [mapping:pp] archive: libpp.a entries: @@ -130,8 +107,6 @@ entries: if ESP_WIFI_SLP_IRAM_OPT =y: esp_adapter:wifi_clock_enable_wrapper (noflash) esp_adapter:wifi_clock_disable_wrapper (noflash) - phy_init:esp_phy_enable (noflash) - phy_init:esp_phy_disable (noflash) wifi_init:wifi_apb80m_request (noflash) wifi_init:wifi_apb80m_release (noflash) diff --git a/components/esp_wifi/sdkconfig.rename b/components/esp_wifi/sdkconfig.rename index e65164155c..8d55abed31 100644 --- a/components/esp_wifi/sdkconfig.rename +++ b/components/esp_wifi/sdkconfig.rename @@ -2,5 +2,3 @@ # CONFIG_DEPRECATED_OPTION CONFIG_NEW_OPTION CONFIG_SW_COEXIST_ENABLE CONFIG_ESP32_WIFI_SW_COEXIST_ENABLE -CONFIG_MAC_BB_PD CONFIG_ESP32_PHY_MAC_BB_PD -CONFIG_REDUCE_PHY_TX_POWER CONFIG_ESP32_REDUCE_PHY_TX_POWER diff --git a/docs/en/api-guides/RF_calibration.rst b/docs/en/api-guides/RF_calibration.rst index a38b311331..3d81b9eb19 100644 --- a/docs/en/api-guides/RF_calibration.rst +++ b/docs/en/api-guides/RF_calibration.rst @@ -48,7 +48,7 @@ PHY initialization data The PHY initialization data is used for RF calibration. There are two ways to get the PHY initialization data. -One is the default initialization data which is located in the header file :idf_file:`components/esp_wifi/{IDF_TARGET_PATH_NAME}/include/phy_init_data.h`. +One is the default initialization data which is located in the header file :idf_file:`components/esp_phy/{IDF_TARGET_PATH_NAME}/include/phy_init_data.h`. It is embedded into the application binary after compiling and then stored into read-only memory (DROM). To use the default initialization data, please go to ``menuconfig`` and disable :ref:`CONFIG_ESP32_PHY_INIT_DATA_IN_PARTITION`. diff --git a/tools/ci/check_public_headers_exceptions.txt b/tools/ci/check_public_headers_exceptions.txt index 6b6c53889f..77254f60bd 100644 --- a/tools/ci/check_public_headers_exceptions.txt +++ b/tools/ci/check_public_headers_exceptions.txt @@ -32,7 +32,7 @@ components/lwip/lwip/src/include/lwip/priv/memp_std.h components/vfs/include/sys/dirent.h -components/esp_wifi/esp32/include/phy_init_data.h +components/esp_phy/esp32/include/phy_init_data.h components/spi_flash/include/spi_flash_chip_issi.h components/spi_flash/include/spi_flash_chip_mxic.h