mirror of
https://github.com/espressif/esp-idf
synced 2025-03-09 17:19:09 -04:00
esp_phy: support copy multi phy init data bin to build dir
This commit is contained in:
parent
09a034d61b
commit
c898810991
@ -14,15 +14,29 @@ else()
|
||||
set(srcs "src/phy_init.c")
|
||||
endif()
|
||||
|
||||
idf_component_register(SRCS "${srcs}"
|
||||
INCLUDE_DIRS "include" "${idf_target}/include"
|
||||
PRIV_REQUIRES nvs_flash
|
||||
LDFRAGMENTS "${ldfragments}"
|
||||
EMBED_FILES "${CMAKE_CURRENT_SOURCE_DIR}/${idf_target}/phy_multiple_init_data.bin"
|
||||
)
|
||||
|
||||
idf_build_get_property(build_dir BUILD_DIR)
|
||||
|
||||
if(CONFIG_ESP32_SUPPORT_MULTIPLE_PHY_INIT_DATA_BIN)
|
||||
if(NOT EXISTS "${build_dir}/phy_multiple_init_data.bin")
|
||||
file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/${idf_target}/phy_multiple_init_data.bin DESTINATION "${build_dir}")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(CONFIG_ESP32_MULTIPLE_PHY_DATA_BIN_EMBEDDED)
|
||||
idf_component_register(SRCS "${srcs}"
|
||||
INCLUDE_DIRS "include" "${idf_target}/include"
|
||||
PRIV_REQUIRES nvs_flash
|
||||
LDFRAGMENTS "${ldfragments}"
|
||||
EMBED_FILES "${build_dir}/phy_multiple_init_data.bin"
|
||||
)
|
||||
else()
|
||||
idf_component_register(SRCS "${srcs}"
|
||||
INCLUDE_DIRS "include" "${idf_target}/include"
|
||||
PRIV_REQUIRES nvs_flash
|
||||
LDFRAGMENTS "${ldfragments}"
|
||||
)
|
||||
endif()
|
||||
|
||||
set(target_name "${idf_target}")
|
||||
target_link_libraries(${COMPONENT_LIB} PUBLIC "-L \"${CMAKE_CURRENT_SOURCE_DIR}/lib/${target_name}\"")
|
||||
|
||||
@ -54,9 +68,9 @@ if(CONFIG_ESP32_PHY_INIT_DATA_IN_PARTITION)
|
||||
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}/${idf_target}/phy_multiple_init_data.bin")
|
||||
set(phy_init_data_bin "${build_dir}/phy_multiple_init_data.bin")
|
||||
if(CONFIG_ESP32_MULTIPLE_PHY_DATA_BIN_EMBEDDED)
|
||||
set(COMPONENT_EMBED_FILES "${CMAKE_CURRENT_SOURCE_DIR}/${idf_target}/phy_multiple_init_data.bin")
|
||||
set(COMPONENT_EMBED_FILES "${build_dir}/phy_multiple_init_data.bin")
|
||||
endif()
|
||||
else()
|
||||
set(phy_init_data_bin "${build_dir}/phy_init_data.bin")
|
||||
|
@ -332,6 +332,10 @@ const esp_phy_init_data_t* esp_phy_get_init_data(void)
|
||||
size_t init_data_store_length = sizeof(phy_init_magic_pre) +
|
||||
sizeof(esp_phy_init_data_t) + sizeof(phy_init_magic_post);
|
||||
uint8_t* init_data_store = (uint8_t*) malloc(init_data_store_length);
|
||||
if (init_data_store == NULL) {
|
||||
ESP_LOGE(TAG, "failed to allocate memory for updated country code PHY init data");
|
||||
return ESP_ERR_NO_MEM;
|
||||
}
|
||||
memcpy(init_data_store, multi_phy_init_data_bin_start, init_data_store_length);
|
||||
ESP_LOGI(TAG, "loading embedded multiple PHY init data");
|
||||
#else
|
||||
|
Loading…
x
Reference in New Issue
Block a user