Просмотр исходного кода

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.
Renz Christian Bagaporo 6 лет назад
Родитель
Сommit
7a19894aec
1 измененных файлов с 13 добавлено и 7 удалено
  1. 13 7
      components/esptool_py/project_include.cmake

+ 13 - 7
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)