cmake:bugfix fix CMake post_build phase time orderless

[1209/1210] cd cmake_out && arm-none-eabi-objcopy -O binary nuttx nuttx.bin && arm-none-eabi-objcopy -O binary nuttx vela_core1.bin && cp nuttx vela_core1.elf && cp nuttx.hex vela_core1.hex && cp nuttx.map vela_core1.mapfile
FAILED: boards/exclude_board/CMakeFiles/nuttx_post_build /home/work/ssd1/workspace/MiRTOS-car-dev-CI/cmake_out/boards/exclude_board/CMakeFiles/nuttx_post_build
cd cmake_out && arm-none-eabi-objcopy -O binary nuttx nuttx.bin && arm-none-eabi-objcopy -O binary nuttx vela_core1.bin && cp nuttx vela_core1.elf && cp nuttx.hex vela_core1.hex && cp nuttx.map vela_core1.mapfile
cp: cannot stat 'nuttx.hex': No such file or directory
[1210/1210] Generating nuttx.hex
ninja: build stopped: subcommand failed.

Signed-off-by: xuxin19 <xuxin19@xiaomi.com>
This commit is contained in:
xuxin19 2024-08-05 19:25:29 +08:00 committed by Xiang Xiao
parent b1b66ce491
commit b328b35e2b
3 changed files with 10 additions and 1 deletions

View File

@ -423,6 +423,7 @@ include(platform)
# Setup main nuttx target #################################################### # Setup main nuttx target ####################################################
add_executable(nuttx) add_executable(nuttx)
add_custom_target(nuttx_post)
if(CONFIG_BUILD_PROTECTED) if(CONFIG_BUILD_PROTECTED)
add_executable(nuttx_user) add_executable(nuttx_user)
endif() endif()
@ -432,6 +433,7 @@ if(CONFIG_ALLSYMS)
endif() endif()
add_dependencies(nuttx nuttx_context) add_dependencies(nuttx nuttx_context)
add_dependencies(nuttx_post nuttx)
if(WIN32) if(WIN32)
set_property(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY VS_STARTUP_PROJECT set_property(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY VS_STARTUP_PROJECT
@ -573,6 +575,9 @@ add_subdirectory(boards)
# with the correct operations for that platform # with the correct operations for that platform
if(TARGET nuttx_post_build) if(TARGET nuttx_post_build)
# ensure thae the custom post build is executed after all steps of the nuttx
# build are completed
add_dependencies(nuttx_post_build nuttx_post)
add_custom_target(post_build ALL DEPENDS nuttx_post_build) add_custom_target(post_build ALL DEPENDS nuttx_post_build)
endif() endif()

View File

@ -95,7 +95,8 @@ define_allsyms_link_target(nuttx NULL NULL)
define_allsyms_link_target(allsyms_inter nuttx allsyms_first_link) define_allsyms_link_target(allsyms_inter nuttx allsyms_first_link)
# allsyms link phase 2 since the table offset may changed # allsyms link phase 2 since the table offset may changed
define_allsyms_link_target(allsyms_nuttx allsyms_inter allsyms_final_link) define_allsyms_link_target(allsyms_nuttx allsyms_inter allsyms_final_link)
# fixing timing dependencies
add_dependencies(nuttx_post allsyms_nuttx)
# finally use allsyms_nuttx to overwrite the already generated nuttx # finally use allsyms_nuttx to overwrite the already generated nuttx
add_custom_command( add_custom_command(
TARGET allsyms_nuttx TARGET allsyms_nuttx

View File

@ -25,6 +25,7 @@ function(nuttx_generate_outputs target)
COMMAND ${CMAKE_OBJCOPY} -O ihex ${target} ${target}.hex COMMAND ${CMAKE_OBJCOPY} -O ihex ${target} ${target}.hex
DEPENDS ${target}) DEPENDS ${target})
add_custom_target(${target}-hex ALL DEPENDS ${target}.hex) add_custom_target(${target}-hex ALL DEPENDS ${target}.hex)
add_dependencies(nuttx_post ${target}-hex)
file(APPEND ${CMAKE_BINARY_DIR}/nuttx.manifest "${target}.hex\n") file(APPEND ${CMAKE_BINARY_DIR}/nuttx.manifest "${target}.hex\n")
endif() endif()
@ -34,6 +35,7 @@ function(nuttx_generate_outputs target)
COMMAND ${CMAKE_OBJCOPY} -O srec ${target} ${target}.srec COMMAND ${CMAKE_OBJCOPY} -O srec ${target} ${target}.srec
DEPENDS ${target}) DEPENDS ${target})
add_custom_target(${target}-srec ALL DEPENDS ${target}.srec) add_custom_target(${target}-srec ALL DEPENDS ${target}.srec)
add_dependencies(nuttx_post ${target}-srec)
file(APPEND ${CMAKE_BINARY_DIR}/nuttx.manifest "${target}.srec\n") file(APPEND ${CMAKE_BINARY_DIR}/nuttx.manifest "${target}.srec\n")
endif() endif()
@ -43,6 +45,7 @@ function(nuttx_generate_outputs target)
COMMAND ${CMAKE_OBJCOPY} -O binary ${target} ${target}.bin COMMAND ${CMAKE_OBJCOPY} -O binary ${target} ${target}.bin
DEPENDS ${target}) DEPENDS ${target})
add_custom_target(${target}-bin ALL DEPENDS ${target}.bin) add_custom_target(${target}-bin ALL DEPENDS ${target}.bin)
add_dependencies(nuttx_post ${target}-bin)
file(APPEND ${CMAKE_BINARY_DIR}/nuttx.manifest "${target}.bin\n") file(APPEND ${CMAKE_BINARY_DIR}/nuttx.manifest "${target}.bin\n")
endif() endif()