2018-01-18 01:12:13 +00:00
|
|
|
set(partition_table_offset 0x8000)
|
|
|
|
|
|
|
|
# Set partition_csv to the configured partition source file
|
|
|
|
#
|
|
|
|
if(CONFIG_PARTITION_TABLE_CUSTOM)
|
|
|
|
# Custom filename expands any path relative to the project
|
|
|
|
get_filename_component(partition_csv "${CONFIG_PARTITION_TABLE_CUSTOM}" ABSOLUTE BASE_DIR "${PROJECT_PATH}")
|
|
|
|
else()
|
|
|
|
# Other .csv files are always in the component directory
|
|
|
|
set(partition_csv "${CMAKE_CURRENT_SOURCE_DIR}/${CONFIG_PARTITION_TABLE_FILENAME}")
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if(CONFIG_SECURE_BOOT_BUILD_SIGNED_BINARIES)
|
2018-02-01 09:45:41 +00:00
|
|
|
set(unsigned_partition_bin "partition-table-unsigned.bin")
|
|
|
|
set(final_partition_bin "partition-table.bin")
|
2018-01-18 01:12:13 +00:00
|
|
|
set(final_partition_target "sign_partition_table")
|
|
|
|
else()
|
2018-02-01 09:45:41 +00:00
|
|
|
set(unsigned_partition_bin "partition-table.bin")
|
|
|
|
set(final_partition_bin "partition-table.bin")
|
2018-01-18 01:12:13 +00:00
|
|
|
set(final_partition_target "build_partition_table")
|
|
|
|
endif()
|
|
|
|
|
2018-01-19 04:47:49 +00:00
|
|
|
if(CONFIG_PARTITION_TABLE_MD5)
|
|
|
|
set(md5_opt --disable-md5sum)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if(CONFIG_ESPTOOLPY_FLASHSIZE)
|
|
|
|
set(flashsize_opt --flash-size ${CONFIG_ESPTOOLPY_FLASHSIZE})
|
|
|
|
endif()
|
|
|
|
|
|
|
|
add_custom_command(OUTPUT "${unsigned_partition_bin}"
|
|
|
|
COMMAND "${PYTHON}" "${CMAKE_CURRENT_SOURCE_DIR}/gen_esp32part.py" -q ${md5_opt} ${flashsize_opt}
|
|
|
|
${partition_csv} ${unsigned_partition_bin}
|
|
|
|
DEPENDS ${partition_csv} "${CMAKE_CURRENT_SOURCE_DIR}/gen_esp32part.py"
|
|
|
|
VERBATIM)
|
2018-01-18 01:12:13 +00:00
|
|
|
|
|
|
|
# Add signing steps
|
|
|
|
if(CONFIG_SECURE_BOOT_BUILD_SIGNED_BINARIES)
|
|
|
|
get_filename_component(secure_boot_signing_key "${CONFIG_SECURE_BOOT_SIGNING_KEY}" ABSOLUTE BASE_DIR "${PROJECT_PATH}")
|
|
|
|
|
2018-01-19 04:47:49 +00:00
|
|
|
add_custom_command(OUTPUT "${final_partition_bin}"
|
|
|
|
COMMAND "${PYTHON}" "${ESPSECUREPY}" sign_data --keyfile "${secure_boot_signing_key}" -o "${final_partition_bin}" "${unsigned_partition_bin}"
|
2018-01-18 01:12:13 +00:00
|
|
|
DEPENDS "${unsigned_partition_bin}"
|
|
|
|
VERBATIM)
|
|
|
|
|
|
|
|
endif()
|
|
|
|
|
2018-01-19 04:47:49 +00:00
|
|
|
add_custom_target(partition_table ALL DEPENDS "${final_partition_bin}")
|
|
|
|
|
|
|
|
# Use global properties ESPTOOL_WRITE_FLASH_ARGS to pass this info to build hte list of esptool write arguments for flashing
|
|
|
|
set_property(GLOBAL APPEND_STRING PROPERTY ESPTOOL_WRITE_FLASH_ARGS "${partition_table_offset} ${final_partition_bin} ")
|
2018-01-18 01:12:13 +00:00
|
|
|
|
2018-01-12 02:49:13 +00:00
|
|
|
register_config_only_component()
|