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

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

commit 8ac25399d87eb115bfd1c313aa0dfce2821c5f9d
Author: Saravanan Sekar <[email protected]>
AuthorDate: Fri Oct 30 10:45:56 2026 +0530

    arch/tricore: Link cinit.o from the TASKING C library.
    
    iLLD calls _c_init, the TASKING copy table init, but nothing provided
    it.  Take cinit.o from the toolchain C library and add it to the
    libc_fpu archive the port already builds; the rest of that library
    clashes with NuttX.  This replaces the prebuilt cinit.o that the CMake
    build expected but the tree never had.
    
    Signed-off-by: Saravanan Sekar <[email protected]>
---
 arch/tricore/src/common/CMakeLists.txt | 17 ++++++++++++++++-
 arch/tricore/src/common/Make.defs      | 18 ++++++++++++++++--
 arch/tricore/src/tc3xx/CMakeLists.txt  |  3 ---
 3 files changed, 32 insertions(+), 6 deletions(-)

diff --git a/arch/tricore/src/common/CMakeLists.txt 
b/arch/tricore/src/common/CMakeLists.txt
index da3761103f5..57e54c8af1f 100644
--- a/arch/tricore/src/common/CMakeLists.txt
+++ b/arch/tricore/src/common/CMakeLists.txt
@@ -79,8 +79,23 @@ target_include_directories(
 # tricore_libc.c for details).
 
 if(CONFIG_TRICORE_TOOLCHAIN_TASKING)
+  # iLLD calls _c_init, the TASKING copy table init, so take cinit.o from the
+  # toolchain C library.  The rest of that library clashes with NuttX.
+
+  if(CONFIG_ARCH_TC1V8)
+    set(TASKING_LIBDIR tc18/dpfpu)
+  else()
+    set(TASKING_LIBDIR tc162)
+  endif()
+
+  get_filename_component(TASKING_BIN_DIR ${CMAKE_C_COMPILER} DIRECTORY)
+  execute_process(
+    COMMAND ${TASKING_BIN_DIR}/artc -x
+            ${TASKING_BIN_DIR}/../lib/${TASKING_LIBDIR}/libc_fpu.a cinit.o
+    WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
   nuttx_add_kernel_library(c_fpu)
-  target_sources(c_fpu PRIVATE tricore_libc.c)
+  target_sources(c_fpu PRIVATE tricore_libc.c
+                               ${CMAKE_CURRENT_BINARY_DIR}/cinit.o)
   target_link_options(nuttx PRIVATE
                       --library-directory=${CMAKE_CURRENT_BINARY_DIR})
 
diff --git a/arch/tricore/src/common/Make.defs 
b/arch/tricore/src/common/Make.defs
index c33e722c6b3..716031ca1d4 100644
--- a/arch/tricore/src/common/Make.defs
+++ b/arch/tricore/src/common/Make.defs
@@ -78,8 +78,22 @@ ifeq ($(CONFIG_TRICORE_TOOLCHAIN_TASKING),y)
 tricore_libc$(OBJEXT): tricore_libc.c
        $(call COMPILE, $<, $@)
 
-libc_fpu$(LIBEXT): tricore_libc$(OBJEXT)
-       $(call ARCHIVE, $@, $<)
+# iLLD calls _c_init, the TASKING copy table init, so take cinit.o from
+# the toolchain C library.  The rest of that library clashes with NuttX.
+
+ifeq ($(CONFIG_ARCH_TC1V8),y)
+TASKING_LIBDIR = tc18$(DELIM)dpfpu
+else
+TASKING_LIBDIR = tc162
+endif
+
+TASKING_LIBC = 
$(C_COMPILER_DIR)..$(DELIM)lib$(DELIM)$(TASKING_LIBDIR)$(DELIM)libc_fpu$(LIBEXT)
+
+cinit$(OBJEXT): $(TASKING_LIBC)
+       $(Q) artc -x $< cinit$(OBJEXT)
+
+libc_fpu$(LIBEXT): tricore_libc$(OBJEXT) cinit$(OBJEXT)
+       $(call ARCHIVE, $@, $^)
 
 EXTRA_LIBS += libc_fpu$(LIBEXT)
 
diff --git a/arch/tricore/src/tc3xx/CMakeLists.txt 
b/arch/tricore/src/tc3xx/CMakeLists.txt
index 3639e76aa57..8e801156c1b 100644
--- a/arch/tricore/src/tc3xx/CMakeLists.txt
+++ b/arch/tricore/src/tc3xx/CMakeLists.txt
@@ -148,7 +148,4 @@ if(NOT CONFIG_TRICORE_TOOLCHAIN_TASKING)
   target_compile_options(nuttx PRIVATE -Wno-unused-parameter
                                        -Wno-unused-but-set-parameter)
   target_compile_options(nuttx PRIVATE -Wno-implicit-fallthrough)
-else()
-  nuttx_add_extra_library(
-    "${CMAKE_CURRENT_LIST_DIR}/illd/prebuilts/tc162/cinit.o")
 endif()

Reply via email to