This is an automated email from the ASF dual-hosted git repository.

archer pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git


The following commit(s) were added to refs/heads/master by this push:
     new 34ca49b6f50 tasking/cmake: Provide better .hex and .srec gen for 
tasking compiler
34ca49b6f50 is described below

commit 34ca49b6f50d92d9a8ed87e40decb6b8a42f712b
Author: wangchengdong <wangchengd...@lixiang.com>
AuthorDate: Wed Sep 17 10:17:52 2025 +0800

    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 <wangchengd...@lixiang.com>
---
 CMakeLists.txt                     | 10 ++++++++++
 cmake/nuttx_generate_outputs.cmake | 28 ++++++++++++++++------------
 2 files changed, 26 insertions(+), 12 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 0d5bcdebae0..8f44c1725af 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -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
diff --git a/cmake/nuttx_generate_outputs.cmake 
b/cmake/nuttx_generate_outputs.cmake
index 98b2bb12bed..729286c651f 100644
--- a/cmake/nuttx_generate_outputs.cmake
+++ b/cmake/nuttx_generate_outputs.cmake
@@ -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()
 

Reply via email to