From 7a19894aec84dd18ead58687212ff3fb4e15f6ea Mon Sep 17 00:00:00 2001 From: Renz Christian Bagaporo Date: Mon, 17 Jun 2019 12:20:12 +0800 Subject: [PATCH] esptool_py: better display logs when generating binary Since OUTPUT argument of custom command does not currently support generator expressions, the project image is only generated as a side effect. The primary generated file is a timestamp file. Unfortunately as a consequence the output logs when the binary is about to be generated is not as helpful anymore. Set a custom comment that is more descriptive of what is happening, and provide more feedback as to what has been generated. --- components/esptool_py/project_include.cmake | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/components/esptool_py/project_include.cmake b/components/esptool_py/project_include.cmake index d6c888f437..b847680c88 100644 --- a/components/esptool_py/project_include.cmake +++ b/components/esptool_py/project_include.cmake @@ -75,28 +75,33 @@ set(PROJECT_BIN "${elf_name}.bin") # # Add 'app.bin' target - generates with elf2image # -add_custom_command(OUTPUT "${build_dir}/.app_hash" +add_custom_command(OUTPUT "${build_dir}/.bin_timestamp" COMMAND ${ESPTOOLPY} elf2image ${ESPTOOLPY_ELF2IMAGE_FLASH_OPTIONS} ${ESPTOOLPY_ELF2IMAGE_OPTIONS} -o "${build_dir}/${unsigned_project_binary}" "${elf}" - COMMAND ${CMAKE_COMMAND} -E md5sum "${build_dir}/${unsigned_project_binary}" > "${build_dir}/.app_hash" + COMMAND ${CMAKE_COMMAND} -E echo "Generated ${build_dir}/${unsigned_project_binary}" + COMMAND ${CMAKE_COMMAND} -E md5sum "${build_dir}/${unsigned_project_binary}" > "${build_dir}/.bin_timestamp" DEPENDS ${elf} VERBATIM WORKING_DIRECTORY ${build_dir} + COMMENT "Generating binary image from built executable" ) -add_custom_target(gen_project_binary DEPENDS "${build_dir}/.app_hash") +add_custom_target(gen_project_binary DEPENDS "${build_dir}/.bin_timestamp") if(NOT BOOTLOADER_BUILD AND CONFIG_SECURE_BOOT_BUILD_SIGNED_BINARIES) # for locally signed secure boot image, add a signing step to get from unsigned app to signed app - add_custom_command(OUTPUT "${build_dir}/.signed_app_hash" + add_custom_command(OUTPUT "${build_dir}/.signed_bin_timestamp" COMMAND ${ESPSECUREPY} sign_data --keyfile ${secure_boot_signing_key} -o "${build_dir}/${PROJECT_BIN}" "${build_dir}/${unsigned_project_binary}" - COMMAND ${CMAKE_COMMAND} -E md5sum "${build_dir}/${PROJECT_BIN}" > "${build_dir}/.signed_app_hash" - DEPENDS "${build_dir}/.app_hash" + COMMAND ${CMAKE_COMMAND} -E echo "Generated signed binary image ${build_dir}/${PROJECT_BIN}" + "from ${build_dir}/${unsigned_project_binary}" + COMMAND ${CMAKE_COMMAND} -E md5sum "${build_dir}/${PROJECT_BIN}" > "${build_dir}/.signed_bin_timestamp" + DEPENDS "${build_dir}/.bin_timestamp" VERBATIM + COMMENT "Generating signed binary image" ) - add_custom_target(gen_signed_project_binary DEPENDS "${build_dir}/.signed_app_hash") + add_custom_target(gen_signed_project_binary DEPENDS "${build_dir}/.signed_bin_timestamp") add_dependencies(gen_project_binary gen_signed_project_binary) endif() @@ -106,6 +111,7 @@ else() add_custom_target(bootloader ALL DEPENDS gen_project_binary) endif() + if(NOT BOOTLOADER_BUILD AND CONFIG_SECURE_BOOT_ENABLED AND NOT CONFIG_SECURE_BOOT_BUILD_SIGNED_BINARIES)