mirror of
https://github.com/espressif/esp-idf
synced 2025-03-09 17:19:09 -04:00
esp_phy: decouple esp_phy component from esp_wifi and bt
* add esp-phy-lib submodule * move libphy.a and phy_init.c from esp_wifi to esp_phy * move librtc.a from esp_wifi to esp_phy * move libbtbb.a from bt to esp_phy * corresponding updates to build system
This commit is contained in:
parent
72f1c47554
commit
6061a547e5
@ -87,6 +87,7 @@
|
|||||||
/components/esp_lcd/ @esp-idf-codeowners/peripherals
|
/components/esp_lcd/ @esp-idf-codeowners/peripherals
|
||||||
/components/esp_local_ctrl/ @esp-idf-codeowners/app-utilities
|
/components/esp_local_ctrl/ @esp-idf-codeowners/app-utilities
|
||||||
/components/esp_netif/ @esp-idf-codeowners/network
|
/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_pm/ @esp-idf-codeowners/power-management
|
||||||
/components/esp_ringbuf/ @esp-idf-codeowners/system
|
/components/esp_ringbuf/ @esp-idf-codeowners/system
|
||||||
/components/esp_rom/ @esp-idf-codeowners/system
|
/components/esp_rom/ @esp-idf-codeowners/system
|
||||||
|
@ -137,6 +137,7 @@
|
|||||||
- "components/cmock/CMock/vendor/unity"
|
- "components/cmock/CMock/vendor/unity"
|
||||||
- "components/coap/libcoap"
|
- "components/coap/libcoap"
|
||||||
- "components/coap/libcoap/ext/tinydtls"
|
- "components/coap/libcoap/ext/tinydtls"
|
||||||
|
- "components/esp_phy/lib"
|
||||||
- "components/esp_wifi/lib"
|
- "components/esp_wifi/lib"
|
||||||
- "components/esptool_py/esptool"
|
- "components/esptool_py/esptool"
|
||||||
- "components/expat/expat"
|
- "components/expat/expat"
|
||||||
|
4
.gitmodules
vendored
4
.gitmodules
vendored
@ -98,3 +98,7 @@
|
|||||||
[submodule "components/bt/controller/lib_esp32c3_family"]
|
[submodule "components/bt/controller/lib_esp32c3_family"]
|
||||||
path = components/bt/controller/lib_esp32c3_family
|
path = components/bt/controller/lib_esp32c3_family
|
||||||
url = ../../espressif/esp32c3-bt-lib.git
|
url = ../../espressif/esp32c3-bt-lib.git
|
||||||
|
|
||||||
|
[submodule "components/esp_phy/lib"]
|
||||||
|
path = components/esp_phy/lib
|
||||||
|
url = ../../espressif/esp-phy-lib.git
|
||||||
|
@ -582,7 +582,7 @@ endif()
|
|||||||
idf_component_register(SRCS "${srcs}"
|
idf_component_register(SRCS "${srcs}"
|
||||||
INCLUDE_DIRS "${include_dirs}"
|
INCLUDE_DIRS "${include_dirs}"
|
||||||
PRIV_INCLUDE_DIRS "${priv_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
|
PRIV_REQUIRES esp_ipc
|
||||||
LDFRAGMENTS "linker.lf")
|
LDFRAGMENTS "linker.lf")
|
||||||
|
|
||||||
@ -594,11 +594,11 @@ if(CONFIG_BT_ENABLED)
|
|||||||
elseif(CONFIG_IDF_TARGET_ESP32C3)
|
elseif(CONFIG_IDF_TARGET_ESP32C3)
|
||||||
target_link_libraries(${COMPONENT_LIB} INTERFACE
|
target_link_libraries(${COMPONENT_LIB} INTERFACE
|
||||||
"-L${CMAKE_CURRENT_LIST_DIR}/controller/lib_esp32c3_family/esp32c3")
|
"-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)
|
elseif(CONFIG_IDF_TARGET_ESP32S3)
|
||||||
target_link_libraries(${COMPONENT_LIB} INTERFACE
|
target_link_libraries(${COMPONENT_LIB} INTERFACE
|
||||||
"-L${CMAKE_CURRENT_LIST_DIR}/controller/lib_esp32c3_family/esp32s3")
|
"-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()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
@ -1 +1 @@
|
|||||||
Subproject commit 90b025633add12d18ab056ce8db20d06deb40f06
|
Subproject commit 41be310daa209dbaafdbf68426becabcda6c95fc
|
70
components/esp_phy/CMakeLists.txt
Normal file
70
components/esp_phy/CMakeLists.txt
Normal file
@ -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 $<TARGET_FILE:${esp_phy_lib}> libphy.a
|
||||||
|
$<TARGET_FILE:${esp_phy_lib}>)
|
||||||
|
|
||||||
|
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()
|
99
components/esp_phy/Kconfig
Normal file
99
components/esp_phy/Kconfig
Normal file
@ -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
|
@ -1,16 +1,16 @@
|
|||||||
ifdef CONFIG_ESP32_PHY_INIT_DATA_IN_PARTITION
|
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
|
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
|
else
|
||||||
PHY_INIT_DATA_OBJ = $(BUILD_DIR_BASE)/phy_init_data.o
|
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_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 $@)
|
$(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)
|
$(PHY_INIT_DATA_BIN): $(PHY_INIT_DATA_OBJ)
|
||||||
$(summary) BIN $(notdir $@)
|
$(summary) BIN $(notdir $@)
|
20
components/esp_phy/component.mk
Normal file
20
components/esp_phy/component.mk
Normal file
@ -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
|
1
components/esp_phy/lib
Submodule
1
components/esp_phy/lib
Submodule
@ -0,0 +1 @@
|
|||||||
|
Subproject commit 3148305ef948a539f9724443cd432a9980087755
|
27
components/esp_phy/linker.lf
Normal file
27
components/esp_phy/linker.lf
Normal file
@ -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)
|
5
components/esp_phy/sdkconfig.rename
Normal file
5
components/esp_phy/sdkconfig.rename
Normal file
@ -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
|
4
components/esp_phy/test/CMakeLists.txt
Normal file
4
components/esp_phy/test/CMakeLists.txt
Normal file
@ -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
|
||||||
|
)
|
7
components/esp_phy/test/component.mk
Normal file
7
components/esp_phy/test/component.mk
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
#
|
||||||
|
#Component Makefile
|
||||||
|
#
|
||||||
|
|
||||||
|
COMPONENT_ADD_LDFLAGS = -Wl,--whole-archive -l$(COMPONENT_NAME) -Wl,--no-whole-archive
|
||||||
|
|
||||||
|
COMPONENT_SRCDIRS := .
|
@ -33,7 +33,7 @@ else()
|
|||||||
# should be removable once using component init functions
|
# should be removable once using component init functions
|
||||||
# link-time registration is used.
|
# link-time registration is used.
|
||||||
esp_pm app_update nvs_flash pthread app_trace esp_gdbstub
|
esp_pm app_update nvs_flash pthread app_trace esp_gdbstub
|
||||||
espcoredump
|
espcoredump esp_phy
|
||||||
LDFRAGMENTS "linker.lf" "app.lf")
|
LDFRAGMENTS "linker.lf" "app.lf")
|
||||||
add_subdirectory(port)
|
add_subdirectory(port)
|
||||||
|
|
||||||
|
@ -14,6 +14,7 @@ COMPONENT_SRCDIRS := .
|
|||||||
COMPONENT_ADD_INCLUDEDIRS := include port/public_compat
|
COMPONENT_ADD_INCLUDEDIRS := include port/public_compat
|
||||||
COMPONENT_PRIV_INCLUDEDIRS := port/include port
|
COMPONENT_PRIV_INCLUDEDIRS := port/include port
|
||||||
COMPONENT_ADD_LDFRAGMENTS += linker.lf app.lf
|
COMPONENT_ADD_LDFRAGMENTS += linker.lf app.lf
|
||||||
|
COMPONENT_DEPENDS := esp_phy
|
||||||
|
|
||||||
ifndef CONFIG_IDF_ENV_FPGA
|
ifndef CONFIG_IDF_ENV_FPGA
|
||||||
COMPONENT_OBJEXCLUDE += fpga_overrides.o
|
COMPONENT_OBJEXCLUDE += fpga_overrides.o
|
||||||
|
@ -18,15 +18,14 @@ endif()
|
|||||||
idf_component_register(SRCS "src/coexist.c"
|
idf_component_register(SRCS "src/coexist.c"
|
||||||
"src/lib_printf.c"
|
"src/lib_printf.c"
|
||||||
"src/mesh_event.c"
|
"src/mesh_event.c"
|
||||||
"src/phy_init.c"
|
|
||||||
"src/smartconfig.c"
|
"src/smartconfig.c"
|
||||||
"src/smartconfig_ack.c"
|
"src/smartconfig_ack.c"
|
||||||
"src/wifi_init.c"
|
"src/wifi_init.c"
|
||||||
"src/wifi_default.c"
|
"src/wifi_default.c"
|
||||||
"src/wifi_netif.c"
|
"src/wifi_netif.c"
|
||||||
"${idf_target}/esp_adapter.c"
|
"${idf_target}/esp_adapter.c"
|
||||||
INCLUDE_DIRS "include" "${idf_target}/include"
|
INCLUDE_DIRS "include"
|
||||||
REQUIRES esp_event
|
REQUIRES esp_event esp_phy
|
||||||
PRIV_REQUIRES driver esptool_py esp_netif esp_pm esp_timer nvs_flash
|
PRIV_REQUIRES driver esptool_py esp_netif esp_pm esp_timer nvs_flash
|
||||||
wpa_supplicant hal ${extra_priv_requires}
|
wpa_supplicant hal ${extra_priv_requires}
|
||||||
LDFRAGMENTS "${ldfragments}")
|
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}")
|
target_link_libraries(${COMPONENT_LIB} PUBLIC "-L ${CMAKE_CURRENT_SOURCE_DIR}/lib/${target_name}")
|
||||||
|
|
||||||
if(link_binary_libs)
|
if(link_binary_libs)
|
||||||
set(phy phy)
|
set(blobs coexist core espnow mesh net80211 pp smartconfig wapi)
|
||||||
set(blobs coexist core espnow mesh net80211 pp smartconfig wapi ${phy})
|
|
||||||
if(${idf_target} STREQUAL "esp32")
|
|
||||||
list(APPEND blobs rtc)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
foreach(blob ${blobs})
|
foreach(blob ${blobs})
|
||||||
add_prebuilt_library(${blob} "${CMAKE_CURRENT_SOURCE_DIR}/lib/${target_name}/lib${blob}.a"
|
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})
|
target_link_libraries(${COMPONENT_LIB} PUBLIC ${blob})
|
||||||
endforeach()
|
endforeach()
|
||||||
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()
|
|
||||||
|
@ -372,104 +372,3 @@ menu "Wi-Fi"
|
|||||||
Chip will do modem-sleep when rf module is not in use any more.
|
Chip will do modem-sleep when rf module is not in use any more.
|
||||||
|
|
||||||
endmenu # Wi-Fi
|
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
|
|
||||||
|
@ -2,11 +2,11 @@
|
|||||||
# Component Makefile
|
# Component Makefile
|
||||||
#
|
#
|
||||||
|
|
||||||
COMPONENT_ADD_INCLUDEDIRS := include $(IDF_TARGET)/include
|
COMPONENT_ADD_INCLUDEDIRS := include
|
||||||
COMPONENT_SRCDIRS := src $(IDF_TARGET)
|
COMPONENT_SRCDIRS := src $(IDF_TARGET)
|
||||||
|
|
||||||
ifndef CONFIG_ESP32_NO_BLOBS
|
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) \
|
COMPONENT_ADD_LDFLAGS += -L$(COMPONENT_PATH)/lib/$(IDF_TARGET) \
|
||||||
$(addprefix -l,$(LIBS))
|
$(addprefix -l,$(LIBS))
|
||||||
|
|
||||||
|
@ -1 +1 @@
|
|||||||
Subproject commit f20bc56641908e5f588b53571cc1d78192dfe0b8
|
Subproject commit 16d3eb32053bf2eadb4e1541bf6e96281657046a
|
@ -43,15 +43,6 @@ entries:
|
|||||||
entries:
|
entries:
|
||||||
wifi_slp_rx_iram -> iram0_text
|
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]
|
[scheme:wifi_default]
|
||||||
entries:
|
entries:
|
||||||
wifi_slp_iram -> flash_text
|
wifi_slp_iram -> flash_text
|
||||||
@ -59,26 +50,12 @@ entries:
|
|||||||
wifi_slp_rx_iram -> flash_text
|
wifi_slp_rx_iram -> flash_text
|
||||||
wifi_iram -> flash_text
|
wifi_iram -> flash_text
|
||||||
wifi_rx_iram -> flash_text
|
wifi_rx_iram -> flash_text
|
||||||
if IDF_TARGET_ESP32 = y:
|
|
||||||
phy_iram -> flash_text
|
|
||||||
|
|
||||||
[mapping:wifi_default]
|
[mapping:wifi_default]
|
||||||
archive: *
|
archive: *
|
||||||
entries:
|
entries:
|
||||||
* (wifi_default)
|
* (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]
|
[mapping:pp]
|
||||||
archive: libpp.a
|
archive: libpp.a
|
||||||
entries:
|
entries:
|
||||||
@ -130,8 +107,6 @@ entries:
|
|||||||
if ESP_WIFI_SLP_IRAM_OPT =y:
|
if ESP_WIFI_SLP_IRAM_OPT =y:
|
||||||
esp_adapter:wifi_clock_enable_wrapper (noflash)
|
esp_adapter:wifi_clock_enable_wrapper (noflash)
|
||||||
esp_adapter:wifi_clock_disable_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_request (noflash)
|
||||||
wifi_init:wifi_apb80m_release (noflash)
|
wifi_init:wifi_apb80m_release (noflash)
|
||||||
|
|
||||||
|
@ -2,5 +2,3 @@
|
|||||||
# CONFIG_DEPRECATED_OPTION CONFIG_NEW_OPTION
|
# CONFIG_DEPRECATED_OPTION CONFIG_NEW_OPTION
|
||||||
|
|
||||||
CONFIG_SW_COEXIST_ENABLE CONFIG_ESP32_WIFI_SW_COEXIST_ENABLE
|
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
|
|
||||||
|
@ -48,7 +48,7 @@ PHY initialization data
|
|||||||
The PHY initialization data is used for RF calibration.
|
The PHY initialization data is used for RF calibration.
|
||||||
There are two ways to get the PHY initialization data.
|
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).
|
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`.
|
To use the default initialization data, please go to ``menuconfig`` and disable :ref:`CONFIG_ESP32_PHY_INIT_DATA_IN_PARTITION`.
|
||||||
|
@ -32,7 +32,7 @@ components/lwip/lwip/src/include/lwip/priv/memp_std.h
|
|||||||
|
|
||||||
components/vfs/include/sys/dirent.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_issi.h
|
||||||
components/spi_flash/include/spi_flash_chip_mxic.h
|
components/spi_flash/include/spi_flash_chip_mxic.h
|
||||||
|
Loading…
x
Reference in New Issue
Block a user