tasking/cmake: Provide better .hex and .srec gen for tasking compiler

Provide better hex and srec generation for tasking compiler, without relying
on freeware tricore-elf-objcopy.

Signed-off-by: Chengdong Wang <wangchengdong@lixiang.com>
This commit is contained in:
wangchengdong
2025-09-17 10:17:52 +08:00
committed by archer
parent 7f407476f9
commit 34ca49b6f5
2 changed files with 26 additions and 12 deletions

View File

@@ -22,22 +22,26 @@
function(nuttx_generate_outputs target)
if(CONFIG_INTELHEX_BINARY)
add_custom_command(
OUTPUT ${target}.hex
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)
if(NOT CONFIG_ARCH_TOOLCHAIN_TASKING)
add_custom_command(
OUTPUT ${target}.hex
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)
endif()
file(APPEND ${CMAKE_BINARY_DIR}/nuttx.manifest "${target}.hex\n")
endif()
if(CONFIG_MOTOROLA_SREC)
add_custom_command(
OUTPUT ${target}.srec
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)
if(NOT CONFIG_ARCH_TOOLCHAIN_TASKING)
add_custom_command(
OUTPUT ${target}.srec
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)
endif()
file(APPEND ${CMAKE_BINARY_DIR}/nuttx.manifest "${target}.srec\n")
endif()