diff --git a/CMakeLists.txt b/CMakeLists.txt index 5d960036f0..97a6344557 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -423,6 +423,7 @@ include(platform) # Setup main nuttx target #################################################### add_executable(nuttx) +add_custom_target(nuttx_post) if(CONFIG_BUILD_PROTECTED) add_executable(nuttx_user) endif() @@ -432,6 +433,7 @@ if(CONFIG_ALLSYMS) endif() add_dependencies(nuttx nuttx_context) +add_dependencies(nuttx_post nuttx) if(WIN32) 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 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) endif() diff --git a/cmake/nuttx_allsyms.cmake b/cmake/nuttx_allsyms.cmake index 44b1a8d3fc..7e8bfc09d2 100644 --- a/cmake/nuttx_allsyms.cmake +++ b/cmake/nuttx_allsyms.cmake @@ -95,7 +95,8 @@ define_allsyms_link_target(nuttx NULL NULL) define_allsyms_link_target(allsyms_inter nuttx allsyms_first_link) # allsyms link phase 2 since the table offset may changed 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 add_custom_command( TARGET allsyms_nuttx diff --git a/cmake/nuttx_generate_outputs.cmake b/cmake/nuttx_generate_outputs.cmake index d09a1c4237..7ffe284625 100644 --- a/cmake/nuttx_generate_outputs.cmake +++ b/cmake/nuttx_generate_outputs.cmake @@ -25,6 +25,7 @@ function(nuttx_generate_outputs target) COMMAND ${CMAKE_OBJCOPY} -O ihex ${target} ${target}.hex DEPENDS ${target}) 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") endif() @@ -34,6 +35,7 @@ function(nuttx_generate_outputs target) COMMAND ${CMAKE_OBJCOPY} -O srec ${target} ${target}.srec DEPENDS ${target}) 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") endif() @@ -43,6 +45,7 @@ function(nuttx_generate_outputs target) COMMAND ${CMAKE_OBJCOPY} -O binary ${target} ${target}.bin DEPENDS ${target}) 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") endif()