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:
parent
7f407476f9
commit
34ca49b6f5
2 changed files with 26 additions and 12 deletions
|
|
@ -555,6 +555,16 @@ add_definitions(-D__NuttX__)
|
|||
|
||||
add_compile_options($<$<COMPILE_LANGUAGE:ASM>:-D__ASSEMBLY__>)
|
||||
|
||||
if(CONFIG_ARCH_TOOLCHAIN_TASKING)
|
||||
if(CONFIG_INTELHEX_BINARY)
|
||||
add_link_options(-Wl-onuttx.hex:IHEX:4 --hex-format=s)
|
||||
endif()
|
||||
|
||||
if(CONFIG_MOTOROLA_SREC)
|
||||
add_link_options(-Wl-onuttx.srec:SREC:4)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
set_property(
|
||||
TARGET nuttx
|
||||
APPEND
|
||||
|
|
|
|||
|
|
@ -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()
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue