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 339b6b90b93612fa91247797f256224f2f1cb36e
Author: Parthiban Nallathambi <[email protected]>
AuthorDate: Fri Nov 6 19:50:12 2026 +0530

    arch/tricore: Start up TC3xx without the iLLD.
    
    Replace the iLLD startup (Ifx_Ssw_Tc0.c, Ifx_Ssw_Infra.c, Ifx_Cfg_Ssw.c)
    with a native one in the structure of arm_head.S.  tricore_head sets up
    the vectors, the interrupt stack, the caches and the CSA list under the
    CPU ENDINIT, disables the watchdogs, copies .data, clears .bss and sets
    up the clocks.  The common tricore_start then releases the other cores
    and enters NuttX through tricore_main.  The iLLD scripts give the
    symbols that the native startup uses.
    
    Co-authored-by: Saravanan Sekar <[email protected]>
    Signed-off-by: Parthiban Nallathambi <[email protected]>
---
 arch/tricore/include/csfr.h                        |   3 +
 arch/tricore/src/common/CMakeLists.txt             |   6 +
 arch/tricore/src/common/Make.defs                  |   4 +
 arch/tricore/src/common/gnu/tricore_head.S         | 254 +++++++++++++++++++
 arch/tricore/src/common/tasking/tricore_head.asm   | 272 +++++++++++++++++++++
 arch/tricore/src/common/tricore_internal.h         |  15 +-
 arch/tricore/src/common/tricore_main.c             |  77 +++++-
 arch/tricore/src/tc3xx/CMakeLists.txt              |   5 +-
 arch/tricore/src/tc3xx/Make.defs                   |   3 -
 arch/tricore/src/tc3xx/chip.h                      |  11 +
 .../src/tc3xx/{chip.h => hardware/tc3xx_cpu.h}     |  32 +--
 .../scripts/Lcf_Gnuc_Tricore_Tc.lsl.kernel         |  53 +++-
 .../scripts/Lcf_Tasking_Tricore_Tc.lsl.kernel      |  87 ++++---
 13 files changed, 736 insertions(+), 86 deletions(-)

diff --git a/arch/tricore/include/csfr.h b/arch/tricore/include/csfr.h
index 5875d813a37..2a7817252db 100644
--- a/arch/tricore/include/csfr.h
+++ b/arch/tricore/include/csfr.h
@@ -37,6 +37,9 @@
 #define TRICORE_CPU_PSW             0xfe04  /* Program Status Word */
 #define TRICORE_CPU_PC              0xfe08  /* Program Counter */
 #define TRICORE_CPU_CORE_ID         0xfe1c  /* Core Identification */
+#define TRICORE_CPU_BIV             0xfe20  /* Base Interrupt Vector */
+#define TRICORE_CPU_BTV             0xfe24  /* Base Trap Vector */
+#define TRICORE_CPU_ISP             0xfe28  /* Interrupt Stack Pointer */
 #define TRICORE_CPU_ICR             0xfe2c  /* Interrupt Control Register */
 #define TRICORE_CPU_PPRS            0xfe34  /* Previous PRS, TC1.8 */
 #define TRICORE_CPU_FCX             0xfe38  /* Free CSA List Head Pointer */
diff --git a/arch/tricore/src/common/CMakeLists.txt 
b/arch/tricore/src/common/CMakeLists.txt
index 8aaaeb9b2da..513ec44062c 100644
--- a/arch/tricore/src/common/CMakeLists.txt
+++ b/arch/tricore/src/common/CMakeLists.txt
@@ -85,8 +85,14 @@ target_sources(nuttx PRIVATE tricore_doirq.c)
 
 if(CONFIG_TRICORE_TOOLCHAIN_TASKING)
   target_sources(nuttx PRIVATE tasking/tricore_vectors.${ASMEXT})
+  if(CONFIG_ARCH_CHIP_TC3XX)
+    target_sources(nuttx PRIVATE tasking/tricore_head.${ASMEXT})
+  endif()
 else()
   target_sources(nuttx PRIVATE gnu/tricore_vectors.${ASMEXT})
+  if(CONFIG_ARCH_CHIP_TC3XX)
+    target_sources(nuttx PRIVATE gnu/tricore_head.${ASMEXT})
+  endif()
 endif()
 target_compile_options(arch PRIVATE ${IFXFLAGS})
 target_compile_options(nuttx PRIVATE ${IFXFLAGS})
diff --git a/arch/tricore/src/common/Make.defs 
b/arch/tricore/src/common/Make.defs
index d7998444f10..6a7e3ebf668 100644
--- a/arch/tricore/src/common/Make.defs
+++ b/arch/tricore/src/common/Make.defs
@@ -54,6 +54,10 @@ else
 endif
 
 HEAD_ASRC += tricore_vectors$(ASMEXT)
+
+ifeq ($(CONFIG_ARCH_CHIP_TC3XX),y)
+HEAD_ASRC += tricore_head$(ASMEXT)
+endif
 VPATH += common$(DELIM)$(TRICORE_SUBDIR)
 
 ifeq ($(CONFIG_SCHED_BACKTRACE),y)
diff --git a/arch/tricore/src/common/gnu/tricore_head.S 
b/arch/tricore/src/common/gnu/tricore_head.S
new file mode 100644
index 00000000000..7ebbc618156
--- /dev/null
+++ b/arch/tricore/src/common/gnu/tricore_head.S
@@ -0,0 +1,254 @@
+/****************************************************************************
+ * arch/tricore/src/common/gnu/tricore_head.S
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.  The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <arch/csfr.h>
+
+/****************************************************************************
+ * Pre-processor Definitions
+ ****************************************************************************/
+
+#define TRICORE_PSW_RESET  0x980   /* Supervisor, call depth counting on */
+#define TRICORE_BIV_VECTOR 0x1fe0  /* Single interrupt vector at INTTAB + 
0x1fe0 */
+
+#define TC3XX_WDTCPU0_CON0 0xf003624c  /* CPU0 watchdog CON0, 0xc apart per 
CPU */
+
+/* Make the CSA link word of the CSA address in addr: the segment in bits
+ * 19:16 and the offset in bits 15:0.
+ */
+
+       .macro  tricore_csa_link addr, tmp1, tmp2
+       extr.u  \tmp1, \addr, 6, 16
+       extr.u  \tmp2, \addr, 12, 20
+       insert  \addr, \tmp2, \tmp1, 0, 16
+       .endm
+
+/****************************************************************************
+ * Private Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: tricore_head
+ *
+ * Description:
+ *   Set up the core registers and the CSA list, which the code has to do
+ *   before it can call anything: the small data base registers, the trap
+ *   and interrupt vectors, the interrupt stack, the caches and the free
+ *   CSA list with LCX at the third last entry.  Then set the stack and the
+ *   PSW, disable the watchdogs, copy .data and clear .bss, set up the
+ *   clocks (see tricore_internal.h) and jump to tricore_start.
+ *
+ *   On TC3xx BTV, BIV, ISP, PCON0 and DCON0 are CPU ENDINIT protected,
+ *   so the ENDINIT of the CPU watchdog is cleared around them.
+ *
+ ****************************************************************************/
+
+       .text
+       .type   tricore_head, %function
+tricore_head:
+       movh.a  %a1, hi:__a1_mem
+       lea     %a1, [%a1]lo:__a1_mem
+       movh.a  %a0, hi:__a0_mem
+       lea     %a0, [%a0]lo:__a0_mem
+       movh.a  %a8, hi:__a8_mem
+       lea     %a8, [%a8]lo:__a8_mem
+       movh.a  %a9, hi:__a9_mem
+       lea     %a9, [%a9]lo:__a9_mem
+
+       jl      tc3xx_endinit_clear
+
+       movh.a  %a15, hi:__TRAPTAB_CPU0
+       lea     %a15, [%a15]lo:__TRAPTAB_CPU0
+       mov.d   %d15, %a15
+       mtcr    TRICORE_CPU_BTV, %d15
+       isync
+
+       /* Caches on, interrupt vector, interrupt stack */
+
+       mov     %d15, 0
+       mtcr    TRICORE_CPU_PCON0, %d15
+       isync
+       mtcr    TRICORE_CPU_DCON0, %d15
+       isync
+
+       movh.a  %a15, hi:__INTTAB_CPU0
+       lea     %a15, [%a15]lo:__INTTAB_CPU0
+       lea     %a15, [%a15]TRICORE_BIV_VECTOR
+       mov.d   %d15, %a15
+       mtcr    TRICORE_CPU_BIV, %d15
+       isync
+
+       movh.a  %a15, hi:__istack
+       lea     %a15, [%a15]lo:__istack
+       mov.d   %d15, %a15
+       mtcr    TRICORE_CPU_ISP, %d15
+       isync
+
+       /* Free CSA list from __csa_begin to __csa_end, LCX at the third last */
+
+       movh.a  %a15, hi:__csa_begin
+       lea     %a15, [%a15]lo:__csa_begin
+       movh.a  %a14, hi:__csa_end
+       lea     %a14, [%a14]lo:__csa_end
+       mov.d   %d15, %a15
+       tricore_csa_link %d15, %d14, %d13
+       mtcr    TRICORE_CPU_FCX, %d15
+       isync
+1:
+       addi    %d15, %d15, 1
+       st.w    [%a15], %d15
+       lea     %a15, [%a15]64
+       jne.a   %a15, %a14, 1b
+
+       mov     %d14, 0
+       st.w    [%a15]-64, %d14
+       addi    %d15, %d15, -3
+       mtcr    TRICORE_CPU_LCX, %d15
+       isync
+
+       jl      tc3xx_endinit_set
+
+       movh.a  %sp, hi:__ustack
+       lea     %sp, [%sp]lo:__ustack
+       dsync
+
+       mov     %d0, TRICORE_PSW_RESET
+       mtcr    TRICORE_CPU_PSW, %d0
+       isync
+
+       call    tricore_wdt_disable
+
+       /* Copy .data from its image in flash and clear .bss, a word at a time
+        * up to the word aligned ends that the linker script gives
+        */
+
+       movh.a  %a2, hi:_data_flash
+       lea     %a2, [%a2]lo:_data_flash
+       movh.a  %a3, hi:_sdata
+       lea     %a3, [%a3]lo:_sdata
+       movh.a  %a4, hi:_edata
+       lea     %a4, [%a4]lo:_edata
+       j       7f
+6:
+       ld.w    %d15, [%a2+]4
+       st.w    [%a3+]4, %d15
+7:
+       lt.a    %d15, %a3, %a4
+       jnz     %d15, 6b
+
+       mov     %d14, 0
+       movh.a  %a3, hi:_sbss
+       lea     %a3, [%a3]lo:_sbss
+       movh.a  %a4, hi:_ebss
+       lea     %a4, [%a4]lo:_ebss
+       j       9f
+8:
+       st.w    [%a3+]4, %d14
+9:
+       lt.a    %d15, %a3, %a4
+       jnz     %d15, 8b
+
+       call    tricore_clockconfig
+       jz      %d2, 5f
+       debug
+5:
+       movh.a  %a15, hi:tricore_start
+       lea     %a15, [%a15]lo:tricore_start
+       ji      %a15
+
+/****************************************************************************
+ * Name: tc3xx_endinit_clear, tc3xx_endinit_set
+ *
+ * Description:
+ *   Clear (tc3xx_endinit_clear) or set (tc3xx_endinit_set) the ENDINIT
+ *   of the watchdog of the calling CPU with the password and the lock
+ *   sequence, and wait until it has changed.  Called with jl, before
+ *   any CSA exists.  CPU5 has the core ID 6 on TC39x.
+ *
+ ****************************************************************************/
+
+       .type   tc3xx_endinit_clear, %function
+tc3xx_endinit_clear:
+       mov     %d5, 0
+       j       2f
+
+       .type   tc3xx_endinit_set, %function
+tc3xx_endinit_set:
+       mov     %d5, 1
+2:
+       mfcr    %d4, TRICORE_CPU_CORE_ID
+       extr.u  %d4, %d4, 0, 3
+       jne     %d4, 6, 3f
+       mov     %d4, 5
+3:
+       sh      %d15, %d4, 1
+       add     %d4, %d15, %d4
+       movh.a  %a15, hi:TC3XX_WDTCPU0_CON0
+       lea     %a15, [%a15]lo:TC3XX_WDTCPU0_CON0
+       addsc.a %a15, %a15, %d4, 2
+
+       /* Password access with the inverted password bits 7:2, then the
+        * modify access with LCK set and the new ENDINIT
+        */
+
+       ld.w    %d15, [%a15]
+       xor     %d15, %d15, 0xfc
+       insert  %d15, %d15, 1, 0, 2
+       st.w    [%a15], %d15
+       or      %d4, %d5, 2
+       insert  %d15, %d15, %d4, 0, 2
+       st.w    [%a15], %d15
+4:
+       ld.w    %d15, [%a15]
+       extr.u  %d15, %d15, 0, 1
+       jne     %d15, %d5, 4b
+       ji      %a11
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: __start
+ *
+ * Description:
+ *   Reset entry of CPU0.  It only sets the boot stack in the PSPR and
+ *   jumps to tricore_head, as the linker script keeps .start to 0x20
+ *   bytes ahead of the interface constants.
+ *
+ *   tasking/tricore_head.asm is the same code in the TASKING syntax.
+ *
+ ****************************************************************************/
+
+       .section .start, "ax", %progbits
+       .global __start
+       .type   __start, %function
+__start:
+       movh.a  %sp, hi:__psram_ustack
+       lea     %sp, [%sp]lo:__psram_ustack
+       dsync
+       movh.a  %a15, hi:tricore_head
+       lea     %a15, [%a15]lo:tricore_head
+       ji      %a15
diff --git a/arch/tricore/src/common/tasking/tricore_head.asm 
b/arch/tricore/src/common/tasking/tricore_head.asm
new file mode 100644
index 00000000000..9338603665f
--- /dev/null
+++ b/arch/tricore/src/common/tasking/tricore_head.asm
@@ -0,0 +1,272 @@
+/****************************************************************************
+ * arch/tricore/src/common/tasking/tricore_head.asm
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.  The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <arch/csfr.h>
+
+/****************************************************************************
+ * Pre-processor Definitions
+ ****************************************************************************/
+
+#define TRICORE_PSW_RESET  0x980   /* Supervisor, call depth counting on */
+#define TRICORE_BIV_VECTOR 0x1fe0  /* Single interrupt vector at INTTAB + 
0x1fe0 */
+
+#define TC3XX_WDTCPU0_CON0 0xf003624c  /* CPU0 watchdog CON0, 0xc apart per 
CPU */
+
+/* Make the CSA link word of the CSA address in addr: the segment in bits
+ * 19:16 and the offset in bits 15:0.
+ */
+
+tricore_csa_link .macro addr, tmp1, tmp2
+       extr.u  tmp1, addr, #6, #16
+       extr.u  tmp2, addr, #12, #20
+       insert  addr, tmp2, tmp1, #0, #16
+       .endm
+
+       .extern tricore_wdt_disable
+       .extern _data_flash
+       .extern _sdata
+       .extern _edata
+       .extern _sbss
+       .extern _ebss
+       .extern tricore_clockconfig
+       .extern tricore_start
+       .extern __ustack
+       .extern __istack
+       .extern __csa_begin
+       .extern __csa_end
+       .extern __a0_mem
+       .extern __a1_mem
+       .extern __a8_mem
+       .extern __a9_mem
+       .extern __TRAPTAB_CPU0
+       .extern __INTTAB_CPU0
+       .extern __psram_ustack
+
+/****************************************************************************
+ * Private Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: tricore_head
+ *
+ * Description:
+ *   Set up the core registers and the CSA list, which the code has to do
+ *   before it can call anything: the small data base registers, the trap
+ *   and interrupt vectors, the interrupt stack, the caches and the free
+ *   CSA list with LCX at the third last entry.  Then set the stack and the
+ *   PSW, disable the watchdogs, copy .data and clear .bss, set up the
+ *   clocks (see tricore_internal.h) and jump to tricore_start.
+ *
+ *   On TC3xx BTV, BIV, ISP, PCON0 and DCON0 are CPU ENDINIT protected,
+ *   so the ENDINIT of the CPU watchdog is cleared around them.
+ *
+ ****************************************************************************/
+
+       .sdecl  ".text.tricore_head",code
+       .sect   ".text.tricore_head"
+tricore_head:
+       movh.a  a1, #@HIS(__a1_mem)
+       lea     a1, [a1]@LOS(__a1_mem)
+       movh.a  a0, #@HIS(__a0_mem)
+       lea     a0, [a0]@LOS(__a0_mem)
+       movh.a  a8, #@HIS(__a8_mem)
+       lea     a8, [a8]@LOS(__a8_mem)
+       movh.a  a9, #@HIS(__a9_mem)
+       lea     a9, [a9]@LOS(__a9_mem)
+
+       jl      tc3xx_endinit_clear
+
+       movh.a  a15, #@HIS(__TRAPTAB_CPU0)
+       lea     a15, [a15]@LOS(__TRAPTAB_CPU0)
+       mov.d   d15, a15
+       mtcr    #TRICORE_CPU_BTV, d15
+       isync
+
+       ; Caches on, interrupt vector, interrupt stack
+
+       mov     d15, #0
+       mtcr    #TRICORE_CPU_PCON0, d15
+       isync
+       mtcr    #TRICORE_CPU_DCON0, d15
+       isync
+
+       movh.a  a15, #@HIS(__INTTAB_CPU0)
+       lea     a15, [a15]@LOS(__INTTAB_CPU0)
+       lea     a15, [a15]TRICORE_BIV_VECTOR
+       mov.d   d15, a15
+       mtcr    #TRICORE_CPU_BIV, d15
+       isync
+
+       movh.a  a15, #@HIS(__istack)
+       lea     a15, [a15]@LOS(__istack)
+       mov.d   d15, a15
+       mtcr    #TRICORE_CPU_ISP, d15
+       isync
+
+       ; Free CSA list from __csa_begin to __csa_end, LCX at the third last
+
+       movh.a  a15, #@HIS(__csa_begin)
+       lea     a15, [a15]@LOS(__csa_begin)
+       movh.a  a14, #@HIS(__csa_end)
+       lea     a14, [a14]@LOS(__csa_end)
+       mov.d   d15, a15
+       tricore_csa_link d15, d14, d13
+       mtcr    #TRICORE_CPU_FCX, d15
+       isync
+1:
+       addi    d15, d15, #1
+       st.w    [a15], d15
+       lea     a15, [a15]64
+       jne.a   a15, a14, 1p
+
+       mov     d14, #0
+       st.w    [a15]-64, d14
+       addi    d15, d15, #-3
+       mtcr    #TRICORE_CPU_LCX, d15
+       isync
+
+       jl      tc3xx_endinit_set
+
+       movh.a  a10, #@HIS(__ustack)
+       lea     a10, [a10]@LOS(__ustack)
+       dsync
+
+       mov     d0, #TRICORE_PSW_RESET
+       mtcr    #TRICORE_CPU_PSW, d0
+       isync
+
+       call    tricore_wdt_disable
+
+       ; Copy .data from its image in flash and clear .bss, a word at a time
+       ; up to the word aligned ends that the linker script gives
+
+       movh.a  a2, #@HIS(_data_flash)
+       lea     a2, [a2]@LOS(_data_flash)
+       movh.a  a3, #@HIS(_sdata)
+       lea     a3, [a3]@LOS(_sdata)
+       movh.a  a4, #@HIS(_edata)
+       lea     a4, [a4]@LOS(_edata)
+       j       7n
+6:
+       ld.w    d15, [a2+]4
+       st.w    [a3+]4, d15
+7:
+       lt.a    d15, a3, a4
+       jnz     d15, 6p
+
+       mov     d14, #0
+       movh.a  a3, #@HIS(_sbss)
+       lea     a3, [a3]@LOS(_sbss)
+       movh.a  a4, #@HIS(_ebss)
+       lea     a4, [a4]@LOS(_ebss)
+       j       9n
+8:
+       st.w    [a3+]4, d14
+9:
+       lt.a    d15, a3, a4
+       jnz     d15, 8p
+
+       call    tricore_clockconfig
+       jz      d2, 5n
+       debug
+5:
+       movh.a  a15, #@HIS(tricore_start)
+       lea     a15, [a15]@LOS(tricore_start)
+       ji      a15
+
+/****************************************************************************
+ * Name: tc3xx_endinit_clear, tc3xx_endinit_set
+ *
+ * Description:
+ *   Clear (tc3xx_endinit_clear) or set (tc3xx_endinit_set) the ENDINIT
+ *   of the watchdog of the calling CPU with the password and the lock
+ *   sequence, and wait until it has changed.  Called with jl, before
+ *   any CSA exists.  CPU5 has the core ID 6 on TC39x.
+ *
+ ****************************************************************************/
+
+tc3xx_endinit_clear:
+       mov     d5, #0
+       j       2n
+
+tc3xx_endinit_set:
+       mov     d5, #1
+2:
+       mfcr    d4, #TRICORE_CPU_CORE_ID
+       extr.u  d4, d4, #0, #3
+       jne     d4, #6, 3n
+       mov     d4, #5
+3:
+       sh      d15, d4, #1
+       add     d4, d15, d4
+       movh.a  a15, #@HIS(TC3XX_WDTCPU0_CON0)
+       lea     a15, [a15]@LOS(TC3XX_WDTCPU0_CON0)
+       addsc.a a15, a15, d4, #2
+
+       ; Password access with the inverted password bits 7:2, then the
+       ; modify access with LCK set and the new ENDINIT
+
+       ld.w    d15, [a15]
+       xor     d15, d15, #0xfc
+       insert  d15, d15, #1, #0, #2
+       st.w    [a15], d15
+       or      d4, d5, #2
+       insert  d15, d15, d4, #0, #2
+       st.w    [a15], d15
+4:
+       ld.w    d15, [a15]
+       extr.u  d15, d15, #0, #1
+       jne     d15, d5, 4p
+       ji      a11
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: __start
+ *
+ * Description:
+ *   Reset entry of CPU0.  It only sets the boot stack in the PSPR and
+ *   jumps to tricore_head, as the linker script keeps .start to 0x20
+ *   bytes ahead of the interface constants.
+ *
+ *   This is the TASKING syntax of gnu/tricore_head.S.
+ *
+ ****************************************************************************/
+
+       .sdecl  ".text.start",code,protect
+       .sect   ".text.start"
+       .global __start
+__start:
+       movh.a  a10, #@HIS(__psram_ustack)
+       lea     a10, [a10]@LOS(__psram_ustack)
+       dsync
+       movh.a  a15, #@HIS(tricore_head)
+       lea     a15, [a15]@LOS(tricore_head)
+       ji      a15
+
+       .end
diff --git a/arch/tricore/src/common/tricore_internal.h 
b/arch/tricore/src/common/tricore_internal.h
index 2ebf0dc6a68..585a4be05f1 100644
--- a/arch/tricore/src/common/tricore_internal.h
+++ b/arch/tricore/src/common/tricore_internal.h
@@ -192,13 +192,18 @@ extern uintptr_t        _eheap[]; /* End+1 of .heap */
 void tricore_ack_irq(int irq);
 void tricore_doirq(void);
 
-/* Watchdog *****************************************************************/
+/* Startup ******************************************************************/
 
-void tricore_wdt_disable(void);
-
-/* Clocks *******************************************************************/
+/* tricore_head calls these on CPU0 in this order, and copies .data and
+ * clears .bss itself between tricore_wdt_disable and tricore_clockconfig.
+ * tricore_wdt_disable runs with the stack and the CSAs set up, but before
+ * .data and .bss: it may only use registers and constants.
+ */
 
-int tricore_clockconfig(void);
+void tricore_wdt_disable(void);    /* Chip: CPU and safety watchdogs off */
+int tricore_clockconfig(void);     /* Chip: oscillator, PLLs and dividers */
+void tricore_start(void);          /* Start the other cores, enter NuttX */
+void tricore_main(void);           /* Per core entry into NuttX */
 
 /* Signal handling **********************************************************/
 
diff --git a/arch/tricore/src/common/tricore_main.c 
b/arch/tricore/src/common/tricore_main.c
index c38d07c02f5..46cd1e42d8d 100644
--- a/arch/tricore/src/common/tricore_main.c
+++ b/arch/tricore/src/common/tricore_main.c
@@ -36,6 +36,33 @@
 #include "tricore_stm.h"
 #include "chip.h"
 
+/****************************************************************************
+ * Public Data
+ ****************************************************************************/
+
+/* Entries of the other cores, provided by the linker script; TC4xx still
+ * starts from the iLLD startup code
+ */
+
+#ifdef CONFIG_ARCH_CHIP_TC3XX
+extern uintptr_t __start1[];
+extern uintptr_t __start2[];
+extern uintptr_t __start3[];
+extern uintptr_t __start4[];
+extern uintptr_t __start5[];
+#endif
+
+/****************************************************************************
+ * Private Data
+ ****************************************************************************/
+
+#ifdef CONFIG_ARCH_CHIP_TC3XX
+static uintptr_t * const g_tricore_entry[] =
+{
+  __start1, __start2, __start3, __start4, __start5
+};
+#endif
+
 /****************************************************************************
  * Private Functions
  ****************************************************************************/
@@ -79,7 +106,7 @@ static void tricore_core_sync(volatile uint32_t *sync)
     }
 }
 
-static void core_main(void)
+void tricore_main(void)
 {
   static volatile uint32_t g_sync_event;
 
@@ -115,6 +142,40 @@ static void core_main(void)
  * Public Functions
  ****************************************************************************/
 
+#ifdef CONFIG_ARCH_CHIP_TC3XX
+/****************************************************************************
+ * Name: tricore_start
+ *
+ * Description:
+ *   C entry of the startup, jumped to from tricore_head on CPU0 once the
+ *   core registers, the CSA list, the watchdogs, the RAMs, the C runtime
+ *   and the clocks are set up.  Release CPU1 to TRICORE_START_CORES at
+ *   __start1 and on, the start of their own images, as the iLLD startup
+ *   code does, and enter NuttX.
+ *
+ ****************************************************************************/
+
+void tricore_start(void)
+{
+  int cpu;
+
+  for (cpu = 1; cpu <= TRICORE_START_CORES; cpu++)
+    {
+      uintptr_t pc = (uintptr_t)g_tricore_entry[cpu - 1];
+
+      putreg32((getreg32(TRICORE_START_PC(cpu)) & 1) | (pc & ~1),
+               TRICORE_START_PC(cpu));
+      if ((getreg32(TRICORE_START_HALT(cpu)) & TRICORE_START_BHALT) != 0)
+        {
+          putreg32(getreg32(TRICORE_START_HALT(cpu)) & ~TRICORE_START_BHALT,
+                   TRICORE_START_HALT(cpu));
+        }
+    }
+
+  tricore_main();
+}
+#endif
+
 void core0_main(void)
 {
   /* All WDTs except WDTCPU0 and system watchdog WDTSYS are in
@@ -124,35 +185,35 @@ void core0_main(void)
 
   tricore_wdt_disable();
 
-  core_main();
+  tricore_main();
 }
 
 void core1_main(void)
 {
-  core_main();
+  tricore_main();
 }
 
 void core2_main(void)
 {
-  core_main();
+  tricore_main();
 }
 
 void core3_main(void)
 {
-  core_main();
+  tricore_main();
 }
 
 void core4_main(void)
 {
-  core_main();
+  tricore_main();
 }
 
 void core5_main(void)
 {
-  core_main();
+  tricore_main();
 }
 
 void core6_main(void)
 {
-  core_main();
+  tricore_main();
 }
diff --git a/arch/tricore/src/tc3xx/CMakeLists.txt 
b/arch/tricore/src/tc3xx/CMakeLists.txt
index 4eef1d3743a..005172151dc 100644
--- a/arch/tricore/src/tc3xx/CMakeLists.txt
+++ b/arch/tricore/src/tc3xx/CMakeLists.txt
@@ -116,7 +116,6 @@ set_property(
   PROPERTY NUTTX_INCLUDE_DIRECTORIES ${SDK_INCDIR})
 
 set(SDK_CSRCS
-    "${CONFIG_DIR}/Ifx_Cfg_Ssw.c"
     "${ILLD_DIR}/Libraries/iLLD/TC3xx/Tricore/Asclin/Std/IfxAsclin.c"
     "${ILLD_DIR}/Libraries/iLLD/TC3xx/Tricore/Cpu/Std/IfxCpu.c"
     "${ILLD_DIR}/Libraries/iLLD/TC3xx/Tricore/_Impl/IfxAsclin_cfg.c"
@@ -131,9 +130,7 @@ set(SDK_CSRCS
     "${ILLD_DIR}/Libraries/iLLD/TC3xx/Tricore/Scu/Std/IfxScuLbist.c"
     "${ILLD_DIR}/Libraries/iLLD/TC3xx/Tricore/Scu/Std/IfxScuRcu.c"
     "${ILLD_DIR}/Libraries/iLLD/TC3xx/Tricore/Scu/Std/IfxScuWdt.c"
-    "${ILLD_DIR}/Libraries/Infra/Platform/Tricore/Compilers/CompilerTasking.c"
-    "${ILLD_DIR}/Libraries/Infra/Ssw/TC3xx/Tricore/Ifx_Ssw_Infra.c"
-    "${ILLD_DIR}/Libraries/Infra/Ssw/TC3xx/Tricore/Ifx_Ssw_Tc0.c")
+    "${ILLD_DIR}/Libraries/Infra/Platform/Tricore/Compilers/CompilerTasking.c")
 
 target_sources(nuttx PRIVATE ${SDK_CSRCS})
 
diff --git a/arch/tricore/src/tc3xx/Make.defs b/arch/tricore/src/tc3xx/Make.defs
index b87153a52de..91325a634dc 100644
--- a/arch/tricore/src/tc3xx/Make.defs
+++ b/arch/tricore/src/tc3xx/Make.defs
@@ -99,7 +99,6 @@ SDK_INCDIR += $(ILLD_DIR)/Libraries/Infra/Sfr/TC39xB
 SDK_INCDIR += $(ILLD_DIR)/Libraries/Infra/Ssw/TC3xx/Tricore
 SDK_INCDIR += $(ILLD_DIR)/Libraries/Service/CpuGeneric
 
-SDK_CSRCS += ${CONFIG_DIR}/Ifx_Cfg_Ssw.c
 SDK_CSRCS += $(ILLD_DIR)/Libraries/iLLD/TC3xx/Tricore/Asclin/Std/IfxAsclin.c
 SDK_CSRCS += $(ILLD_DIR)/Libraries/iLLD/TC3xx/Tricore/Cpu/Std/IfxCpu.c
 SDK_CSRCS += $(ILLD_DIR)/Libraries/iLLD/TC3xx/Tricore/_Impl/IfxAsclin_cfg.c
@@ -115,8 +114,6 @@ SDK_CSRCS += 
$(ILLD_DIR)/Libraries/iLLD/TC3xx/Tricore/Scu/Std/IfxScuLbist.c
 SDK_CSRCS += $(ILLD_DIR)/Libraries/iLLD/TC3xx/Tricore/Scu/Std/IfxScuRcu.c
 SDK_CSRCS += $(ILLD_DIR)/Libraries/iLLD/TC3xx/Tricore/Scu/Std/IfxScuWdt.c
 SDK_CSRCS += 
$(ILLD_DIR)/Libraries/Infra/Platform/Tricore/Compilers/CompilerTasking.c
-SDK_CSRCS += $(ILLD_DIR)/Libraries/Infra/Ssw/TC3xx/Tricore/Ifx_Ssw_Infra.c
-SDK_CSRCS += $(ILLD_DIR)/Libraries/Infra/Ssw/TC3xx/Tricore/Ifx_Ssw_Tc0.c
 
 CFLAGS += $(addprefix ${INCDIR_PREFIX},$(SDK_INCDIR))
 
diff --git a/arch/tricore/src/tc3xx/chip.h b/arch/tricore/src/tc3xx/chip.h
index 7bbbe95cf1d..4f3a8cb903e 100644
--- a/arch/tricore/src/tc3xx/chip.h
+++ b/arch/tricore/src/tc3xx/chip.h
@@ -27,6 +27,8 @@
  * Included Files
  ****************************************************************************/
 
+#include "hardware/tc3xx_cpu.h"
+
 #define UART_PIN_RX IfxAsclin0_RXA_P14_1_IN     /* UART receive port pin  */
 #define UART_PIN_TX IfxAsclin0_TX_P14_0_OUT     /* UART transmit port pin */
 
@@ -41,6 +43,15 @@
 #define TRICORE_CORE_SYNC_MASK     0x5f
 #define TRICORE_CORE_SYNC_TIMEOUT  100000
 
+/* Other cores that tricore_start releases, CPU1 only as with the iLLD
+ * startup code, and their PC and boot halt registers
+ */
+
+#define TRICORE_START_CORES        1
+#define TRICORE_START_PC(n)        TC3XX_CPU_PC(n)
+#define TRICORE_START_HALT(n)      TC3XX_CPU_SYSCON(n)
+#define TRICORE_START_BHALT        TC3XX_SYSCON_BHALT
+
 /* Core index from CORE_ID; CPU5 has the core ID 6 on TC39x */
 
 #define tricore_core_id()          tricore_mfcr(TRICORE_CPU_CORE_ID)
diff --git a/arch/tricore/src/tc3xx/chip.h 
b/arch/tricore/src/tc3xx/hardware/tc3xx_cpu.h
similarity index 56%
copy from arch/tricore/src/tc3xx/chip.h
copy to arch/tricore/src/tc3xx/hardware/tc3xx_cpu.h
index 7bbbe95cf1d..7b5b2e4107d 100644
--- a/arch/tricore/src/tc3xx/chip.h
+++ b/arch/tricore/src/tc3xx/hardware/tc3xx_cpu.h
@@ -1,5 +1,5 @@
 /****************************************************************************
- * arch/tricore/src/tc3xx/chip.h
+ * arch/tricore/src/tc3xx/hardware/tc3xx_cpu.h
  *
  * SPDX-License-Identifier: Apache-2.0
  *
@@ -20,31 +20,21 @@
  *
  ****************************************************************************/
 
-#ifndef __ARCH_TRICORE_SRC_TC3XX_CHIP_H
-#define __ARCH_TRICORE_SRC_TC3XX_CHIP_H
-
-/****************************************************************************
- * Included Files
- ****************************************************************************/
-
-#define UART_PIN_RX IfxAsclin0_RXA_P14_1_IN     /* UART receive port pin  */
-#define UART_PIN_TX IfxAsclin0_TX_P14_0_OUT     /* UART transmit port pin */
+#ifndef __ARCH_TRICORE_SRC_TC3XX_HARDWARE_TC3XX_CPU_H
+#define __ARCH_TRICORE_SRC_TC3XX_HARDWARE_TC3XX_CPU_H
 
 /****************************************************************************
  * Pre-processor Definitions
  ****************************************************************************/
 
-/* Startup core synchronization: core ID bits to wait for and the timeout
- * in STM ticks (0: no timeout)
+/* Start of the other cores: PC and SYSCON.BHALT of each CPU.  The CSFRs
+ * of the CPUs are 0x20000 apart, but those of CPU5 are at 0xf88c0000.
  */
 
-#define TRICORE_CORE_SYNC_MASK     0x5f
-#define TRICORE_CORE_SYNC_TIMEOUT  100000
-
-/* Core index from CORE_ID; CPU5 has the core ID 6 on TC39x */
-
-#define tricore_core_id()          tricore_mfcr(TRICORE_CPU_CORE_ID)
-#define tricore_core_index()       (tricore_core_id() > 5 ? 5 : \
-                                    tricore_core_id())
+#define TC3XX_CPU_CSFR(n)          ((n) < 5 ? 0xf8800000 + (n) * 0x20000 : \
+                                    0xf88c0000)
+#define TC3XX_CPU_PC(n)            (TC3XX_CPU_CSFR(n) + 0x1fe08)
+#define TC3XX_CPU_SYSCON(n)        (TC3XX_CPU_CSFR(n) + 0x1fe14)
+#define TC3XX_SYSCON_BHALT         (1 << 24)
 
-#endif /* __ARCH_TRICORE_SRC_TC3XX_CHIP_H */
+#endif /* __ARCH_TRICORE_SRC_TC3XX_HARDWARE_TC3XX_CPU_H */
diff --git 
a/boards/tricore/tc3xx/a2g-tc397-5v-tft/scripts/Lcf_Gnuc_Tricore_Tc.lsl.kernel 
b/boards/tricore/tc3xx/a2g-tc397-5v-tft/scripts/Lcf_Gnuc_Tricore_Tc.lsl.kernel
index 28bb7c178ba..5fd26bfb511 100644
--- 
a/boards/tricore/tc3xx/a2g-tc397-5v-tft/scripts/Lcf_Gnuc_Tricore_Tc.lsl.kernel
+++ 
b/boards/tricore/tc3xx/a2g-tc397-5v-tft/scripts/Lcf_Gnuc_Tricore_Tc.lsl.kernel
@@ -36,11 +36,15 @@
 OUTPUT_FORMAT("elf32-tricore")
 OUTPUT_ARCH("tricore")
 #if CONFIG_CPU_COREID == 0
-ENTRY(_START)
+ENTRY(__start)
 #endif
 
 __TRICORE_DERIVATE_MEMORY_MAP__ = 0x390;
 
+/* Boot stack of __start in the PSPR, as on TC4xx */
+
+__psram_ustack = 0x7010eb00;
+
 LCF_PFLASH_KERNEL_START = GENERATE_CORE_PFLASH_KERNEL_START(CONFIG_CPU_COREID);
 LCF_PFLASH_KERNEL_SIZE  = GENERATE_CORE_PFLASH_KERNEL_SIZE(CONFIG_CPU_COREID);
 LCF_DSPR_KERNEL_START   = GENERATE_CORE_DSPR_KERNEL_START(CONFIG_CPU_COREID);
@@ -106,7 +110,7 @@ SECTIONS
         PROVIDE(__USTACK_END = .);
         PROVIDE(COREID_MID(__USTACK, _END) = .);
         . = . + LCF_USTACK_SIZE;
-        PROVIDE(__USTACK = .);
+        PROVIDE(__ustack = .);
         PROVIDE(COREID_LST(__USTACK) = .);
     }
 
@@ -116,17 +120,20 @@ SECTIONS
         PROVIDE(COREID_MID(__ISTACK, _END) = .);
         . = . + LCF_ISTACK_SIZE;
         PROVIDE(__ISTACK = .);
+        PROVIDE(__istack = .);
         PROVIDE(COREID_LST(__ISTACK) = .);
     }
     CORE_SEC(.csa) (LCF_DSPR_KERNEL_START + LCF_CSA_OFFSET):
     {
         PROVIDE(COREID_LST(__CSA) = .);
+        PROVIDE(__csa_begin = .);
         . = . + LCF_CSA_SIZE;
         PROVIDE(COREID_MID(__CSA, _END) = .);
+        PROVIDE(__csa_end = .);
     }
 }
 
-/*Fixed memory Allocations for _START*/
+/*Fixed memory Allocations for __start*/
 CORE_ID = GLOBAL ;
 SECTIONS
 {
@@ -162,15 +169,15 @@ SECTIONS
     } > pfls
 }
 
-/*Fixed memory Allocations for _START1 to 5 */
+/*Fixed memory Allocations for __start1 to 5 */
 CORE_ID = GLOBAL ;
 SECTIONS
 {
-    PROVIDE(__START1 = CORE1_PFLASH_KERNEL_START);
-    PROVIDE(__START2 = CORE2_PFLASH_KERNEL_START);
-    PROVIDE(__START3 = CORE3_PFLASH_KERNEL_START);
-    PROVIDE(__START4 = CORE4_PFLASH_KERNEL_START);
-    PROVIDE(__START5 = CORE5_PFLASH_KERNEL_START);
+    PROVIDE(__start1 = CORE1_PFLASH_KERNEL_START);
+    PROVIDE(__start2 = CORE2_PFLASH_KERNEL_START);
+    PROVIDE(__start3 = CORE3_PFLASH_KERNEL_START);
+    PROVIDE(__start4 = CORE4_PFLASH_KERNEL_START);
+    PROVIDE(__start5 = CORE5_PFLASH_KERNEL_START);
 }
 
 /*Fixed memory Allocations for Interrupt Vector Table*/
@@ -215,7 +222,7 @@ SECTIONS
         *(.sbss.*)
     } > dspr
     _SMALL_DATA_ = SIZEOF(CORE_SEC(.sdata)) ? ADDR(CORE_SEC(.sdata)) : 
(ADDR(CORE_SEC(.sdata)) & 0xF0000000) + 32k ;
-    __A0_MEM = _SMALL_DATA_;
+    __a0_mem = _SMALL_DATA_;
 }
 
 CORE_ID = GLOBAL;
@@ -230,7 +237,7 @@ SECTIONS
         *(.srodata.*)
     } > pfls
     _SMALL_DATA2_ = SIZEOF(CORE_SEC(.sdata2)) ? ADDR(CORE_SEC(.sdata2)) : 
(ADDR(CORE_SEC(.sdata2)) & 0xF0000000) + 32k ;
-    __A1_MEM = _SMALL_DATA2_;
+    __a1_mem = _SMALL_DATA2_;
 }
 
 CORE_ID = GLOBAL;
@@ -251,7 +258,7 @@ SECTIONS
     } > dspr
 
     _SMALL_DATA4_ = SIZEOF(CORE_SEC(.sdata4)) ? ADDR(CORE_SEC(.sdata4)) : 
(ADDR(CORE_SEC(.sdata4)) & 0xF0000000) + 32k ;
-    __A9_MEM = _SMALL_DATA4_;
+    __a9_mem = _SMALL_DATA4_;
 
     /*Relative A8 Addressable Const, selectable with patterns and user defined 
sections*/
     CORE_SEC(.sdata3) : FLAGS(arsl)
@@ -261,7 +268,7 @@ SECTIONS
     } > pfls
 
     _SMALL_DATA3_ = SIZEOF(CORE_SEC(.sdata3)) ? ADDR(CORE_SEC(.sdata3)) : 
(ADDR(CORE_SEC(.sdata3)) & 0xF0000000) + 32k ;
-    __A8_MEM = _SMALL_DATA3_;
+    __a8_mem = _SMALL_DATA3_;
 }
 
 /*kstack*/
@@ -326,8 +333,28 @@ SECTIONS
         *(.lmubss_cpu?.*)
         *(.gnu.linkonce.b.*)
     } > dspr
+
+    /* .data and .bss for the startup code in tricore_head, which copies and
+     * clears them as one block each, so the other data sections of this
+     * script have to stay empty
+     */
+
+    _data_flash = LOADADDR(.data);
+    _sdata = ADDR(.data);
+    _edata = ADDR(.data) + SIZEOF(.data);
+    _sbss = ADDR(.bss);
+    _ebss = ALIGN(ADDR(.bss) + SIZEOF(.bss), 4);
 }
 
+ASSERT(SIZEOF(.dspr_data) + SIZEOF(.zdata) + SIZEOF(.sdata) +
+       SIZEOF(.sdata4) + SIZEOF(.psram_text) == 0,
+       "initialized data outside .data, the startup does not copy it")
+ASSERT(SIZEOF(.dspr_bss) + SIZEOF(.zbss) + SIZEOF(.sbss) +
+       SIZEOF(.sbss4) == 0,
+       "zeroed data outside .bss, the startup does not clear it")
+ASSERT(_sdata % 4 == 0 && _sbss % 4 == 0 && _data_flash % 4 == 0,
+       ".data and .bss have to be word aligned")
+
 /*Heap*/
 CORE_ID = GLOBAL;
 SECTIONS
diff --git 
a/boards/tricore/tc3xx/a2g-tc397-5v-tft/scripts/Lcf_Tasking_Tricore_Tc.lsl.kernel
 
b/boards/tricore/tc3xx/a2g-tc397-5v-tft/scripts/Lcf_Tasking_Tricore_Tc.lsl.kernel
index 9548e61b687..4717ae736e9 100644
--- 
a/boards/tricore/tc3xx/a2g-tc397-5v-tft/scripts/Lcf_Tasking_Tricore_Tc.lsl.kernel
+++ 
b/boards/tricore/tc3xx/a2g-tc397-5v-tft/scripts/Lcf_Tasking_Tricore_Tc.lsl.kernel
@@ -179,7 +179,7 @@ derivative tc39
         start_address
         (
 #if CONFIG_CPU_COREID == 0
-            symbol = "_START"
+            symbol = "__start"
 #elif CONFIG_CPU_COREID == 1
             symbol = "_START1"
 #elif CONFIG_CPU_COREID == 2
@@ -226,14 +226,14 @@ derivative tc39
             {
                 stack "ustack_tc" (size = LCF_USTACK_SIZE);
             }
-            "__USTACK"= sizeof(group:ustack) > 0  ? "_lc_ue_ustack_tc" : 0;
+            "__ustack"= sizeof(group:ustack) > 0  ? "_lc_ue_ustack_tc" : 0;
             "__USTACK_END"="_lc_gb_ustack";
-            "__USTACK0":= "__USTACK";
-            "__USTACK1":= "__USTACK";
-            "__USTACK2":= "__USTACK";
-            "__USTACK3":= "__USTACK";
-            "__USTACK4":= "__USTACK";
-            "__USTACK5":= "__USTACK";
+            "__USTACK0":= "__ustack";
+            "__USTACK1":= "__ustack";
+            "__USTACK2":= "__ustack";
+            "__USTACK3":= "__ustack";
+            "__USTACK4":= "__ustack";
+            "__USTACK5":= "__ustack";
 
             group istack(align = 8, run_addr = mem:dsram[LCF_ISTACK_OFFSET])
             {
@@ -242,6 +242,7 @@ derivative tc39
             "__ISTACK"= sizeof(group:istack) > 0  ? "_lc_ue_istack_tc" : 0;
             "__ISTACK_END"="_lc_gb_istack";
             "__ISTACK0":="__ISTACK";
+            "__istack":="__ISTACK";
             "__ISTACK1":="__ISTACK";
             "__ISTACK2":="__ISTACK";
             "__ISTACK3":="__ISTACK";
@@ -254,22 +255,23 @@ derivative tc39
                 reserved "csa_tc" (size = LCF_CSA_SIZE);
             }
             "__CSA"= "_lc_ub_csa_tc";
-            "__CSA_END"= "_lc_ue_csa_tc";
+            "__csa_end"= "_lc_ue_csa_tc";
             "__CSA0":= "__CSA";
-            "__CSA0_END":= "__CSA_END";
+            "__csa_begin":= "__CSA";
+            "__CSA0_END":= "__csa_end";
             "__CSA1":= "__CSA";
-            "__CSA1_END":= "__CSA_END";
+            "__CSA1_END":= "__csa_end";
             "__CSA2":= "__CSA";
-            "__CSA2_END":= "__CSA_END";
+            "__CSA2_END":= "__csa_end";
             "__CSA3":= "__CSA";
-            "__CSA3_END":= "__CSA_END";
+            "__CSA3_END":= "__csa_end";
             "__CSA4":= "__CSA";
-            "__CSA4_END":= "__CSA_END";
+            "__CSA4_END":= "__csa_end";
             "__CSA5":= "__CSA";
-            "__CSA5_END":= "__CSA_END";
+            "__CSA5_END":= "__csa_end";
         }
 
-        /*Fixed memory Allocations for _START*/
+        /*Fixed memory Allocations for __start*/
         group (ordered)
         {
           group  interface_const (run_addr=mem:pfls[0x0020])
@@ -278,11 +280,15 @@ derivative tc39
           }
           "__IF_CONST" := addressof(group:interface_const);
           "__START0" := CORE0_PFLASH_KERNEL_START;
-          "__START1" := CORE1_PFLASH_KERNEL_START;
-          "__START2" := CORE2_PFLASH_KERNEL_START;
-          "__START3" := CORE3_PFLASH_KERNEL_START;
-          "__START4" := CORE4_PFLASH_KERNEL_START;
-          "__START5" := CORE5_PFLASH_KERNEL_START;
+
+          /* Boot stack of __start in the PSPR, as on TC4xx */
+
+          "__psram_ustack" := 0x7010eb00;
+          "__start1" := CORE1_PFLASH_KERNEL_START;
+          "__start2" := CORE2_PFLASH_KERNEL_START;
+          "__start3" := CORE3_PFLASH_KERNEL_START;
+          "__start4" := CORE4_PFLASH_KERNEL_START;
+          "__start5" := CORE5_PFLASH_KERNEL_START;
         }
 
         /*Fixed memory Allocations for Trap Vector Table*/
@@ -453,7 +459,7 @@ derivative tc39
             select "(.bss_a0|.bss_a0.*)";
         }
         "_SMALL_DATA_" := sizeof(group:a0) > 0 ? addressof(group:a0) : 
addressof(group:a0) & 0xF0000000 + 32k;
-        "__A0_MEM" = "_SMALL_DATA_";
+        "__a0_mem" = "_SMALL_DATA_";
 
         /*Relative A1 Addressable Const, selectable by toolchain*/
         /*Small constant sections, No option given for CPU specific user 
sections to make generated code portable across Cpus*/
@@ -464,7 +470,7 @@ derivative tc39
           select "(.rodata_a1|.rodata_a1.*)";
         }
         "_LITERAL_DATA_" := sizeof(group:a1) > 0 ? addressof(group:a1) : 
addressof(group:a1) & 0xF0000000 + 32k;
-        "__A1_MEM" = "_LITERAL_DATA_";
+        "__a1_mem" = "_LITERAL_DATA_";
 
         /*Relative A9 Addressable Data, selectable with patterns and user 
defined sections*/
         group a9 (ordered, align = 4, run_addr=mem:dsram)
@@ -475,7 +481,7 @@ derivative tc39
             select "(.bss_a9|.bss_a9.*)";
         }
         "_A9_DATA_" := sizeof(group:a9) > 0 ? addressof(group:a9) : 
addressof(group:a9) & 0xF0000000 + 32k;
-        "__A9_MEM" = "_A9_DATA_";
+        "__a9_mem" = "_A9_DATA_";
 
         /*Relative A8 Addressable Const, selectable with patterns and user 
defined sections*/
         group  a8 (ordered, align = 4, run_addr=mem:pfls)
@@ -484,7 +490,7 @@ derivative tc39
           select "(.rodata_a8|.rodata_a8.*)";
         }
         "_A8_DATA_" := sizeof(group:a8) > 0 ? addressof(group:a8) : 
addressof(group:a8) & 0xF0000000 + 32k;
-        "__A8_MEM" = "_A8_DATA_";
+        "__a8_mem" = "_A8_DATA_";
     }
 
     /*kstack ram*/
@@ -535,12 +541,6 @@ derivative tc39
         }
 
         /*LMU Data sections*/
-        group uncached_data(ordered, contiguous, align = 4, attributes=rw, 
run_addr = mem:dsram)
-        {
-            select "(.data.uncached.*)";
-            select "(.bss.uncached.*)";
-        }
-
         group (ordered, contiguous, align = 4, attributes=rw, 
run_addr=mem:dsram)
         {
             group lmubss(attributes=rw, nocopy)
@@ -548,13 +548,36 @@ derivative tc39
                 select "(.lmubss_cpu?|.lmubss_cpu?.*)";
             }
 
-            group data(attributes=rw)
+            /* .data and .bss as one block each, which the startup code in
+             * tricore_head copies and clears itself.  They also take the
+             * uncached sections of the atomic objects, as nothing here is
+             * mapped cached.
+             */
+
+            group data(ordered, contiguous, align = 4, attributes=rwu)
             {
                 select "(.data|.data.*)";
+            }
+
+            group bss(ordered, contiguous, align = 4, attributes=rwu)
+            {
                 select "(.bss|.bss.*)";
             }
         }
 
+        /* The ROM copies of .data, selected by name to get the order of RAM */
+
+        group data_rom(ordered, contiguous, align = 4, load_addr)
+        {
+            select "(.data|.data.*)";
+        }
+
+        "_data_flash" = "_lc_gb_data_rom";
+        "_sdata" = "_lc_gb_data";
+        "_edata" = "_lc_ge_data";
+        "_sbss" = "_lc_gb_bss";
+        "_ebss" = "_lc_ge_bss";
+
         /*Far Const Sections, selectable with patterns and user defined 
sections*/
         group
         {

Reply via email to