mirror of
https://github.com/espressif/esp-idf.git
synced 2025-09-30 19:19:21 +00:00
components: update with build system changes
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
register_config_only_component()
|
||||
|
||||
if(NOT BOOTLOADER_BUILD AND IDF_BUILD_ARTIFACTS)
|
||||
if(BOOTLOADER_BUILD)
|
||||
return()
|
||||
endif()
|
||||
|
||||
set(partition_csv "${PARTITION_CSV_PATH}")
|
||||
|
||||
@@ -28,28 +30,31 @@ else()
|
||||
set(partition_secure_opt "")
|
||||
endif()
|
||||
|
||||
add_custom_command(OUTPUT "${IDF_BUILD_ARTIFACTS_DIR}/partition_table/${unsigned_partition_bin}"
|
||||
COMMAND "${PYTHON}" "${CMAKE_CURRENT_SOURCE_DIR}/gen_esp32part.py"
|
||||
idf_build_get_property(build_dir BUILD_DIR)
|
||||
idf_build_get_property(python PYTHON)
|
||||
|
||||
add_custom_command(OUTPUT "${build_dir}/partition_table/${unsigned_partition_bin}"
|
||||
COMMAND "${python}" "${CMAKE_CURRENT_SOURCE_DIR}/gen_esp32part.py"
|
||||
-q --offset ${PARTITION_TABLE_OFFSET} ${md5_opt} ${flashsize_opt}
|
||||
${partition_secure_opt} ${partition_csv} ${IDF_BUILD_ARTIFACTS_DIR}/partition_table/${unsigned_partition_bin}
|
||||
${partition_secure_opt} ${partition_csv} ${build_dir}/partition_table/${unsigned_partition_bin}
|
||||
DEPENDS ${partition_csv} "${CMAKE_CURRENT_SOURCE_DIR}/gen_esp32part.py"
|
||||
VERBATIM)
|
||||
|
||||
# Add signing steps
|
||||
if(CONFIG_SECURE_BOOT_BUILD_SIGNED_BINARIES)
|
||||
add_custom_target(gen_unsigned_partition_bin ALL DEPENDS
|
||||
"${IDF_BUILD_ARTIFACTS_DIR}/partition_table/${unsigned_partition_bin}")
|
||||
"${build_dir}/partition_table/${unsigned_partition_bin}")
|
||||
|
||||
add_custom_command(OUTPUT "${IDF_BUILD_ARTIFACTS_DIR}/partition_table/${final_partition_bin}"
|
||||
add_custom_command(OUTPUT "${build_dir}/partition_table/${final_partition_bin}"
|
||||
COMMAND ${ESPSECUREPY} sign_data --keyfile "${secure_boot_signing_key}"
|
||||
-o "${IDF_BUILD_ARTIFACTS_DIR}/partition_table/${final_partition_bin}"
|
||||
"${IDF_BUILD_ARTIFACTS_DIR}/partition_table/${unsigned_partition_bin}"
|
||||
DEPENDS "${IDF_BUILD_ARTIFACTS_DIR}/partition_table/${unsigned_partition_bin}"
|
||||
-o "${build_dir}/partition_table/${final_partition_bin}"
|
||||
"${build_dir}/partition_table/${unsigned_partition_bin}"
|
||||
DEPENDS "${build_dir}/partition_table/${unsigned_partition_bin}"
|
||||
VERBATIM)
|
||||
endif()
|
||||
|
||||
if(EXISTS ${partition_csv})
|
||||
add_custom_target(partition_table ALL DEPENDS "${IDF_BUILD_ARTIFACTS_DIR}/partition_table/${final_partition_bin}")
|
||||
add_custom_target(partition_table ALL DEPENDS "${build_dir}/partition_table/${final_partition_bin}")
|
||||
else()
|
||||
# If the partition input CSV is not found, create a phony partition_table target that
|
||||
# fails the build. fail_at_build_time also touches CMakeCache.txt to cause a cmake run next time
|
||||
@@ -86,15 +91,12 @@ add_dependencies(app partition_table)
|
||||
# the list of esptool write arguments for flashing
|
||||
set_property(GLOBAL APPEND_STRING PROPERTY
|
||||
ESPTOOL_WRITE_FLASH_ARGS
|
||||
"${PARTITION_TABLE_OFFSET} ${IDF_BUILD_ARTIFACTS_DIR}/partition_table/${final_partition_bin} ")
|
||||
"${PARTITION_TABLE_OFFSET} ${build_dir}/partition_table/${final_partition_bin} ")
|
||||
|
||||
esptool_py_flash_project_args(partition_table ${PARTITION_TABLE_OFFSET}
|
||||
${IDF_BUILD_ARTIFACTS_DIR}/partition_table/partition-table.bin FLASH_IN_PROJECT)
|
||||
${build_dir}/partition_table/partition-table.bin FLASH_IN_PROJECT)
|
||||
|
||||
if (NOT BOOTLOADER_BUILD)
|
||||
partition_table_get_partition_info(app_partition_offset "--partition-boot-default" "offset")
|
||||
esptool_py_flash_project_args(app ${app_partition_offset} ${CMAKE_BINARY_DIR}/${IDF_PROJECT_BIN} FLASH_IN_PROJECT)
|
||||
endif()
|
||||
partition_table_get_partition_info(app_partition_offset "--partition-boot-default" "offset")
|
||||
esptool_py_flash_project_args(app ${app_partition_offset} ${build_dir}/${PROJECT_BIN} FLASH_IN_PROJECT)
|
||||
|
||||
endif()
|
||||
|
||||
|
@@ -1,38 +1,42 @@
|
||||
if(NOT BOOTLOADER_BUILD)
|
||||
set(PARTITION_TABLE_OFFSET ${CONFIG_PARTITION_TABLE_OFFSET})
|
||||
set(PARTITION_TABLE_OFFSET ${CONFIG_PARTITION_TABLE_OFFSET})
|
||||
|
||||
# Set PARTITION_CSV_PATH to the configured partition CSV file
|
||||
# absolute path
|
||||
if(CONFIG_PARTITION_TABLE_CUSTOM)
|
||||
# Custom filename expands any path relative to the project
|
||||
get_filename_component(PARTITION_CSV_PATH "${CONFIG_PARTITION_TABLE_FILENAME}"
|
||||
ABSOLUTE BASE_DIR "${IDF_PROJECT_PATH}")
|
||||
# Set PARTITION_CSV_PATH to the configured partition CSV file
|
||||
# absolute path
|
||||
if(CONFIG_PARTITION_TABLE_CUSTOM)
|
||||
idf_build_get_property(project_dir PROJECT_DIR)
|
||||
# Custom filename expands any path relative to the project
|
||||
get_filename_component(PARTITION_CSV_PATH "${CONFIG_PARTITION_TABLE_FILENAME}"
|
||||
ABSOLUTE BASE_DIR "${project_dir}")
|
||||
|
||||
if(NOT EXISTS "${PARTITION_CSV_PATH}")
|
||||
message(WARNING "Partition table CSV file ${PARTITION_CSV_PATH} not found. "
|
||||
"Change custom partition CSV path in menuconfig.")
|
||||
# Note: partition_table CMakeLists.txt contains some logic to create a dummy
|
||||
# partition_table target in this case, see comments in that file.
|
||||
if(NOT EXISTS "${PARTITION_CSV_PATH}")
|
||||
message(WARNING "Partition table CSV file ${PARTITION_CSV_PATH} not found. "
|
||||
"Change custom partition CSV path in menuconfig.")
|
||||
# Note: partition_table CMakeLists.txt contains some logic to create a dummy
|
||||
# partition_table target in this case, see comments in that file.
|
||||
endif()
|
||||
else()
|
||||
# Other .csv files are always in the component directory
|
||||
get_filename_component(PARTITION_CSV_PATH "${COMPONENT_DIR}/${CONFIG_PARTITION_TABLE_FILENAME}" ABSOLUTE)
|
||||
|
||||
if(NOT EXISTS "${PARTITION_CSV_PATH}")
|
||||
message(FATAL_ERROR "Internal error, built-in ${PARTITION_CSV_PATH} not found.")
|
||||
endif()
|
||||
endif()
|
||||
else()
|
||||
# Other .csv files are always in the component directory
|
||||
get_filename_component(PARTITION_CSV_PATH "${COMPONENT_PATH}/${CONFIG_PARTITION_TABLE_FILENAME}" ABSOLUTE)
|
||||
|
||||
if(NOT EXISTS "${PARTITION_CSV_PATH}")
|
||||
message(FATAL_ERROR "Internal error, built-in ${PARTITION_CSV_PATH} not found.")
|
||||
endif()
|
||||
# need to re-run CMake if the partition CSV changes, as the offsets/sizes of partitions may change
|
||||
set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS ${PARTITION_CSV_PATH})
|
||||
endif()
|
||||
|
||||
# need to re-run CMake if the partition CSV changes, as the offsets/sizes of partitions may change
|
||||
set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS ${PARTITION_CSV_PATH})
|
||||
|
||||
# partition_table_get_partition_info
|
||||
#
|
||||
# Get information about a partition from the partition table
|
||||
function(partition_table_get_partition_info result get_part_info_args part_info)
|
||||
idf_build_get_property(python PYTHON)
|
||||
idf_build_get_property(idf_path IDF_PATH)
|
||||
separate_arguments(get_part_info_args)
|
||||
execute_process(COMMAND ${PYTHON}
|
||||
${IDF_PATH}/components/partition_table/parttool.py -q
|
||||
execute_process(COMMAND ${python}
|
||||
${idf_path}/components/partition_table/parttool.py -q
|
||||
--partition-table-offset ${PARTITION_TABLE_OFFSET}
|
||||
--partition-table-file ${PARTITION_CSV_PATH}
|
||||
${get_part_info_args} get_partition_info --info ${part_info}
|
||||
@@ -45,5 +49,3 @@ function(partition_table_get_partition_info result get_part_info_args part_info)
|
||||
endif()
|
||||
set(${result} ${info} PARENT_SCOPE)
|
||||
endfunction()
|
||||
endif()
|
||||
|
||||
|
Reference in New Issue
Block a user