mirror of
https://github.com/espressif/esp-idf.git
synced 2025-08-06 14:14:33 +02:00
esp_phy: support copy multi phy init data bin to build dir
This commit is contained in:
committed by
ChenJianxing
parent
09a034d61b
commit
c898810991
@@ -14,15 +14,29 @@ else()
|
|||||||
set(srcs "src/phy_init.c")
|
set(srcs "src/phy_init.c")
|
||||||
endif()
|
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)
|
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}")
|
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}\"")
|
||||||
|
|
||||||
@@ -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")
|
partition_table_get_partition_info(phy_partition_offset "--partition-type data --partition-subtype phy" "offset")
|
||||||
|
|
||||||
if(CONFIG_ESP32_SUPPORT_MULTIPLE_PHY_INIT_DATA_BIN)
|
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)
|
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()
|
endif()
|
||||||
else()
|
else()
|
||||||
set(phy_init_data_bin "${build_dir}/phy_init_data.bin")
|
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) +
|
size_t init_data_store_length = sizeof(phy_init_magic_pre) +
|
||||||
sizeof(esp_phy_init_data_t) + sizeof(phy_init_magic_post);
|
sizeof(esp_phy_init_data_t) + sizeof(phy_init_magic_post);
|
||||||
uint8_t* init_data_store = (uint8_t*) malloc(init_data_store_length);
|
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);
|
memcpy(init_data_store, multi_phy_init_data_bin_start, init_data_store_length);
|
||||||
ESP_LOGI(TAG, "loading embedded multiple PHY init data");
|
ESP_LOGI(TAG, "loading embedded multiple PHY init data");
|
||||||
#else
|
#else
|
||||||
|
Reference in New Issue
Block a user