partition_table: do not always display partition table contents on build

This commit is contained in:
Renz Bagaporo 2020-04-08 11:37:02 +08:00
parent 52338e9cda
commit acb7a211dd
3 changed files with 17 additions and 9 deletions

View file

@ -5,7 +5,8 @@ if(BOOTLOADER_BUILD OR NOT CONFIG_APP_BUILD_BOOTLOADER)
return() return()
endif() endif()
add_dependencies(bootloader partition_table) add_dependencies(bootloader partition_table_bin)
# When secure boot is enabled, do not flash bootloader along with invocation of `idf.py flash` # When secure boot is enabled, do not flash bootloader along with invocation of `idf.py flash`
if(NOT CONFIG_SECURE_BOOT) if(NOT CONFIG_SECURE_BOOT)
set(flash_bootloader FLASH_IN_PROJECT) set(flash_bootloader FLASH_IN_PROJECT)

View file

@ -258,7 +258,7 @@ function(esptool_py_custom_target target_name flasher_filename dependencies)
endfunction() endfunction()
if(NOT BOOTLOADER_BUILD) if(NOT BOOTLOADER_BUILD)
set(flash_deps "partition_table") set(flash_deps "partition_table_bin")
if(CONFIG_APP_BUILD_GENERATE_BINARIES) if(CONFIG_APP_BUILD_GENERATE_BINARIES)
list(APPEND flash_deps "app") list(APPEND flash_deps "app")

View file

@ -37,19 +37,26 @@ set(gen_partition_table "${python}" "${CMAKE_CURRENT_SOURCE_DIR}/gen_esp32part.p
"--offset" "${PARTITION_TABLE_OFFSET}" "${md5_opt}" "${flashsize_opt}" "--offset" "${PARTITION_TABLE_OFFSET}" "${md5_opt}" "${flashsize_opt}"
"${partition_secure_opt}" ) "${partition_secure_opt}" )
set(partition_table_display
COMMAND ${CMAKE_COMMAND} -E echo "Partition table binary generated. Contents:"
COMMAND ${CMAKE_COMMAND} -E echo "*******************************************************************************"
COMMAND ${gen_partition_table} "${build_dir}/partition_table/${unsigned_partition_bin}"
COMMAND ${CMAKE_COMMAND} -E echo "*******************************************************************************"
)
add_custom_command(OUTPUT "${build_dir}/partition_table/${unsigned_partition_bin}" add_custom_command(OUTPUT "${build_dir}/partition_table/${unsigned_partition_bin}"
COMMAND ${gen_partition_table} "${partition_csv}" "${build_dir}/partition_table/${unsigned_partition_bin}" COMMAND ${gen_partition_table} "${partition_csv}" "${build_dir}/partition_table/${unsigned_partition_bin}"
${partition_table_display}
DEPENDS ${partition_csv} "${CMAKE_CURRENT_SOURCE_DIR}/gen_esp32part.py" DEPENDS ${partition_csv} "${CMAKE_CURRENT_SOURCE_DIR}/gen_esp32part.py"
VERBATIM) VERBATIM)
add_custom_target(partition_table_bin DEPENDS "${build_dir}/partition_table/${unsigned_partition_bin}"
"${build_dir}/partition_table/${unsigned_partition_bin}")
if(EXISTS ${partition_csv}) if(EXISTS ${partition_csv})
add_custom_target(partition_table ALL add_custom_target(partition_table
DEPENDS "${build_dir}/partition_table/${unsigned_partition_bin}" DEPENDS partition_table_bin
"${build_dir}/partition_table/${final_partition_bin}" ${partition_table_display}
COMMAND ${CMAKE_COMMAND} -E echo "Partition table binary generated. Contents:"
COMMAND ${CMAKE_COMMAND} -E echo "*******************************************************************************"
COMMAND ${gen_partition_table} "${build_dir}/partition_table/${unsigned_partition_bin}"
COMMAND ${CMAKE_COMMAND} -E echo "*******************************************************************************"
VERBATIM) VERBATIM)
else() else()
# If the partition input CSV is not found, create a phony partition_table target that # If the partition input CSV is not found, create a phony partition_table target that