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 1125041658d42c7a554e5365f346eee8f526204a
Author: Saravanan Sekar <[email protected]>
AuthorDate: Fri Nov 6 19:59:40 2026 +0530

    arch/tricore: Start up TC4xx without the iLLD.
    
    Use the native startup of TC3xx on TC4xx.  tricore_head first disables
    the virtualization on the boot stack and CSA in the PSPR, then links the
    boot CSAs there and calls tricore_wdt_disable and tricore_ram_init
    before the CSA list in the DSPR.  tricore_ram_init clears the DSPR and
    DLMU of CPU0 with their SSH, unless UCB0_RAMINIT has the boot firmware
    initialize them, and the LMU and MCAN RAMs, which the boot firmware
    never initializes.  The iLLD key-off check, the watchdog reload values
    and the core0_main to core6_main entries of the iLLD per core startup
    go.
    
    Co-authored-by: Parthiban Nallathambi <[email protected]>
    Signed-off-by: Saravanan Sekar <[email protected]>
---
 arch/tricore/include/csfr.h                        |   1 +
 arch/tricore/src/common/CMakeLists.txt             |   8 +-
 arch/tricore/src/common/Make.defs                  |   2 -
 arch/tricore/src/common/gnu/tricore_head.S         |  89 +++++++++++-
 arch/tricore/src/common/tasking/tricore_head.asm   |  92 +++++++++++-
 arch/tricore/src/common/tricore_internal.h         |  20 +--
 arch/tricore/src/common/tricore_main.c             |  69 ++-------
 arch/tricore/src/tc4xx/CMakeLists.txt              |   8 +-
 arch/tricore/src/tc4xx/Make.defs                   |   4 +-
 arch/tricore/src/tc4xx/chip.h                      |  11 ++
 .../src/tc4xx/{chip.h => hardware/tc4xx_cpu.h}     |  29 ++--
 .../src/tc4xx/{chip.h => hardware/tc4xx_vmt.h}     |  45 +++---
 arch/tricore/src/tc4xx/tc4xx_clockconfig.c         |  35 ++++-
 arch/tricore/src/tc4xx/tc4xx_ram.c                 | 157 +++++++++++++++++++++
 .../scripts/Lcf_Gnuc_Tricore_Tc.lsl.kernel         |  57 ++++++--
 .../scripts/Lcf_Tasking_Tricore_Tc.lsl.kernel      |  84 +++++++----
 16 files changed, 540 insertions(+), 171 deletions(-)

diff --git a/arch/tricore/include/csfr.h b/arch/tricore/include/csfr.h
index 2a7817252db..f332ed456c4 100644
--- a/arch/tricore/include/csfr.h
+++ b/arch/tricore/include/csfr.h
@@ -48,6 +48,7 @@
 /* Core configuration (TC1.8 only) */
 
 #define TRICORE_CPU_CORECON         0xfe14  /* Core Control */
+#define TRICORE_CPU_VCON0           0xb000  /* Virtualization Control 0 */
 
 /* Performance counters */
 
diff --git a/arch/tricore/src/common/CMakeLists.txt 
b/arch/tricore/src/common/CMakeLists.txt
index 513ec44062c..8df66946505 100644
--- a/arch/tricore/src/common/CMakeLists.txt
+++ b/arch/tricore/src/common/CMakeLists.txt
@@ -85,14 +85,10 @@ 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()
+  target_sources(nuttx PRIVATE tasking/tricore_head.${ASMEXT})
 else()
   target_sources(nuttx PRIVATE gnu/tricore_vectors.${ASMEXT})
-  if(CONFIG_ARCH_CHIP_TC3XX)
-    target_sources(nuttx PRIVATE gnu/tricore_head.${ASMEXT})
-  endif()
+  target_sources(nuttx PRIVATE gnu/tricore_head.${ASMEXT})
 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 6a7e3ebf668..fc822436890 100644
--- a/arch/tricore/src/common/Make.defs
+++ b/arch/tricore/src/common/Make.defs
@@ -55,9 +55,7 @@ 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
index 7ebbc618156..be92cb48283 100644
--- a/arch/tricore/src/common/gnu/tricore_head.S
+++ b/arch/tricore/src/common/gnu/tricore_head.S
@@ -24,6 +24,7 @@
  * Included Files
  ****************************************************************************/
 
+#include <nuttx/config.h>
 #include <arch/csfr.h>
 
 /****************************************************************************
@@ -33,7 +34,12 @@
 #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 */
+#ifdef CONFIG_ARCH_CHIP_TC3XX
+#  define TC3XX_WDTCPU0_CON0 0xf003624c  /* CPU0 watchdog CON0, 0xc apart per 
CPU */
+#endif
+#ifdef CONFIG_ARCH_CHIP_TC4XX
+#  define TC4XX_PSW_VIRT   0xb00       /* PSW for disabling the virtualization 
*/
+#endif
 
 /* Make the CSA link word of the CSA address in addr: the segment in bits
  * 19:16 and the offset in bits 15:0.
@@ -63,6 +69,14 @@
  *   On TC3xx BTV, BIV, ISP, PCON0 and DCON0 are CPU ENDINIT protected,
  *   so the ENDINIT of the CPU watchdog is cleared around them.
  *
+ *   TC4xx first disables the virtualization with a call to
+ *   tricore_virt_off, on the boot stack and the single boot CSA in the
+ *   PSPR that the linker script gives, as the iLLD startup code does.
+ *   Then it links the boot CSAs in the PSPR and, before the DSPR that
+ *   holds the CSA list and the DLMU that holds .data and .bss are
+ *   initialized, disables the watchdogs and initializes the RAMs in C
+ *   (tricore_wdt_disable, tricore_ram_init).
+ *
  ****************************************************************************/
 
        .text
@@ -77,14 +91,61 @@ tricore_head:
        movh.a  %a9, hi:__a9_mem
        lea     %a9, [%a9]lo:__a9_mem
 
+#ifdef CONFIG_ARCH_CHIP_TC3XX
        jl      tc3xx_endinit_clear
 
+#endif
+       movh.a  %a15, hi:__TRAPTAB_CPU0
+       lea     %a15, [%a15]lo:__TRAPTAB_CPU0
+       mov.d   %d15, %a15
+       mtcr    TRICORE_CPU_BTV, %d15
+       isync
+
+#ifdef CONFIG_ARCH_CHIP_TC4XX
+       movh.a  %a15, hi:__psram_boot_csa
+       lea     %a15, [%a15]lo:__psram_boot_csa
+       mov.d   %d15, %a15
+       tricore_csa_link %d15, %d14, %d13
+       mtcr    TRICORE_CPU_FCX, %d15
+       isync
+
+       call    tricore_virt_off
+
        movh.a  %a15, hi:__TRAPTAB_CPU0
        lea     %a15, [%a15]lo:__TRAPTAB_CPU0
        mov.d   %d15, %a15
        mtcr    TRICORE_CPU_BTV, %d15
        isync
 
+       /* Free CSA list in the PSPR from __psram_boot_csa to
+        * __psram_boot_csa_end, LCX at the third last, for the C steps that
+        * run before the DSPR and the DLMU are initialized
+        */
+
+       movh.a  %a15, hi:__psram_boot_csa
+       lea     %a15, [%a15]lo:__psram_boot_csa
+       movh.a  %a14, hi:__psram_boot_csa_end
+       lea     %a14, [%a14]lo:__psram_boot_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
+
+       call    tricore_wdt_disable
+       call    tricore_ram_init
+
+#endif
        /* Caches on, interrupt vector, interrupt stack */
 
        mov     %d15, 0
@@ -128,8 +189,10 @@ tricore_head:
        mtcr    TRICORE_CPU_LCX, %d15
        isync
 
+#ifdef CONFIG_ARCH_CHIP_TC3XX
        jl      tc3xx_endinit_set
 
+#endif
        movh.a  %sp, hi:__ustack
        lea     %sp, [%sp]lo:__ustack
        dsync
@@ -138,8 +201,10 @@ tricore_head:
        mtcr    TRICORE_CPU_PSW, %d0
        isync
 
+#ifdef CONFIG_ARCH_CHIP_TC3XX
        call    tricore_wdt_disable
 
+#endif
        /* 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
         */
@@ -178,6 +243,7 @@ tricore_head:
        lea     %a15, [%a15]lo:tricore_start
        ji      %a15
 
+#ifdef CONFIG_ARCH_CHIP_TC3XX
 /****************************************************************************
  * Name: tc3xx_endinit_clear, tc3xx_endinit_set
  *
@@ -225,6 +291,27 @@ tc3xx_endinit_set:
        extr.u  %d15, %d15, 0, 1
        jne     %d15, %d5, 4b
        ji      %a11
+#endif
+
+#ifdef CONFIG_ARCH_CHIP_TC4XX
+/****************************************************************************
+ * Name: tricore_virt_off
+ *
+ * Description:
+ *   Disable the virtualization and return with rfh.
+ *
+ ****************************************************************************/
+
+       .type   tricore_virt_off, %function
+tricore_virt_off:
+       mov     %d0, 0
+       mtcr    TRICORE_CPU_VCON0, %d0
+       isync
+       mov     %d0, TC4XX_PSW_VIRT
+       mtcr    TRICORE_CPU_PSW, %d0
+       isync
+       rfh
+#endif
 
 /****************************************************************************
  * Public Functions
diff --git a/arch/tricore/src/common/tasking/tricore_head.asm 
b/arch/tricore/src/common/tasking/tricore_head.asm
index 9338603665f..2e6cbf9d270 100644
--- a/arch/tricore/src/common/tasking/tricore_head.asm
+++ b/arch/tricore/src/common/tasking/tricore_head.asm
@@ -24,6 +24,7 @@
  * Included Files
  ****************************************************************************/
 
+#include <nuttx/config.h>
 #include <arch/csfr.h>
 
 /****************************************************************************
@@ -33,7 +34,12 @@
 #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 */
+#ifdef CONFIG_ARCH_CHIP_TC3XX
+#  define TC3XX_WDTCPU0_CON0 0xf003624c  /* CPU0 watchdog CON0, 0xc apart per 
CPU */
+#endif
+#ifdef CONFIG_ARCH_CHIP_TC4XX
+#  define TC4XX_PSW_VIRT   0xb00       /* PSW for disabling the virtualization 
*/
+#endif
 
 /* Make the CSA link word of the CSA address in addr: the segment in bits
  * 19:16 and the offset in bits 15:0.
@@ -64,6 +70,11 @@ tricore_csa_link .macro addr, tmp1, tmp2
        .extern __TRAPTAB_CPU0
        .extern __INTTAB_CPU0
        .extern __psram_ustack
+#ifdef CONFIG_ARCH_CHIP_TC4XX
+       .extern __psram_boot_csa
+       .extern __psram_boot_csa_end
+       .extern tricore_ram_init
+#endif
 
 /****************************************************************************
  * Private Functions
@@ -83,6 +94,14 @@ tricore_csa_link .macro addr, tmp1, tmp2
  *   On TC3xx BTV, BIV, ISP, PCON0 and DCON0 are CPU ENDINIT protected,
  *   so the ENDINIT of the CPU watchdog is cleared around them.
  *
+ *   TC4xx first disables the virtualization with a call to
+ *   tricore_virt_off, on the boot stack and the single boot CSA in the
+ *   PSPR that the linker script gives, as the iLLD startup code does.
+ *   Then it links the boot CSAs in the PSPR and, before the DSPR that
+ *   holds the CSA list and the DLMU that holds .data and .bss are
+ *   initialized, disables the watchdogs and initializes the RAMs in C
+ *   (tricore_wdt_disable, tricore_ram_init).
+ *
  ****************************************************************************/
 
        .sdecl  ".text.tricore_head",code
@@ -97,14 +116,60 @@ tricore_head:
        movh.a  a9, #@HIS(__a9_mem)
        lea     a9, [a9]@LOS(__a9_mem)
 
+#ifdef CONFIG_ARCH_CHIP_TC3XX
        jl      tc3xx_endinit_clear
 
+#endif
        movh.a  a15, #@HIS(__TRAPTAB_CPU0)
        lea     a15, [a15]@LOS(__TRAPTAB_CPU0)
        mov.d   d15, a15
        mtcr    #TRICORE_CPU_BTV, d15
        isync
 
+#ifdef CONFIG_ARCH_CHIP_TC4XX
+       movh.a  a15, #@HIS(__psram_boot_csa)
+       lea     a15, [a15]@LOS(__psram_boot_csa)
+       mov.d   d15, a15
+       tricore_csa_link d15, d14, d13
+       mtcr    #TRICORE_CPU_FCX, d15
+       isync
+
+       call    tricore_virt_off
+
+       movh.a  a15, #@HIS(__TRAPTAB_CPU0)
+       lea     a15, [a15]@LOS(__TRAPTAB_CPU0)
+       mov.d   d15, a15
+       mtcr    #TRICORE_CPU_BTV, d15
+       isync
+
+       ; Free CSA list in the PSPR from __psram_boot_csa to
+       ; __psram_boot_csa_end, LCX at the third last, for the C steps that
+       ; run before the DSPR and the DLMU are initialized
+
+       movh.a  a15, #@HIS(__psram_boot_csa)
+       lea     a15, [a15]@LOS(__psram_boot_csa)
+       movh.a  a14, #@HIS(__psram_boot_csa_end)
+       lea     a14, [a14]@LOS(__psram_boot_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
+
+       call    tricore_wdt_disable
+       call    tricore_ram_init
+
+#endif
        ; Caches on, interrupt vector, interrupt stack
 
        mov     d15, #0
@@ -148,8 +213,10 @@ tricore_head:
        mtcr    #TRICORE_CPU_LCX, d15
        isync
 
+#ifdef CONFIG_ARCH_CHIP_TC3XX
        jl      tc3xx_endinit_set
 
+#endif
        movh.a  a10, #@HIS(__ustack)
        lea     a10, [a10]@LOS(__ustack)
        dsync
@@ -158,8 +225,10 @@ tricore_head:
        mtcr    #TRICORE_CPU_PSW, d0
        isync
 
+#ifdef CONFIG_ARCH_CHIP_TC3XX
        call    tricore_wdt_disable
 
+#endif
        ; 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
 
@@ -197,6 +266,7 @@ tricore_head:
        lea     a15, [a15]@LOS(tricore_start)
        ji      a15
 
+#ifdef CONFIG_ARCH_CHIP_TC3XX
 /****************************************************************************
  * Name: tc3xx_endinit_clear, tc3xx_endinit_set
  *
@@ -241,6 +311,26 @@ tc3xx_endinit_set:
        extr.u  d15, d15, #0, #1
        jne     d15, d5, 4p
        ji      a11
+#endif
+
+#ifdef CONFIG_ARCH_CHIP_TC4XX
+/****************************************************************************
+ * Name: tricore_virt_off
+ *
+ * Description:
+ *   Disable the virtualization and return with rfh.
+ *
+ ****************************************************************************/
+
+tricore_virt_off:
+       mov     d0, #0
+       mtcr    #TRICORE_CPU_VCON0, d0
+       isync
+       mov     d0, #TC4XX_PSW_VIRT
+       mtcr    #TRICORE_CPU_PSW, d0
+       isync
+       rfh
+#endif
 
 /****************************************************************************
  * Public Functions
diff --git a/arch/tricore/src/common/tricore_internal.h 
b/arch/tricore/src/common/tricore_internal.h
index 585a4be05f1..352c313d739 100644
--- a/arch/tricore/src/common/tricore_internal.h
+++ b/arch/tricore/src/common/tricore_internal.h
@@ -155,17 +155,15 @@ struct tricore_trap_s
  * end of the heap is CONFIG_RAM_END
  */
 
-extern uintptr_t        __USTACK0_END[];
-extern uintptr_t        __USTACK0[];
-#define g_idle_topstack __USTACK0
+extern uintptr_t        __ustack[];
+#define g_idle_topstack __ustack
 
 /* Address of the saved user stack pointer */
 
 #if CONFIG_ARCH_INTERRUPTSTACK > 3
-extern uintptr_t        __ISTACK0_END[];
-extern uintptr_t        __ISTACK0[];
-#define g_intstackalloc __ISTACK0_END
-#define g_intstacktop   __ISTACK0
+extern uintptr_t        __istack[];
+#define g_intstackalloc ((uintptr_t)__istack - CONFIG_ARCH_INTERRUPTSTACK)
+#define g_intstacktop   __istack
 #endif
 
 /* These symbols are setup by the linker script. */
@@ -195,12 +193,14 @@ void tricore_doirq(void);
 /* Startup ******************************************************************/
 
 /* 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.
+ * clears .bss itself before tricore_clockconfig.  tricore_wdt_disable and
+ * tricore_ram_init (TC4xx only) run before .data and .bss, on TC4xx on the
+ * boot stack and CSAs in the PSPR: they may only use registers and
+ * constants.
  */
 
 void tricore_wdt_disable(void);    /* Chip: CPU and safety watchdogs off */
+void tricore_ram_init(void);       /* Chip: RAMs the boot firmware skips */
 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 */
diff --git a/arch/tricore/src/common/tricore_main.c 
b/arch/tricore/src/common/tricore_main.c
index 46cd1e42d8d..9fe44594d1e 100644
--- a/arch/tricore/src/common/tricore_main.c
+++ b/arch/tricore/src/common/tricore_main.c
@@ -40,28 +40,22 @@
  * Public Data
  ****************************************************************************/
 
-/* Entries of the other cores, provided by the linker script; TC4xx still
- * starts from the iLLD startup code
- */
+/* Entries of the other cores, provided by the linker script */
 
-#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
@@ -106,6 +100,19 @@ static void tricore_core_sync(volatile uint32_t *sync)
     }
 }
 
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: tricore_main
+ *
+ * Description:
+ *   Entry into NuttX, called by tricore_start on CPU0: initialize the FPU
+ *   and the MPU, wait for the other cores and start NuttX.
+ *
+ ****************************************************************************/
+
 void tricore_main(void)
 {
   static volatile uint32_t g_sync_event;
@@ -138,11 +145,6 @@ void tricore_main(void)
   while (1);
 }
 
-/****************************************************************************
- * Public Functions
- ****************************************************************************/
-
-#ifdef CONFIG_ARCH_CHIP_TC3XX
 /****************************************************************************
  * Name: tricore_start
  *
@@ -174,46 +176,3 @@ void tricore_start(void)
 
   tricore_main();
 }
-#endif
-
-void core0_main(void)
-{
-  /* All WDTs except WDTCPU0 and system watchdog WDTSYS are in
-   * disabled mode after Boot-FW execution. Disable the watchdog
-   * to ensure the normal startup of the system.
-   */
-
-  tricore_wdt_disable();
-
-  tricore_main();
-}
-
-void core1_main(void)
-{
-  tricore_main();
-}
-
-void core2_main(void)
-{
-  tricore_main();
-}
-
-void core3_main(void)
-{
-  tricore_main();
-}
-
-void core4_main(void)
-{
-  tricore_main();
-}
-
-void core5_main(void)
-{
-  tricore_main();
-}
-
-void core6_main(void)
-{
-  tricore_main();
-}
diff --git a/arch/tricore/src/tc4xx/CMakeLists.txt 
b/arch/tricore/src/tc4xx/CMakeLists.txt
index 204224f0811..cb692ddbff0 100644
--- a/arch/tricore/src/tc4xx/CMakeLists.txt
+++ b/arch/tricore/src/tc4xx/CMakeLists.txt
@@ -20,7 +20,8 @@
 #
 # 
##############################################################################
 
-set(SRCS tc4xx_timerisr.c tc4xx_serial.c tc4xx_wdt.c tc4xx_clockconfig.c)
+set(SRCS tc4xx_timerisr.c tc4xx_serial.c tc4xx_wdt.c tc4xx_clockconfig.c
+         tc4xx_ram.c)
 
 target_sources(arch PRIVATE ${SRCS})
 
@@ -141,7 +142,6 @@ set_property(
   PROPERTY NUTTX_INCLUDE_DIRECTORIES ${SDK_INCDIR})
 
 set(SDK_CSRCS
-    "${CONFIG_DIR}/Ifx_Cfg_Ssw.c"
     "${ILLD_DIR}/Libraries/iLLD/TC4xx/CpuGeneric/_Impl/IfxAp_cfg.c"
     "${ILLD_DIR}/Libraries/iLLD/TC4xx/CpuGeneric/_Impl/IfxDma_cfg.c"
     "${ILLD_DIR}/Libraries/iLLD/TC4xx/CpuGeneric/_Impl/IfxAsclin_cfg.c"
@@ -162,9 +162,7 @@ set(SDK_CSRCS
     "${ILLD_DIR}/Libraries/iLLD/TC4xx/Tricore/Smu/Std/IfxSmu.c"
     "${ILLD_DIR}/Libraries/iLLD/TC4xx/Tricore/Vmt/Std/IfxVmt.c"
     "${ILLD_DIR}/Libraries/iLLD/TC4xx/Tricore/Wtu/Std/IfxWtu.c"
-    "${ILLD_DIR}/Libraries/Infra/Platform/Compilers/CompilerTasking.c"
-    "${ILLD_DIR}/Libraries/Infra/Ssw/TC4xx/Tricore/Ifx_Ssw_Infra.c"
-    "${ILLD_DIR}/Libraries/Infra/Ssw/TC4xx/Tricore/Ifx_Ssw_Tc0.c")
+    "${ILLD_DIR}/Libraries/Infra/Platform/Compilers/CompilerTasking.c")
 
 target_sources(nuttx PRIVATE ${SDK_CSRCS})
 
diff --git a/arch/tricore/src/tc4xx/Make.defs b/arch/tricore/src/tc4xx/Make.defs
index 9bb6e47d2e4..dffbd33dab7 100644
--- a/arch/tricore/src/tc4xx/Make.defs
+++ b/arch/tricore/src/tc4xx/Make.defs
@@ -24,6 +24,7 @@ CHIP_CSRCS += tc4xx_timerisr.c
 CHIP_CSRCS += tc4xx_serial.c
 CHIP_CSRCS += tc4xx_wdt.c
 CHIP_CSRCS += tc4xx_clockconfig.c
+CHIP_CSRCS += tc4xx_ram.c
 
 ifeq ($(CONFIG_BUILD_PROTECTED),y)
   CHIP_UCSRCS += tc4d9_userspace.c
@@ -125,7 +126,6 @@ SDK_INCDIR += $(ILLD_DIR)/Libraries/Infra/Ssw/TC4xx/Tricore
 SDK_INCDIR += $(ILLD_DIR)/Libraries/Service/CpuGeneric
 SDK_INCDIR += $(ILLD_DIR)/Libraries/Infra/Platform/Compilers
 
-SDK_CSRCS += $(CONFIG_DIR)/Ifx_Cfg_Ssw.c
 SDK_CSRCS += $(ILLD_DIR)/Libraries/iLLD/TC4xx/CpuGeneric/_Impl/IfxAp_cfg.c
 SDK_CSRCS += $(ILLD_DIR)/Libraries/iLLD/TC4xx/CpuGeneric/_Impl/IfxDma_cfg.c
 SDK_CSRCS += $(ILLD_DIR)/Libraries/iLLD/TC4xx/CpuGeneric/_Impl/IfxAsclin_cfg.c
@@ -147,8 +147,6 @@ SDK_CSRCS += 
$(ILLD_DIR)/Libraries/iLLD/TC4xx/Tricore/Smu/Std/IfxSmu.c
 SDK_CSRCS += $(ILLD_DIR)/Libraries/iLLD/TC4xx/Tricore/Vmt/Std/IfxVmt.c
 SDK_CSRCS += $(ILLD_DIR)/Libraries/iLLD/TC4xx/Tricore/Wtu/Std/IfxWtu.c
 SDK_CSRCS += $(ILLD_DIR)/Libraries/Infra/Platform/Compilers/CompilerTasking.c
-SDK_CSRCS += $(ILLD_DIR)/Libraries/Infra/Ssw/TC4xx/Tricore/Ifx_Ssw_Infra.c
-SDK_CSRCS += $(ILLD_DIR)/Libraries/Infra/Ssw/TC4xx/Tricore/Ifx_Ssw_Tc0.c
 
 CFLAGS += $(addprefix ${INCDIR_PREFIX},$(SDK_INCDIR))
 
diff --git a/arch/tricore/src/tc4xx/chip.h b/arch/tricore/src/tc4xx/chip.h
index b0fa63f02a2..f71fd86c544 100644
--- a/arch/tricore/src/tc4xx/chip.h
+++ b/arch/tricore/src/tc4xx/chip.h
@@ -27,6 +27,8 @@
  * Included Files
  ****************************************************************************/
 
+#include "hardware/tc4xx_cpu.h"
+
 #define UART_PIN_RX IfxAsclin0_RXA_F_P14_1_IN     /* UART receive port pin  */
 #define UART_PIN_TX IfxAsclin0_TX_F_P14_0_OUT     /* UART transmit port pin */
 
@@ -41,6 +43,15 @@
 #define TRICORE_CORE_SYNC_MASK     0x01
 #define TRICORE_CORE_SYNC_TIMEOUT  0
 
+/* Other cores that tricore_start releases, CPU1 to CPU5, and their PC and
+ * boot halt registers
+ */
+
+#define TRICORE_START_CORES        5
+#define TRICORE_START_PC(n)        TC4XX_CPU_HRA_PC(n)
+#define TRICORE_START_HALT(n)      TC4XX_CPU_HRA_BOOTCON(n)
+#define TRICORE_START_BHALT        TC4XX_BOOTCON_BHALT
+
 /* Core index from CORE_ID */
 
 #define tricore_core_id()          (tricore_mfcr(TRICORE_CPU_CORE_ID) & 0x7)
diff --git a/arch/tricore/src/tc4xx/chip.h 
b/arch/tricore/src/tc4xx/hardware/tc4xx_cpu.h
similarity index 58%
copy from arch/tricore/src/tc4xx/chip.h
copy to arch/tricore/src/tc4xx/hardware/tc4xx_cpu.h
index b0fa63f02a2..d928773c162 100644
--- a/arch/tricore/src/tc4xx/chip.h
+++ b/arch/tricore/src/tc4xx/hardware/tc4xx_cpu.h
@@ -1,5 +1,5 @@
 /****************************************************************************
- * arch/tricore/src/tc4xx/chip.h
+ * arch/tricore/src/tc4xx/hardware/tc4xx_cpu.h
  *
  * SPDX-License-Identifier: Apache-2.0
  *
@@ -20,30 +20,17 @@
  *
  ****************************************************************************/
 
-#ifndef __ARCH_TRICORE_SRC_TC4XX_CHIP_H
-#define __ARCH_TRICORE_SRC_TC4XX_CHIP_H
-
-/****************************************************************************
- * Included Files
- ****************************************************************************/
-
-#define UART_PIN_RX IfxAsclin0_RXA_F_P14_1_IN     /* UART receive port pin  */
-#define UART_PIN_TX IfxAsclin0_TX_F_P14_0_OUT     /* UART transmit port pin */
+#ifndef __ARCH_TRICORE_SRC_TC4XX_HARDWARE_TC4XX_CPU_H
+#define __ARCH_TRICORE_SRC_TC4XX_HARDWARE_TC4XX_CPU_H
 
 /****************************************************************************
  * Pre-processor Definitions
  ****************************************************************************/
 
-/* Startup core synchronization: core ID bits to wait for and the timeout
- * in STM ticks (0: no timeout)
- */
-
-#define TRICORE_CORE_SYNC_MASK     0x01
-#define TRICORE_CORE_SYNC_TIMEOUT  0
-
-/* Core index from CORE_ID */
+/* Start of the other cores: HRA PC and BOOTCON.BHALT of each CPU */
 
-#define tricore_core_id()          (tricore_mfcr(TRICORE_CPU_CORE_ID) & 0x7)
-#define tricore_core_index()       tricore_core_id()
+#define TC4XX_CPU_HRA_PC(n)        (0xf881fe08 + (n) * 0x40000)
+#define TC4XX_CPU_HRA_BOOTCON(n)   (0xf881fe60 + (n) * 0x40000)
+#define TC4XX_BOOTCON_BHALT        (1 << 0)
 
-#endif /* __ARCH_TRICORE_SRC_TC4XX_CHIP_H */
+#endif /* __ARCH_TRICORE_SRC_TC4XX_HARDWARE_TC4XX_CPU_H */
diff --git a/arch/tricore/src/tc4xx/chip.h 
b/arch/tricore/src/tc4xx/hardware/tc4xx_vmt.h
similarity index 56%
copy from arch/tricore/src/tc4xx/chip.h
copy to arch/tricore/src/tc4xx/hardware/tc4xx_vmt.h
index b0fa63f02a2..f0cb2faa064 100644
--- a/arch/tricore/src/tc4xx/chip.h
+++ b/arch/tricore/src/tc4xx/hardware/tc4xx_vmt.h
@@ -1,5 +1,5 @@
 /****************************************************************************
- * arch/tricore/src/tc4xx/chip.h
+ * arch/tricore/src/tc4xx/hardware/tc4xx_vmt.h
  *
  * SPDX-License-Identifier: Apache-2.0
  *
@@ -20,30 +20,29 @@
  *
  ****************************************************************************/
 
-#ifndef __ARCH_TRICORE_SRC_TC4XX_CHIP_H
-#define __ARCH_TRICORE_SRC_TC4XX_CHIP_H
-
-/****************************************************************************
- * Included Files
- ****************************************************************************/
-
-#define UART_PIN_RX IfxAsclin0_RXA_F_P14_1_IN     /* UART receive port pin  */
-#define UART_PIN_TX IfxAsclin0_TX_F_P14_0_OUT     /* UART transmit port pin */
+#ifndef __ARCH_TRICORE_SRC_TC4XX_HARDWARE_TC4XX_VMT_H
+#define __ARCH_TRICORE_SRC_TC4XX_HARDWARE_TC4XX_VMT_H
 
 /****************************************************************************
  * Pre-processor Definitions
  ****************************************************************************/
 
-/* Startup core synchronization: core ID bits to wait for and the timeout
- * in STM ticks (0: no timeout)
- */
-
-#define TRICORE_CORE_SYNC_MASK     0x01
-#define TRICORE_CORE_SYNC_TIMEOUT  0
-
-/* Core index from CORE_ID */
-
-#define tricore_core_id()          (tricore_mfcr(TRICORE_CPU_CORE_ID) & 0x7)
-#define tricore_core_index()       tricore_core_id()
-
-#endif /* __ARCH_TRICORE_SRC_TC4XX_CHIP_H */
+/* Volatile memory test (VMT) module and its MBIST controllers */
+
+#define TC4XX_VMT_BASE             0xf0400000
+#define TC4XX_VMT_SIZE             0x20000
+#define TC4XX_VMT_CLC              0x0
+#define TC4XX_VMT_CLC_DISS         (1 << 1)
+#define TC4XX_VMT_MEMTEST          0x80
+#define TC4XX_VMT_MEMSTAT          0x88
+#define TC4XX_VMT_MEMDONE          0x8c
+#define TC4XX_VMT_MC(n)            (0x1000 + (n) * 0x200)
+#define TC4XX_VMT_MC_CONFIG0       0x00
+#define TC4XX_VMT_MC_CONFIG1       0x04
+#define TC4XX_VMT_MC_MCONTROL      0x0c
+#define TC4XX_VMT_MC_RANGE         0x14
+#define TC4XX_VMT_MC_ALMSRCS       0x1d0
+
+#define TC4XX_ALMSRCS_ALARMS       ((1 << 5) | (1 << 4))  /* MISCE, OPENE */
+
+#endif /* __ARCH_TRICORE_SRC_TC4XX_HARDWARE_TC4XX_VMT_H */
diff --git a/arch/tricore/src/tc4xx/tc4xx_clockconfig.c 
b/arch/tricore/src/tc4xx/tc4xx_clockconfig.c
index 1d153134e37..4f2726c7128 100644
--- a/arch/tricore/src/tc4xx/tc4xx_clockconfig.c
+++ b/arch/tricore/src/tc4xx/tc4xx_clockconfig.c
@@ -426,6 +426,33 @@ static int tc4xx_clock_switch(void)
   return ret;
 }
 
+/****************************************************************************
+ * Name: tc4xx_osc_power_on
+ *
+ * Description:
+ *   Power up the crystal oscillator in external crystal mode, as the
+ *   iLLD startup code does before the clock setup.
+ *
+ ****************************************************************************/
+
+static void tc4xx_osc_power_on(void)
+{
+  uint32_t regval = getreg32(TC4XX_CLOCK_OSCCON) & ~TC4XX_OSCCON_MODE_MASK;
+  uint32_t count = TC4XX_CCU_LCK_TIMEOUT;
+
+  while ((getreg32(TC4XX_CLOCK_CCUSTAT) & TC4XX_CCUSTAT_LCK) != 0)
+    {
+      if (--count == 0)
+        {
+          putreg32(regval, TC4XX_CLOCK_OSCCON);
+          __asm__ __volatile__ ("debug");
+          return;
+        }
+    }
+
+  putreg32(regval, TC4XX_CLOCK_OSCCON);
+}
+
 /****************************************************************************
  * Public Functions
  ****************************************************************************/
@@ -434,9 +461,9 @@ static int tc4xx_clock_switch(void)
  * Name: tricore_clockconfig
  *
  * Description:
- *   Set up the flash wait states, the clock distribution, the oscillators
- *   and the PLLs.  Called by the startup code before the C runtime is
- *   initialized, so it may only use constant data.
+ *   Power up the crystal, then set up the flash wait states, the clock
+ *   distribution, the oscillators and the PLLs.  Called by the startup code
+ *   once .data and .bss are initialized.
  *
  * Returned Value:
  *   0 on success, 1 if a wait for the hardware gave up.
@@ -448,6 +475,8 @@ int tricore_clockconfig(void)
   int ret;
   int pll;
 
+  tc4xx_osc_power_on();
+
   ret = tc4xx_clock_distribute();
   if (ret != 0)
     {
diff --git a/arch/tricore/src/tc4xx/tc4xx_ram.c 
b/arch/tricore/src/tc4xx/tc4xx_ram.c
new file mode 100644
index 00000000000..48e31814a46
--- /dev/null
+++ b/arch/tricore/src/tc4xx/tc4xx_ram.c
@@ -0,0 +1,157 @@
+/****************************************************************************
+ * arch/tricore/src/tc4xx/tc4xx_ram.c
+ *
+ * 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 <nuttx/config.h>
+
+#include <stdint.h>
+
+#include <sys/param.h>
+
+#include "tricore_internal.h"
+#include "hardware/tc4xx_vmt.h"
+
+/****************************************************************************
+ * Pre-processor Definitions
+ ****************************************************************************/
+
+/* SRAMs that the boot firmware initializes after a power-on reset */
+
+#define TC4XX_UCB0_RAMINIT          0xae408814
+#define TC4XX_RAMIN_MASK            (0x3 << 0)  /* 0: warm and cold PORST */
+#define TC4XX_RAMINSEL_CPU0         (1 << 16)   /* Set: not the CPU0 SRAMs */
+#define TC4XX_LMUINSEL_CPU0         (1 << 24)   /* Set: not the CPU0 DLMU */
+
+/* SSH (MBIST controller) selectors of the DSPR and the DLMU of CPU0 */
+
+#define TC4XX_SSH_CPU0_DSPR         0
+#define TC4XX_SSH_CPU0_DLMU         4
+
+/****************************************************************************
+ * Private Data
+ ****************************************************************************/
+
+/* SSH selectors of the LMU0-9 and MCAN0-4 RAMs, which the boot firmware
+ * never initializes
+ */
+
+static const uint8_t g_tc4xx_sram[] =
+{
+  0x17, 0x18, 0x20, 0x21, 0x19, 0x1a, 0x1b, 0x22, 0x23, 0x24, /* LMU0-9 */
+  0xa2, 0xa3, 0xa4, 0xa5, 0xa6                                /* MCAN0-4 */
+};
+
+/****************************************************************************
+ * Private Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: tc4xx_sram_clear
+ *
+ * Description:
+ *   Fill a whole SRAM with ECC correct zeros through its SSH, with
+ *   MCONTROL.SRAM_CLR, as IfxVmt_clearSram does.
+ *
+ ****************************************************************************/
+
+static void tc4xx_sram_clear(uint32_t sel)
+{
+  uintptr_t vmt = TC4XX_VMT_BASE + (sel >> 5) * TC4XX_VMT_SIZE;
+  uintptr_t mc = vmt + TC4XX_VMT_MC(sel % 32);
+  uint32_t mask = 1 << (sel % 32);
+
+  if ((getreg32(vmt + TC4XX_VMT_CLC) & TC4XX_VMT_CLC_DISS) != 0)
+    {
+      putreg32(0, vmt + TC4XX_VMT_CLC);
+    }
+
+  /* Enable the MBIST shell and start the clear */
+
+  putreg32(getreg32(mc + TC4XX_VMT_MC_ALMSRCS) & ~TC4XX_ALMSRCS_ALARMS,
+           mc + TC4XX_VMT_MC_ALMSRCS);
+  putreg32(getreg32(vmt + TC4XX_VMT_MEMTEST) | mask,
+           vmt + TC4XX_VMT_MEMTEST);
+  while ((getreg32(vmt + TC4XX_VMT_MEMSTAT) & mask) != 0);
+
+  putreg32((1 << 15) | (1 << 0), mc + TC4XX_VMT_MC_MCONTROL);
+  putreg32(getreg32(mc + TC4XX_VMT_MC_MCONTROL) & ~(1 << 0),
+           mc + TC4XX_VMT_MC_MCONTROL);
+  while ((getreg32(vmt + TC4XX_VMT_MEMDONE) & mask) == 0);
+
+  /* Read address 0 once, then disable the MBIST shell again */
+
+  putreg32(1 << 3, mc + TC4XX_VMT_MC_MCONTROL);
+  putreg32((1 << 12) | (1 << 0), mc + TC4XX_VMT_MC_CONFIG0);
+  putreg32(0, mc + TC4XX_VMT_MC_CONFIG1);
+  putreg32(0, mc + TC4XX_VMT_MC_RANGE);
+  putreg32((1 << 3) | (1 << 0), mc + TC4XX_VMT_MC_MCONTROL);
+  putreg32(1 << 3, mc + TC4XX_VMT_MC_MCONTROL);
+  while ((getreg32(vmt + TC4XX_VMT_MEMDONE) & mask) == 0);
+
+  putreg32(getreg32(vmt + TC4XX_VMT_MEMTEST) & ~mask,
+           vmt + TC4XX_VMT_MEMTEST);
+  while ((getreg32(vmt + TC4XX_VMT_MEMSTAT) & mask) != 0);
+  putreg32(getreg32(mc + TC4XX_VMT_MC_ALMSRCS) | TC4XX_ALMSRCS_ALARMS,
+           mc + TC4XX_VMT_MC_ALMSRCS);
+}
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: tricore_ram_init
+ *
+ * Description:
+ *   Initialize the RAMs that the boot firmware leaves uninitialized, so
+ *   that they can be read before they are written: the DSPR and the DLMU of
+ *   CPU0 unless UCB0_RAMINIT has the boot firmware initialize them after
+ *   every power-on reset, and the LMU and MCAN RAMs.  tricore_head calls it
+ *   on the boot stack and CSAs in the PSPR, before the CSA list in the DSPR
+ *   and before .data and .bss.
+ *
+ ****************************************************************************/
+
+void tricore_ram_init(void)
+{
+  uint32_t raminit = getreg32(TC4XX_UCB0_RAMINIT);
+  uint32_t partial = raminit & TC4XX_RAMIN_MASK;
+  int i;
+
+  if (partial != 0 || (raminit & TC4XX_RAMINSEL_CPU0) != 0)
+    {
+      tc4xx_sram_clear(TC4XX_SSH_CPU0_DSPR);
+    }
+
+  if (partial != 0 || (raminit & TC4XX_LMUINSEL_CPU0) != 0)
+    {
+      tc4xx_sram_clear(TC4XX_SSH_CPU0_DLMU);
+    }
+
+  for (i = 0; i < nitems(g_tc4xx_sram); i++)
+    {
+      tc4xx_sram_clear(g_tc4xx_sram[i]);
+    }
+}
diff --git 
a/boards/tricore/tc4xx/triboard_tc4x9_com/scripts/Lcf_Gnuc_Tricore_Tc.lsl.kernel
 
b/boards/tricore/tc4xx/triboard_tc4x9_com/scripts/Lcf_Gnuc_Tricore_Tc.lsl.kernel
index 004dba06454..1bd5d009007 100644
--- 
a/boards/tricore/tc4xx/triboard_tc4x9_com/scripts/Lcf_Gnuc_Tricore_Tc.lsl.kernel
+++ 
b/boards/tricore/tc4xx/triboard_tc4x9_com/scripts/Lcf_Gnuc_Tricore_Tc.lsl.kernel
@@ -36,11 +36,19 @@
 OUTPUT_FORMAT("elf32-tricore")
 OUTPUT_ARCH("tricore")
 #if CONFIG_CPU_COREID == 0
-ENTRY(_START)
+ENTRY(__start)
 #endif
 
 __TRICORE_DERIVATE_MEMORY_MAP__ = 0x490;
 
+/* Boot stack and single boot CSA in the PSPR, which the startup code uses
+ * to disable the virtualization before it links the CSAs
+ */
+
+__psram_ustack       = 0x7010eb00;
+__psram_boot_csa     = 0x7010ec00;
+__psram_boot_csa_end = 0x7010fc00;
+
 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);
@@ -116,7 +124,7 @@ SECTIONS
         PROVIDE(__USTACK_END = .);
         PROVIDE(COREID_MID(__USTACK, _END) = .);
         . = . + LCF_USTACK_SIZE;
-        PROVIDE(__USTACK = .);
+        PROVIDE(__ustack = .);
         PROVIDE(COREID_LST(__USTACK) = .);
     }
 
@@ -126,17 +134,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
 {
@@ -172,15 +183,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*/
@@ -227,7 +238,7 @@ SECTIONS
         *(.sbss.*)
     } > cpu_dlmu
     _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;
@@ -242,7 +253,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;
@@ -263,7 +274,7 @@ SECTIONS
     } > cpu_dlmu
 
     _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)
@@ -273,7 +284,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*/
@@ -340,8 +351,28 @@ SECTIONS
         *(.lmubss_cpu?.*)
         *(.gnu.linkonce.b.*)
     } > cpu_dlmu
+
+    /* .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/tc4xx/triboard_tc4x9_com/scripts/Lcf_Tasking_Tricore_Tc.lsl.kernel
 
b/boards/tricore/tc4xx/triboard_tc4x9_com/scripts/Lcf_Tasking_Tricore_Tc.lsl.kernel
index 756f979c636..cca081f45da 100644
--- 
a/boards/tricore/tc4xx/triboard_tc4x9_com/scripts/Lcf_Tasking_Tricore_Tc.lsl.kernel
+++ 
b/boards/tricore/tc4xx/triboard_tc4x9_com/scripts/Lcf_Tasking_Tricore_Tc.lsl.kernel
@@ -198,7 +198,7 @@ derivative tc4D
         start_address
         (
 #if CONFIG_CPU_COREID == 0
-            symbol = "_START"
+            symbol = "__start"
 #elif CONFIG_CPU_COREID == 1
             symbol = "_START1"
 #elif CONFIG_CPU_COREID == 2
@@ -245,7 +245,7 @@ derivative tc4D
             {
                 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_END"="_lc_gb_ustack";
             "__USTACK1_END"="_lc_gb_ustack";
@@ -253,12 +253,12 @@ derivative tc4D
             "__USTACK3_END"="_lc_gb_ustack";
             "__USTACK4_END"="_lc_gb_ustack";
             "__USTACK5_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])
             {
@@ -268,6 +268,7 @@ derivative tc4D
             "__ISTACK_END"="_lc_gb_istack";
             "__ISTACK0_END"="_lc_gb_istack";
             "__ISTACK0":="__ISTACK";
+            "__istack":="__ISTACK";
             "__ISTACK1":="__ISTACK";
             "__ISTACK2":="__ISTACK";
             "__ISTACK3":="__ISTACK";
@@ -279,12 +280,13 @@ derivative tc4D
                 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";
         }
 
-        /*Fixed memory Allocations for _START*/
+        /*Fixed memory Allocations for __start*/
         group (ordered)
         {
           group  interface_const (run_addr=mem:pfls[0x0020])
@@ -293,11 +295,20 @@ derivative tc4D
           }
           "__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 and single boot CSA in the PSPR, which the startup
+           * code uses to disable the virtualization before it links the
+           * CSAs
+           */
+
+          "__psram_ustack" := 0x7010eb00;
+          "__psram_boot_csa" := 0x7010ec00;
+          "__psram_boot_csa_end" := 0x7010fc00;
+          "__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*/
@@ -468,7 +479,7 @@ derivative tc4D
             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*/
@@ -479,7 +490,7 @@ derivative tc4D
           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)
@@ -490,7 +501,7 @@ derivative tc4D
             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)
@@ -499,7 +510,7 @@ derivative tc4D
           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*/
@@ -556,12 +567,6 @@ derivative tc4D
         }
 
         /*LMU Data sections*/
-        group uncached_data(ordered, contiguous, align = 4, attributes=rw, 
run_addr = mem:cpu_dlmu/not_cached)
-        {
-            select "(.data.uncached.*)";
-            select "(.bss.uncached.*)";
-        }
-
         group (ordered, contiguous, align = 4, attributes=rw, 
run_addr=mem:cpu_dlmu)
         {
             group lmubss(attributes=rw, nocopy)
@@ -569,9 +574,19 @@ derivative tc4D
                 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.*)";
             }
 
@@ -580,10 +595,23 @@ derivative tc4D
             {
                 heap "heap2" (size = LCF_HEAP_SIZE);
             }
-            "__DLMUHEAP":="_lc_ge_data";
+            "__DLMUHEAP":="_lc_ge_bss";
             "__DLMUHEAP_END":=LCF_DLMU_KERNEL_START + LCF_DLMU_KERNEL_SIZE;
         }
 
+        /* 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