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 b664cc035c4d47b237efd31a5b75550b7af6816b Author: Saravanan Sekar <[email protected]> AuthorDate: Tue Nov 17 10:36:54 2026 +0530 boards/tricore: Replace the iLLD GNU linker scripts. The iLLD example scripts map all six cores and place sections that NuttX does not use. Replace them with tricore.ld, a CPU0 map with the vectors at the same addresses, the CSA and the stacks at the top of the DSPR and the symbols of the native startup. The CMake side of the script selection is in src/CMakeLists.txt, which changes with it [skip-cmake-parity]. Signed-off-by: Saravanan Sekar <[email protected]> --- .../scripts/Lcf_Gnuc_Tricore_Tc.lsl.kernel | 581 ------------------- .../tc3xx/a2g-tc397-5v-tft/scripts/Make.defs | 12 +- .../tc3xx/a2g-tc397-5v-tft/scripts/tricore.ld | 196 +++++++ .../tc3xx/a2g-tc397-5v-tft/src/CMakeLists.txt | 26 +- .../scripts/Lcf_Gnuc_Tricore_Tc.lsl.kernel | 621 --------------------- .../tc4xx/triboard_tc4x9_com/scripts/Make.defs | 12 +- .../tc4xx/triboard_tc4x9_com/scripts/tricore.ld | 202 +++++++ .../tc4xx/triboard_tc4x9_com/src/CMakeLists.txt | 26 +- 8 files changed, 444 insertions(+), 1232 deletions(-) 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 deleted file mode 100644 index 5fd26bfb511..00000000000 --- a/boards/tricore/tc3xx/a2g-tc397-5v-tft/scripts/Lcf_Gnuc_Tricore_Tc.lsl.kernel +++ /dev/null @@ -1,581 +0,0 @@ -/**************************************************************************** - * boards/tricore/tc3xx/a2g-tc397-5v-tft/scripts/Lcf_Gnuc_Tricore_Tc.lsl.kernel - * - * 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. - * - ****************************************************************************/ - -#include "arch/board/board_memorymap.h" - -#define __JOIN2(x,y) x##y -#define JOIN2(x,y) __JOIN2(x,y) -#define __JOIN3(x,y,z) x##y##z -#define JOIN3(x,y,z) __JOIN3(x,y,z) -#define __JOIN4(x,y,z,w) x##y##z##w -#define JOIN4(x,y,z,w) __JOIN4(x,y,z,w) - -#define COREID_LST(x) JOIN2(x, CONFIG_CPU_COREID) -#define COREID_MID(x,y) JOIN3(x, CONFIG_CPU_COREID, y) - -/* Default linker script, for normal executables */ -OUTPUT_FORMAT("elf32-tricore") -OUTPUT_ARCH("tricore") -#if CONFIG_CPU_COREID == 0 -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); -LCF_DSPR_KERNEL_SIZE = GENERATE_CORE_DSPR_KERNEL_SIZE(CONFIG_CPU_COREID); -LCF_PSPR_KERNEL_START = GENERATE_CORE_PSPR_KERNEL_START(CONFIG_CPU_COREID); -LCF_PSPR_KERNEL_SIZE = GENERATE_CORE_PSPR_KERNEL_SIZE(CONFIG_CPU_COREID); -LCF_DLMU_KERNEL_START = GENERATE_CORE_DLMU_KERNEL_START(CONFIG_CPU_COREID); -LCF_DLMU_KERNEL_SIZE = GENERATE_CORE_DLMU_KERNEL_SIZE(CONFIG_CPU_COREID); -LCF_KSTACK_START = GENERATE_CORE_STACK_KERNEL_START(CONFIG_CPU_COREID); -LCF_KSTACK_SIZE = GENERATE_CORE_STACK_KERNEL_SIZE(CONFIG_CPU_COREID); - -LCF_CSA_SIZE = 40k; -LCF_USTACK_SIZE = CONFIG_IDLETHREAD_STACKSIZE; -LCF_ISTACK_SIZE = CONFIG_ARCH_INTERRUPTSTACK; - -LCF_CSA_OFFSET = (LCF_DSPR_KERNEL_SIZE - 1k - LCF_CSA_SIZE); -LCF_ISTACK_OFFSET = (LCF_CSA_OFFSET - 256 - LCF_ISTACK_SIZE); -LCF_USTACK_OFFSET = (LCF_ISTACK_OFFSET - 256 - LCF_USTACK_SIZE); - -LCF_STARTPTR = LCF_PFLASH_KERNEL_START; -LCF_STARTPTR_NC = NC_START(LCF_STARTPTR); -LCF_TRAPVEC_START = LCF_STARTPTR + 0x100; - -COREID_LST(__INTTAB_CPU) = LCF_PFLASH_KERNEL_START; - -LCF_STARTPTR_NC_CPU0 = NC_START(CORE0_PFLASH_KERNEL_START); -LCF_STARTPTR_NC_CPU1 = NC_START(CORE1_PFLASH_KERNEL_START); -LCF_STARTPTR_NC_CPU2 = NC_START(CORE2_PFLASH_KERNEL_START); -LCF_STARTPTR_NC_CPU3 = NC_START(CORE3_PFLASH_KERNEL_START); -LCF_STARTPTR_NC_CPU4 = NC_START(CORE4_PFLASH_KERNEL_START); -LCF_STARTPTR_NC_CPU5 = NC_START(CORE5_PFLASH_KERNEL_START); -RESET = CORE0_PFLASH_KERNEL_START; - -MEMORY -{ - kstack (w!xp): org = LCF_KSTACK_START, len = LCF_KSTACK_SIZE - - dspr (w!xp): org = LCF_DSPR_KERNEL_START, len = LCF_DSPR_KERNEL_SIZE - pspr (w!xp): org = LCF_PSPR_KERNEL_START, len = LCF_PSPR_KERNEL_SIZE - - psram_local (w!xp): org = PSPR_LOCAL_START, len = LCF_PSPR_KERNEL_SIZE - - pfls (rx!p): org = LCF_PFLASH_KERNEL_START, len = LCF_PFLASH_KERNEL_SIZE - pfls_nc (rx!p): org = NC_START(LCF_PFLASH_KERNEL_START), len = LCF_PFLASH_KERNEL_SIZE - - ucb (rx!p): org = 0xAF400000, len = 24K - - cpu_dlmu (w!xp): org = LCF_DLMU_KERNEL_START, len = LCF_DLMU_KERNEL_SIZE - cpu_dlmu_nc (w!xp): org = NC_START(LCF_DLMU_KERNEL_START), len = LCF_DLMU_KERNEL_SIZE -} - -/* map cached and non cached addresses */ -REGION_MIRROR("pfls", "pfls_nc") -REGION_MIRROR("cpu_dlmu", "cpu_dlmu_nc") - -/*Sections located at absolute fixed address*/ -/*Fixed memory Allocations for stack memory*/ -CORE_ID = GLOBAL; -SECTIONS -{ - CORE_SEC(.ustack) (LCF_DSPR_KERNEL_START + LCF_USTACK_OFFSET): - { - PROVIDE(__USTACK_END = .); - PROVIDE(COREID_MID(__USTACK, _END) = .); - . = . + LCF_USTACK_SIZE; - PROVIDE(__ustack = .); - PROVIDE(COREID_LST(__USTACK) = .); - } - - CORE_SEC(.istack) (LCF_DSPR_KERNEL_START + LCF_ISTACK_OFFSET): - { - PROVIDE(__ISTACK_END = .); - 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*/ -CORE_ID = GLOBAL ; -SECTIONS -{ - .start_tc (LCF_STARTPTR) : FLAGS(rxl) - { - KEEP (*(.start)); - KEEP (*(.start_cpu?)); - } > pfls - - .interface_const (LCF_STARTPTR + 0x20) : - { - __IF_CONST = .; - KEEP (*(.interface_const)); - } > pfls - - PROVIDE(__START = LCF_STARTPTR); - PROVIDE(__ENABLE_INDIVIDUAL_C_INIT_CPU0 = 0); - PROVIDE(__ENABLE_INDIVIDUAL_C_INIT_CPU1 = 1); - PROVIDE(__ENABLE_INDIVIDUAL_C_INIT_CPU2 = 1); - PROVIDE(__ENABLE_INDIVIDUAL_C_INIT_CPU3 = 1); - PROVIDE(__ENABLE_INDIVIDUAL_C_INIT_CPU4 = 1); - PROVIDE(__ENABLE_INDIVIDUAL_C_INIT_CPU5 = 1); -} - -/*Fixed memory Allocations for Trap Vector Table*/ -CORE_ID = GLOBAL; -SECTIONS -{ - .traptab_tc (LCF_TRAPVEC_START) : - { - PROVIDE(COREID_LST(__TRAPTAB_CPU) = .); - KEEP (*(.COREID_LST(traptab_cpu))); - } > pfls -} - -/*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); -} - -/*Fixed memory Allocations for Interrupt Vector Table*/ -SECTIONS -{ - /*Interrupt Vector Table*/ - .COREID_MID(inttab_tc, _0FF) (COREID_LST(__INTTAB_CPU) + 0x1FE0) : - { - . = ALIGN(8); - KEEP (*(.intvec)); - . = ALIGN(0x2000); - } > pfls -} - -/* Fixed memory Allocations for BMHD*/ -CORE_ID = GLOBAL; -SECTIONS -{ - .bmhd_0_org (0xaf400000) : FLAGS(arl) { KEEP (*(.bmhd_0_orig)); } > ucb - .bmhd_1_org (0xaf400200) : FLAGS(arl) { KEEP (*(.bmhd_1_orig)); } > ucb - .bmhd_2_org (0xaf400400) : FLAGS(arl) { KEEP (*(.bmhd_2_orig)); } > ucb - .bmhd_3_org (0xaf400600) : FLAGS(arl) { KEEP (*(.bmhd_3_orig)); } > ucb -} - -/*Relative A0/A1/A8/A9 Addressable Sections*/ -CORE_ID = GLOBAL; -SECTIONS -{ - /*Relative A0 Addressable Data, selectable with patterns and user defined sections*/ - /*Note: A0 addressable area is common, to make the functions callable in any CPU*/ - /*Relative A0 Addressable Data, selectable by toolchain*/ - CORE_SEC(.sdata) : FLAGS(awsl) - { - *(.sdata) - *(.sdata.*) - . = ALIGN(4); - } > dspr AT> pfls - - CORE_SEC(.sbss) (NOLOAD): FLAGS(aws) - { - *(.sbss) - *(.sbss.*) - } > dspr - _SMALL_DATA_ = SIZEOF(CORE_SEC(.sdata)) ? ADDR(CORE_SEC(.sdata)) : (ADDR(CORE_SEC(.sdata)) & 0xF0000000) + 32k ; - __a0_mem = _SMALL_DATA_; -} - -CORE_ID = GLOBAL; -SECTIONS -{ - /*Relative A1 Addressable Const, selectable with patterns and user defined sections*/ - /*Note: A1 addressable area is common, to make the functions callable in any CPU*/ - /*Relative A1 Addressable Const, selectable by toolchain*/ - CORE_SEC(.sdata2) : FLAGS(arsl) - { - *(.srodata) - *(.srodata.*) - } > pfls - _SMALL_DATA2_ = SIZEOF(CORE_SEC(.sdata2)) ? ADDR(CORE_SEC(.sdata2)) : (ADDR(CORE_SEC(.sdata2)) & 0xF0000000) + 32k ; - __a1_mem = _SMALL_DATA2_; -} - -CORE_ID = GLOBAL; -SECTIONS -{ - /*Relative A9 Addressable Data, selectable with patterns and user defined sections*/ - CORE_SEC(.sdata4) : - { - *(.a9sdata) - *(.a9sdata.*) - . = ALIGN(4); - } > dspr AT> pfls - - CORE_SEC(.sbss4) (NOLOAD) : - { - *(.a9sbss) - *(.a9sbss.*) - } > dspr - - _SMALL_DATA4_ = SIZEOF(CORE_SEC(.sdata4)) ? ADDR(CORE_SEC(.sdata4)) : (ADDR(CORE_SEC(.sdata4)) & 0xF0000000) + 32k ; - __a9_mem = _SMALL_DATA4_; - - /*Relative A8 Addressable Const, selectable with patterns and user defined sections*/ - CORE_SEC(.sdata3) : FLAGS(arsl) - { - *(.rodata_a8) - *(.rodata_a8.*) - } > pfls - - _SMALL_DATA3_ = SIZEOF(CORE_SEC(.sdata3)) ? ADDR(CORE_SEC(.sdata3)) : (ADDR(CORE_SEC(.sdata3)) & 0xF0000000) + 32k ; - __a8_mem = _SMALL_DATA3_; -} - -/*kstack*/ -CORE_ID = GLOBAL; -SECTIONS -{ - CORE_SEC(.stack) (NOLOAD) : FLAGS(aw) - { - *(.dtcm_stack) - *(.dtcm_stack.*) - } > kstack -} - -/*data&bss*/ -CORE_ID = GLOBAL; -SECTIONS -{ - CORE_SEC(.dspr_data) : FLAGS(awzl) - { - *Ifx_Ssw_Tc?.* (.data) - *Cpu?_Main.* (.data.*) - . = ALIGN(4); - } > dspr AT> pfls - - CORE_SEC(.dspr_bss) (NOLOAD) : FLAGS(awz) - { - *Ifx_Ssw_Tc?.* (.bss) - *Cpu?_Main.* (.bss.*) - . = ALIGN(4); - } > dspr - - CORE_SEC(.zdata) : FLAGS(awzl) - { - *(.zdata) - *(.zdata.*) - *(.gnu.linkonce.z.*) - . = ALIGN(4); - } > dspr AT> pfls - - CORE_SEC(.zbss) (NOLOAD) : FLAGS(awz) - { - *(.zbss) - *(.zbss.*) - *(.bbss) - *(.bbss.*) - *(.gnu.linkonce.zb.*) - } > dspr - - CORE_SEC(.data) : FLAGS(awl) - { - *(.data) - *(.data.*) - *(.gnu.linkonce.d.*) - . = ALIGN(4); - } > dspr AT> pfls - - CORE_SEC(.bss) (NOLOAD) : FLAGS(aw) - { - *(.bss) - *(.bss.*) - *(.lmubss_cpu?) - *(.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 -{ - .heap (NOLOAD) : FLAGS(aw) - { - . = ALIGN(4); - _sheap = ABSOLUTE(.); - _eheap = ABSOLUTE(__USTACK_END); - } > dspr -} - -/*rodata*/ -CORE_ID = GLOBAL; -SECTIONS -{ - CORE_SEC(.rodata) : FLAGS(arl) - { - *(.rodata) - *(.rodata.*) - *(.gnu.linkonce.r.*) - /* - * Create the clear and copy tables that tell the startup code - * which memory areas to clear and to copy, respectively. - */ - . = ALIGN(4) ; - PROVIDE(__clear_table = .); - LONG(0 + ADDR(.dspr_bss)); LONG(SIZEOF(.dspr_bss)); - LONG(0 + ADDR(.zbss)); LONG(SIZEOF(.zbss)); - LONG(0 + ADDR(.sbss)); LONG(SIZEOF(.sbss)); - LONG(0 + ADDR(.bss)); LONG(SIZEOF(.bss)); - LONG(0 + ADDR(.sbss4)); LONG(SIZEOF(.sbss4)); - LONG(-1); LONG(-1); - PROVIDE(__clear_table_powerOn = .); - LONG(-1); LONG(-1); - PROVIDE(__copy_table = .); - LONG(LOADADDR(.dspr_data)); LONG(0 + ADDR(.dspr_data)); LONG(SIZEOF(.dspr_data)); - LONG(LOADADDR(.zdata)); LONG(0 + ADDR(.zdata)); LONG(SIZEOF(.zdata)); - LONG(LOADADDR(.sdata)); LONG(0 + ADDR(.sdata)); LONG(SIZEOF(.sdata)); - LONG(LOADADDR(.data)); LONG(0 + ADDR(.data)); LONG(SIZEOF(.data)); - LONG(LOADADDR(.sdata4)); LONG(0 + ADDR(.sdata4)); LONG(SIZEOF(.sdata4)); - LONG(LOADADDR(.psram_text)); LONG(0 + ADDR(.psram_text)); LONG(SIZEOF(.psram_text)); - LONG(-1); LONG(-1); LONG(-1); - PROVIDE(__copy_table_powerOn = .) ; - LONG(-1); LONG(-1); LONG(-1); - . = ALIGN(8); - } > pfls -} - -/*Code selections*/ -/*Code Sections, selectable with patterns and user defined sections*/ -CORE_ID = GLOBAL; -SECTIONS -{ - CORE_SEC(.zrodata) : FLAGS(arzl) - { - *Ifx_Ssw_Tc?.* (.zrodata) - *Cpu?_Main.* (.zrodata) - *(.zrodata_cpu?) - *(.zrodata) - *(.zrodata.*) - } > pfls - - /* - * Code executed before calling main extra section for C++ constructor init - * -------------------------Start----------------------------------------- - */ - .init : - { - PROVIDE(__init_start = .); - KEEP(*(.init)) - KEEP(*(.init*)) - PROVIDE(__init_end = .); - . = ALIGN(8); - - } > pfls - - .fini : - { - PROVIDE(__fini_start = .); - KEEP(*(.fini)) - KEEP(*(.fini*)) - PROVIDE(__fini_end = .); - . = ALIGN(8); - } > pfls - - /* - * Code executed before calling main extra section for C++ constructor init - * -------------------------End----------------------------------------- - */ - CORE_SEC(.psram_text) : FLAGS(awxl) - { - . = ALIGN(4); - *aurix_mtd_flash.*(.text) - *aurix_mtd_flash.*(.text.*) - *aurix_mtd_partition.*(.text) - *aurix_mtd_partition.*(.text.*) - . = ALIGN(4); - } > pspr AT> pfls - - CORE_SEC(.text) : FLAGS(axl) - { - . = ALIGN(4); - *Ifx_Ssw_Tc?.*(.text) - *Cpu?_Main.*(.text) - *Ifx_Ssw_Tc?.*(.text.*) - *Cpu?_Main.*(.text.*) - *(.text) - *(.text.*) - *(.gcc_except_table) - *(.gnu.linkonce.t.*) - *(.gnu.warning) /* .gnu.warning sections are handled specially by elf32.em. */ - . = ALIGN(8); - } > pfls - - /* - * C++ exception handling tables. NOTE: gcc emits .eh_frame - * sections when compiling C sources with debugging enabled (-g). - * If you can be sure that your final application consists - * exclusively of C objects (i.e., no C++ objects), you may use - * the -R option of the "strip" and "objcopy" utilities to remove - * the .eh_frame section from the executable. - */ - .eh_frame_hdr : ALIGN(8) - { - KEEP (*(.eh_frame_hdr)) - . = ALIGN(8); - } > pfls - - .eh_frame : ALIGN(8) - { - __EH_FRAME_BEGIN__ = . ; - KEEP (*(.eh_frame)) - __EH_FRAME_END__ = . ; - . = ALIGN(8); - } > pfls - - /* - * Constructors and destructors. - */ - .ctors : FLAGS(ar) - { - _sinit = ABSOLUTE(.); - /* - * Code executed before calling main extra section for C++ constructor init - * -------------------------Start----------------------------------------- - */ - KEEP(*(SORT_BY_INIT_PRIORITY(.init_array.*) SORT_BY_INIT_PRIORITY(.ctors.*))) - KEEP(*(.init_array EXCLUDE_FILE(*crtbegin.o *crtbegin?.o *crtend.o *crtend?.o) .ctors)) - /* - * Code executed before calling main extra section for C++ constructor init - * -------------------------End----------------------------------------- - */ - _einit = ABSOLUTE(.); - . = ALIGN(8); - } > pfls - .dtors : FLAGS(ar) - { - __DTOR_LIST__ = . ; - LONG((__DTOR_END__ - __DTOR_LIST__) / 4 - 2); - /* - * Code executed before calling main extra section for C++ destructor init - * -------------------------Start----------------------------------------- - */ - KEEP (*crtbegin.o(.dtors)) - KEEP (*(EXCLUDE_FILE (*crtend.o ) .dtors)) - KEEP (*(SORT(.dtors.*))) - KEEP (*(.dtors)) - /* - * Code executed before calling main extra section for C++ destructor init - * -------------------------End----------------------------------------- - */ - LONG(0) ; - __DTOR_END__ = . ; - . = ALIGN(8); - } > pfls - /* - * DWARF debug sections. - * Symbols in the DWARF debugging sections are relative to the - * beginning of the section, so we begin them at 0. - */ - /* - * DWARF 1 - */ - .comment 0 : { *(.comment) } - .debug 0 : { *(.debug) } - .line 0 : { *(.line) } - /* - * GNU DWARF 1 extensions - */ - .debug_srcinfo 0 : { *(.debug_srcinfo) } - .debug_sfnames 0 : { *(.debug_sfnames) } - /* - * DWARF 1.1 and DWARF 2 - */ - .debug_aranges 0 : { *(.debug_aranges) } - .debug_pubnames 0 : { *(.debug_pubnames) } - /* - * DWARF 2 - */ - .debug_info 0 : { *(.debug_info) } - .debug_abbrev 0 : { *(.debug_abbrev) } - .debug_line 0 : { *(.debug_line) } - .debug_frame 0 : { *(.debug_frame) } - .debug_str 0 : { *(.debug_str) } - .debug_loc 0 : { *(.debug_loc) } - .debug_macinfo 0 : { *(.debug_macinfo) } - .debug_ranges 0 : { *(.debug_ranges) } - /* - * SGI/MIPS DWARF 2 extensions - */ - .debug_weaknames 0 : { *(.debug_weaknames) } - .debug_funcnames 0 : { *(.debug_funcnames) } - .debug_typenames 0 : { *(.debug_typenames) } - .debug_varnames 0 : { *(.debug_varnames) } - /* - * Optional sections that may only appear when relocating. - */ - /* - * Optional sections that may appear regardless of relocating. - */ - .version_info 0 : { *(.version_info) } - .boffs 0 : { KEEP (*(.boffs)) } -} diff --git a/boards/tricore/tc3xx/a2g-tc397-5v-tft/scripts/Make.defs b/boards/tricore/tc3xx/a2g-tc397-5v-tft/scripts/Make.defs index 7225b0c651c..87514fca335 100644 --- a/boards/tricore/tc3xx/a2g-tc397-5v-tft/scripts/Make.defs +++ b/boards/tricore/tc3xx/a2g-tc397-5v-tft/scripts/Make.defs @@ -25,15 +25,17 @@ include $(TOPDIR)/tools/Config.mk include $(TOPDIR)/arch/tricore/src/tc3xx/Toolchain.defs ifeq ($(CONFIG_TRICORE_TOOLCHAIN_TASKING),y) - TRICORE_TOOLCHAIN := Tasking + ARCHSCRIPT += $(BOARD_DIR)$(DELIM)scripts$(DELIM)Lcf_Tasking_Tricore_Tc.lsl.kernel else - TRICORE_TOOLCHAIN := Gnuc + ARCHSCRIPT += $(BOARD_DIR)$(DELIM)scripts$(DELIM)tricore.ld endif -ARCHSCRIPT += $(BOARD_DIR)$(DELIM)scripts$(DELIM)Lcf_$(TRICORE_TOOLCHAIN)_Tricore_Tc.lsl.kernel - ifeq ($(CONFIG_BUILD_PROTECTED),y) - ARCHSCRIPT += $(BOARD_DIR)$(DELIM)scripts$(DELIM)Lcf_$(TRICORE_TOOLCHAIN)_Tricore_Tc.lsl.user + ifeq ($(CONFIG_TRICORE_TOOLCHAIN_TASKING),y) + ARCHSCRIPT += $(BOARD_DIR)$(DELIM)scripts$(DELIM)Lcf_Tasking_Tricore_Tc.lsl.user + else + ARCHSCRIPT += $(BOARD_DIR)$(DELIM)scripts$(DELIM)Lcf_Gnuc_Tricore_Tc.lsl.user + endif endif CFLAGS := $(ARCHCFLAGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRAFLAGS) diff --git a/boards/tricore/tc3xx/a2g-tc397-5v-tft/scripts/tricore.ld b/boards/tricore/tc3xx/a2g-tc397-5v-tft/scripts/tricore.ld new file mode 100644 index 00000000000..80fb7fcb4b5 --- /dev/null +++ b/boards/tricore/tc3xx/a2g-tc397-5v-tft/scripts/tricore.ld @@ -0,0 +1,196 @@ +/**************************************************************************** + * boards/tricore/tc3xx/a2g-tc397-5v-tft/scripts/tricore.ld + * + * 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. + * + ****************************************************************************/ + +#include <nuttx/config.h> + +#include "arch/board/board_memorymap.h" + +OUTPUT_FORMAT("elf32-tricore") +OUTPUT_ARCH("tricore") +ENTRY(__start) + +/* CPU0 only: program flash bank A and the data scratchpad RAM of CPU0. + * The CSA, the interrupt stack and the idle stack are at the top of the + * data scratchpad RAM, the heap below them. + */ + +/* In the protected build, the user image has its stack in the DSPR below + * CORE0_DSPR_KERNEL_START, so the kernel takes only the DSPR above it + */ + +#ifdef CONFIG_BUILD_PROTECTED +# define DSPR_ORIGIN CORE0_DSPR_KERNEL_START +# define DSPR_LENGTH CORE0_DSPR_KERNEL_SIZE +#else +# define DSPR_ORIGIN 0x70000000 +# define DSPR_LENGTH 240K +#endif + +MEMORY +{ + pfls (rx!p) : ORIGIN = 0x80000000, LENGTH = 1536K + dspr (w!xp) : ORIGIN = DSPR_ORIGIN, LENGTH = DSPR_LENGTH +} + +REGION_ALIAS("DATA", dspr) + +__csa_size = 40K; +__istack_size = CONFIG_ARCH_INTERRUPTSTACK; +__ustack_size = CONFIG_IDLETHREAD_STACKSIZE; + +__csa_end = ORIGIN(dspr) + LENGTH(dspr); +__csa_begin = __csa_end - __csa_size; +__istack = __csa_begin; +__ustack = __istack - __istack_size; + +/* Boot stack of __start in the PSPR, as on TC4xx */ + +__psram_ustack = 0x7010eb00; + +/* The other cores start at the program flash of their own image */ + +PROVIDE(__start1 = 0x80300000); +PROVIDE(__start2 = 0x80600000); +PROVIDE(__start3 = 0x80900000); +PROVIDE(__start4 = 0x80c00000); +PROVIDE(__start5 = 0x80f00000); + +SECTIONS +{ + /* Reset entry, the trap table at +0x100 and the interrupt vector at + * +0x1fe0, which BIV points at with all priority bits set + */ + + .start ORIGIN(pfls) : + { + KEEP(*(.start)) + } > pfls + + .traptab ORIGIN(pfls) + 0x100 : + { + __TRAPTAB_CPU0 = .; + KEEP(*(.traptab_cpu0)) + } > pfls + + .intvec ORIGIN(pfls) + 0x1fe0 : + { + __INTTAB_CPU0 = ORIGIN(pfls); + KEEP(*(.intvec)) + } > pfls + + .text : + { + *(.text .text.*) + *(.gnu.linkonce.t.*) + . = ALIGN(8); + } > pfls + + .rodata : + { + *(.rodata .rodata.*) + *(.zrodata .zrodata.*) + *(.gnu.linkonce.r.*) + . = ALIGN(4); + } > pfls + + /* Small constants, addressed relative to A1 */ + + .srodata : + { + *(.srodata .srodata.*) + } > pfls + + __a1_mem = ADDR(.srodata) + 32K; + __a8_mem = __a1_mem; + + .ctors : + { + _sinit = ABSOLUTE(.); + KEEP(*(SORT_BY_INIT_PRIORITY(.init_array.*) SORT_BY_INIT_PRIORITY(.ctors.*))) + KEEP(*(.init_array .ctors)) + _einit = ABSOLUTE(.); + . = ALIGN(8); + } > pfls + + .eh_frame : + { + KEEP(*(.eh_frame)) + } > pfls + + /* Initialized data, small data (A0) first, copied from flash at startup */ + + .data : + { + _sdata = ABSOLUTE(.); + *(.sdata .sdata.*) + *(.zdata .zdata.*) + *(.data .data.*) + *(.gnu.linkonce.d.*) + . = ALIGN(4); + _edata = ABSOLUTE(.); + } > DATA AT > pfls + + _data_flash = LOADADDR(.data); + + .bss (NOLOAD) : + { + _sbss = ABSOLUTE(.); + *(.sbss .sbss.*) + *(.zbss .zbss.*) + *(.bss .bss.*) + *(.gnu.linkonce.b.*) + *(COMMON) + . = ALIGN(4); + _ebss = ABSOLUTE(.); + } > DATA + + __a0_mem = _sdata + 32K; + __a9_mem = __a0_mem; + + .heap (NOLOAD) : + { + . = ALIGN(8); + _sheap = ABSOLUTE(.); + } > dspr + + _eheap = __ustack - __ustack_size; + + .ustack __ustack - __ustack_size (NOLOAD) : + { + . += __ustack_size; + } > dspr + + .istack __istack - __istack_size (NOLOAD) : + { + . += __istack_size; + } > dspr + + .csa __csa_begin (NOLOAD) : + { + . += __csa_size; + } > dspr + + /DISCARD/ : + { + *(.comment) + } +} diff --git a/boards/tricore/tc3xx/a2g-tc397-5v-tft/src/CMakeLists.txt b/boards/tricore/tc3xx/a2g-tc397-5v-tft/src/CMakeLists.txt index 21979341ac9..e3651b6c103 100644 --- a/boards/tricore/tc3xx/a2g-tc397-5v-tft/src/CMakeLists.txt +++ b/boards/tricore/tc3xx/a2g-tc397-5v-tft/src/CMakeLists.txt @@ -25,19 +25,25 @@ set(SRCS tc397_boardinit.c tc397_bringup.c) target_sources(board PRIVATE ${SRCS}) if(CONFIG_TRICORE_TOOLCHAIN_TASKING) - set(toolchain "Tasking") + set_property( + GLOBAL + PROPERTY LD_SCRIPT + "${NUTTX_BOARD_DIR}/scripts/Lcf_Tasking_Tricore_Tc.lsl.kernel") else() - set(toolchain "Gnuc") + set_property(GLOBAL PROPERTY LD_SCRIPT + "${NUTTX_BOARD_DIR}/scripts/tricore.ld") endif() -set_property( - GLOBAL - PROPERTY LD_SCRIPT - "${NUTTX_BOARD_DIR}/scripts/Lcf_${toolchain}_Tricore_Tc.lsl.kernel") if(CONFIG_BUILD_PROTECTED) target_sources(board PRIVATE tc397_userspace.c) - set_property( - GLOBAL - PROPERTY LD_SCRIPT_USER - "${NUTTX_BOARD_DIR}/scripts/Lcf_${toolchain}_Tricore_Tc.lsl.user") + if(CONFIG_TRICORE_TOOLCHAIN_TASKING) + set_property( + GLOBAL + PROPERTY LD_SCRIPT_USER + "${NUTTX_BOARD_DIR}/scripts/Lcf_Tasking_Tricore_Tc.lsl.user") + else() + set_property( + GLOBAL PROPERTY LD_SCRIPT_USER + "${NUTTX_BOARD_DIR}/scripts/Lcf_Gnuc_Tricore_Tc.lsl.user") + endif() endif() 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 deleted file mode 100644 index 1bd5d009007..00000000000 --- a/boards/tricore/tc4xx/triboard_tc4x9_com/scripts/Lcf_Gnuc_Tricore_Tc.lsl.kernel +++ /dev/null @@ -1,621 +0,0 @@ -/**************************************************************************** - * boards/tricore/tc4xx/triboard_tc4x9_com/scripts/Lcf_Gnuc_Tricore_Tc.lsl.kernel - * - * 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. - * - ****************************************************************************/ - -#include "arch/board/board_memorymap.h" - -#define __JOIN2(x,y) x##y -#define JOIN2(x,y) __JOIN2(x,y) -#define __JOIN3(x,y,z) x##y##z -#define JOIN3(x,y,z) __JOIN3(x,y,z) -#define __JOIN4(x,y,z,w) x##y##z##w -#define JOIN4(x,y,z,w) __JOIN4(x,y,z,w) - -#define COREID_LST(x) JOIN2(x, CONFIG_CPU_COREID) -#define COREID_MID(x,y) JOIN3(x, CONFIG_CPU_COREID, y) - -/* Default linker script, for normal executables */ -OUTPUT_FORMAT("elf32-tricore") -OUTPUT_ARCH("tricore") -#if CONFIG_CPU_COREID == 0 -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); -LCF_DSPR_KERNEL_SIZE = GENERATE_CORE_DSPR_KERNEL_SIZE(CONFIG_CPU_COREID); -LCF_PSPR_KERNEL_START = GENERATE_CORE_PSPR_KERNEL_START(CONFIG_CPU_COREID); -LCF_PSPR_KERNEL_SIZE = GENERATE_CORE_PSPR_KERNEL_SIZE(CONFIG_CPU_COREID); -LCF_DLMU_KERNEL_START = GENERATE_CORE_DLMU_KERNEL_START(CONFIG_CPU_COREID); -LCF_DLMU_KERNEL_SIZE = GENERATE_CORE_DLMU_KERNEL_SIZE(CONFIG_CPU_COREID); -LCF_KSTACK_START = GENERATE_CORE_STACK_KERNEL_START(CONFIG_CPU_COREID); -LCF_KSTACK_SIZE = GENERATE_CORE_STACK_KERNEL_SIZE(CONFIG_CPU_COREID); - -#if CONFIG_CPU_COREID != 0 -LCF_SYSLOG_START = JOIN3(AURIX_RPMSG_CORE0CORE, CONFIG_CPU_COREID, _SYSLOG_START); -LCF_SYSLOG_SIZE = JOIN3(AURIX_RPMSG_CORE0CORE, CONFIG_CPU_COREID, _SYSLOG_SIZE); -#endif - -LCF_CSA_SIZE = 40k; -LCF_USTACK_SIZE = CONFIG_IDLETHREAD_STACKSIZE; -LCF_ISTACK_SIZE = CONFIG_ARCH_INTERRUPTSTACK; - -LCF_CSA_OFFSET = (LCF_DSPR_KERNEL_SIZE - 1k - LCF_CSA_SIZE); -LCF_ISTACK_OFFSET = (LCF_CSA_OFFSET - 256 - LCF_ISTACK_SIZE); -LCF_USTACK_OFFSET = (LCF_ISTACK_OFFSET - 256 - LCF_USTACK_SIZE); - -LCF_STARTPTR = LCF_PFLASH_KERNEL_START; -LCF_STARTPTR_NC = NC_START(LCF_STARTPTR); -LCF_TRAPVEC_START = LCF_STARTPTR + 0x100; - -COREID_LST(__INTTAB_CPU) = LCF_PFLASH_KERNEL_START; - -LCF_STARTPTR_NC_CPU0 = NC_START(CORE0_PFLASH_KERNEL_START); -LCF_STARTPTR_NC_CPU1 = NC_START(CORE1_PFLASH_KERNEL_START); -LCF_STARTPTR_NC_CPU2 = NC_START(CORE2_PFLASH_KERNEL_START); -LCF_STARTPTR_NC_CPU3 = NC_START(CORE3_PFLASH_KERNEL_START); -LCF_STARTPTR_NC_CPU4 = NC_START(CORE4_PFLASH_KERNEL_START); -LCF_STARTPTR_NC_CPU5 = NC_START(CORE5_PFLASH_KERNEL_START); -RESET = CORE0_PFLASH_KERNEL_START; - -MEMORY -{ - kstack (w!xp): org = LCF_KSTACK_START, len = LCF_KSTACK_SIZE - - dspr (w!xp): org = LCF_DSPR_KERNEL_START, len = LCF_DSPR_KERNEL_SIZE - pspr (w!xp): org = LCF_PSPR_KERNEL_START, len = LCF_PSPR_KERNEL_SIZE - - psram_local (w!xp): org = PSPR_LOCAL_START, len = LCF_PSPR_KERNEL_SIZE - - pfls (rx!p): org = LCF_PFLASH_KERNEL_START, len = LCF_PFLASH_KERNEL_SIZE - pfls_nc (rx!p): org = NC_START(LCF_PFLASH_KERNEL_START), len = LCF_PFLASH_KERNEL_SIZE - - ucb (rx!p): org = 0xae404800, len = 80K - 2K - - cpu_dlmu (w!xp): org = LCF_DLMU_KERNEL_START, len = LCF_DLMU_KERNEL_SIZE - cpu_dlmu_nc (w!xp): org = NC_START(LCF_DLMU_KERNEL_START), len = LCF_DLMU_KERNEL_SIZE - - rpmsg_shmem (w!xp): org = AURIX_RPMSG_SHMEM_START, len = AURIX_RPMSG_SHMEM_SIZE -#if CONFIG_CPU_COREID != 0 - syslogram (w!xp): org = LCF_SYSLOG_START, len = LCF_SYSLOG_SIZE -#endif -} - -/* map cached and non cached addresses */ -REGION_MIRROR("pfls", "pfls_nc") -REGION_MIRROR("cpu_dlmu", "cpu_dlmu_nc") - -/*Sections located at absolute fixed address*/ -/*Fixed memory Allocations for stack memory*/ -CORE_ID = GLOBAL; -SECTIONS -{ - CORE_SEC(.ustack) (LCF_DSPR_KERNEL_START + LCF_USTACK_OFFSET): - { - PROVIDE(__USTACK_END = .); - PROVIDE(COREID_MID(__USTACK, _END) = .); - . = . + LCF_USTACK_SIZE; - PROVIDE(__ustack = .); - PROVIDE(COREID_LST(__USTACK) = .); - } - - CORE_SEC(.istack) (LCF_DSPR_KERNEL_START + LCF_ISTACK_OFFSET): - { - PROVIDE(__ISTACK_END = .); - 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*/ -CORE_ID = GLOBAL ; -SECTIONS -{ - .start_tc (LCF_STARTPTR) : FLAGS(rxl) - { - KEEP (*(.start)); - KEEP (*(.start_cpu?)); - } > pfls - - .interface_const (LCF_STARTPTR + 0x20) : - { - __IF_CONST = .; - KEEP (*(.interface_const)); - } > pfls - - PROVIDE(__START = LCF_STARTPTR); - PROVIDE(__ENABLE_INDIVIDUAL_C_INIT_CPU0 = 0); - PROVIDE(__ENABLE_INDIVIDUAL_C_INIT_CPU1 = 1); - PROVIDE(__ENABLE_INDIVIDUAL_C_INIT_CPU2 = 1); - PROVIDE(__ENABLE_INDIVIDUAL_C_INIT_CPU3 = 1); - PROVIDE(__ENABLE_INDIVIDUAL_C_INIT_CPU4 = 1); - PROVIDE(__ENABLE_INDIVIDUAL_C_INIT_CPU5 = 1); -} - -/*Fixed memory Allocations for Trap Vector Table*/ -CORE_ID = GLOBAL; -SECTIONS -{ - .traptab_tc (LCF_TRAPVEC_START) : - { - PROVIDE(COREID_LST(__TRAPTAB_CPU) = .); - KEEP (*(.COREID_LST(traptab_cpu))); - } > pfls -} - -/*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); -} - -/*Fixed memory Allocations for Interrupt Vector Table*/ -SECTIONS -{ - /*Interrupt Vector Table*/ - .COREID_MID(inttab_tc, _0FF) (COREID_LST(__INTTAB_CPU) + 0x1FE0) : - { - . = ALIGN(8); - KEEP (*(.intvec)); - . = ALIGN(0x2000); - } > pfls -} - -/* Fixed memory Allocations for BMHD*/ -CORE_ID = GLOBAL; -SECTIONS -{ - .bmhd_0_org (0xae404800) : FLAGS(arl) { KEEP (*(.bmhd_0_orig)); } > ucb - .bmhd_1_org (0xae405000) : FLAGS(arl) { KEEP (*(.bmhd_1_orig)); } > ucb - .bmhd_2_org (0xae405800) : FLAGS(arl) { KEEP (*(.bmhd_2_orig)); } > ucb - .bmhd_3_org (0xae406000) : FLAGS(arl) { KEEP (*(.bmhd_3_orig)); } > ucb - .usercfg_0_org (0xae408800) : FLAGS(arl) { KEEP (*(.usercfg_0_orig)); } > ucb - .usercfg_0_cpy (0xae409000) : FLAGS(arl) { KEEP (*(.usercfg_0_copy)); } > ucb -} - -/*Relative A0/A1/A8/A9 Addressable Sections*/ -CORE_ID = GLOBAL; -SECTIONS -{ - /*Relative A0 Addressable Data, selectable with patterns and user defined sections*/ - /*Note: A0 addressable area is common, to make the functions callable in any CPU*/ - /*Relative A0 Addressable Data, selectable by toolchain*/ - CORE_SEC(.sdata) : FLAGS(awsl) - { - *(.sdata) - *(.sdata.*) - . = ALIGN(4); - } > cpu_dlmu AT> pfls - - CORE_SEC(.sbss) (NOLOAD): FLAGS(aws) - { - *(.sbss) - *(.sbss.*) - } > cpu_dlmu - _SMALL_DATA_ = SIZEOF(CORE_SEC(.sdata)) ? ADDR(CORE_SEC(.sdata)) : (ADDR(CORE_SEC(.sdata)) & 0xF0000000) + 32k ; - __a0_mem = _SMALL_DATA_; -} - -CORE_ID = GLOBAL; -SECTIONS -{ - /*Relative A1 Addressable Const, selectable with patterns and user defined sections*/ - /*Note: A1 addressable area is common, to make the functions callable in any CPU*/ - /*Relative A1 Addressable Const, selectable by toolchain*/ - CORE_SEC(.sdata2) : FLAGS(arsl) - { - *(.srodata) - *(.srodata.*) - } > pfls - _SMALL_DATA2_ = SIZEOF(CORE_SEC(.sdata2)) ? ADDR(CORE_SEC(.sdata2)) : (ADDR(CORE_SEC(.sdata2)) & 0xF0000000) + 32k ; - __a1_mem = _SMALL_DATA2_; -} - -CORE_ID = GLOBAL; -SECTIONS -{ - /*Relative A9 Addressable Data, selectable with patterns and user defined sections*/ - CORE_SEC(.sdata4) : - { - *(.a9sdata) - *(.a9sdata.*) - . = ALIGN(4); - } > cpu_dlmu AT> pfls - - CORE_SEC(.sbss4) (NOLOAD) : - { - *(.a9sbss) - *(.a9sbss.*) - } > cpu_dlmu - - _SMALL_DATA4_ = SIZEOF(CORE_SEC(.sdata4)) ? ADDR(CORE_SEC(.sdata4)) : (ADDR(CORE_SEC(.sdata4)) & 0xF0000000) + 32k ; - __a9_mem = _SMALL_DATA4_; - - /*Relative A8 Addressable Const, selectable with patterns and user defined sections*/ - CORE_SEC(.sdata3) : FLAGS(arsl) - { - *(.rodata_a8) - *(.rodata_a8.*) - } > pfls - - _SMALL_DATA3_ = SIZEOF(CORE_SEC(.sdata3)) ? ADDR(CORE_SEC(.sdata3)) : (ADDR(CORE_SEC(.sdata3)) & 0xF0000000) + 32k ; - __a8_mem = _SMALL_DATA3_; -} - -/*kstack*/ -CORE_ID = GLOBAL; -SECTIONS -{ - CORE_SEC(.stack) (NOLOAD) : FLAGS(aw) - { - *(.dtcm_stack) - *(.dtcm_stack.*) - } > kstack -} - -/*data&bss*/ -CORE_ID = GLOBAL; -SECTIONS -{ - CORE_SEC(.dspr_data) : FLAGS(awzl) - { - *Ifx_Ssw_Tc?.* (.data) - *Cpu?_Main.* (.data.*) - . = ALIGN(4); - } > dspr AT> pfls - - CORE_SEC(.dspr_bss) (NOLOAD) : FLAGS(awz) - { - *Ifx_Ssw_Tc?.* (.bss) - *Cpu?_Main.* (.bss.*) - *os_scheduletable_misc.* (.bss.*) - *iob_initialize.* (.bss.*) - . = ALIGN(4); - } > dspr - - CORE_SEC(.zdata) : FLAGS(awzl) - { - *(.zdata) - *(.zdata.*) - *(.gnu.linkonce.z.*) - . = ALIGN(4); - } > cpu_dlmu AT> pfls - - CORE_SEC(.zbss) (NOLOAD) : FLAGS(awz) - { - *(.zbss) - *(.zbss.*) - *(.bbss) - *(.bbss.*) - *(.gnu.linkonce.zb.*) - } > cpu_dlmu - - CORE_SEC(.data) : FLAGS(awl) - { - *(.data) - *(.data.*) - *(.gnu.linkonce.d.*) - . = ALIGN(4); - } > cpu_dlmu AT> pfls - - CORE_SEC(.bss) (NOLOAD) : FLAGS(aw) - { - *(.bss) - *(.bss.*) - *(.lmubss_cpu?) - *(.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 -{ - .dlmuheap (NOLOAD) : FLAGS(aw) - { - . = ALIGN(4); - __DLMUHEAP = ABSOLUTE(.); - __DLMUHEAP_END = ABSOLUTE(LCF_DLMU_KERNEL_START + LCF_DLMU_KERNEL_SIZE); - } > cpu_dlmu - - .heap (NOLOAD) : FLAGS(aw) - { - . = ALIGN(4); - _sheap = ABSOLUTE(.); - _eheap = ABSOLUTE(__USTACK_END); - } > dspr -} - -/*syslog*/ -#if CONFIG_CPU_COREID != 0 -CORE_ID = GLOBAL; -SECTIONS -{ - .syslog (NOLOAD) : FLAGS(aw) - { - . = ALIGN(4); - *(.syslog) - *(.syslog.*) - } > syslogram -} -#endif - -/*rodata*/ -CORE_ID = GLOBAL; -SECTIONS -{ - CORE_SEC(.rodata) : FLAGS(arl) - { - *(.rodata) - *(.rodata.*) - *(.gnu.linkonce.r.*) - /* - * Create the clear and copy tables that tell the startup code - * which memory areas to clear and to copy, respectively. - */ - . = ALIGN(4) ; - PROVIDE(__clear_table = .); - LONG(0 + ADDR(.dspr_bss)); LONG(SIZEOF(.dspr_bss)); - LONG(0 + ADDR(.zbss)); LONG(SIZEOF(.zbss)); - LONG(0 + ADDR(.sbss)); LONG(SIZEOF(.sbss)); - LONG(0 + ADDR(.bss)); LONG(SIZEOF(.bss)); - LONG(0 + ADDR(.sbss4)); LONG(SIZEOF(.sbss4)); - - LONG(-1); LONG(-1); - PROVIDE(__clear_table_powerOn = .); - LONG(-1); LONG(-1); - PROVIDE(__copy_table = .); - LONG(LOADADDR(.dspr_data)); LONG(0 + ADDR(.dspr_data)); LONG(SIZEOF(.dspr_data)); - LONG(LOADADDR(.zdata)); LONG(0 + ADDR(.zdata)); LONG(SIZEOF(.zdata)); - LONG(LOADADDR(.sdata)); LONG(0 + ADDR(.sdata)); LONG(SIZEOF(.sdata)); - LONG(LOADADDR(.data)); LONG(0 + ADDR(.data)); LONG(SIZEOF(.data)); - LONG(LOADADDR(.sdata4)); LONG(0 + ADDR(.sdata4)); LONG(SIZEOF(.sdata4)); - LONG(LOADADDR(.psram_text)); LONG(0 + ADDR(.psram_text)); LONG(SIZEOF(.psram_text)); - LONG(-1); LONG(-1); LONG(-1); - PROVIDE(__copy_table_powerOn = .) ; - LONG(-1); LONG(-1); LONG(-1); - . = ALIGN(8); - } > pfls -} - -/*Code selections*/ -/*Code Sections, selectable with patterns and user defined sections*/ -CORE_ID = GLOBAL; -SECTIONS -{ - CORE_SEC(.zrodata) : FLAGS(arzl) - { - *Ifx_Ssw_Tc?.* (.zrodata) - *Cpu?_Main.* (.zrodata) - *(.zrodata_cpu?) - *(.zrodata) - *(.zrodata.*) - } > pfls - - /* - * Code executed before calling main extra section for C++ constructor init - * -------------------------Start----------------------------------------- - */ - .init : - { - PROVIDE(__init_start = .); - KEEP(*(.init)) - KEEP(*(.init*)) - PROVIDE(__init_end = .); - . = ALIGN(8); - - } > pfls - - .fini : - { - PROVIDE(__fini_start = .); - KEEP(*(.fini)) - KEEP(*(.fini*)) - PROVIDE(__fini_end = .); - . = ALIGN(8); - } > pfls - - /* - * Code executed before calling main extra section for C++ constructor init - * -------------------------End----------------------------------------- - */ - CORE_SEC(.psram_text) : FLAGS(awxl) - { - . = ALIGN(4); - *aurix_mtd_flash.*(.text) - *aurix_mtd_flash.*(.text.*) - *aurix_mtd_partition.*(.text) - *aurix_mtd_partition.*(.text.*) - . = ALIGN(4); - } > pspr AT> pfls - - CORE_SEC(.text) : FLAGS(axl) - { - . = ALIGN(4); - *Ifx_Ssw_Tc?.*(.text) - *Cpu?_Main.*(.text) - *Ifx_Ssw_Tc?.*(.text.*) - *Cpu?_Main.*(.text.*) - *(.text) - *(.text.*) - *(.gcc_except_table) - *(.gnu.linkonce.t.*) - *(.gnu.warning) /* .gnu.warning sections are handled specially by elf32.em. */ - . = ALIGN(8); - } > pfls - - /* - * C++ exception handling tables. NOTE: gcc emits .eh_frame - * sections when compiling C sources with debugging enabled (-g). - * If you can be sure that your final application consists - * exclusively of C objects (i.e., no C++ objects), you may use - * the -R option of the "strip" and "objcopy" utilities to remove - * the .eh_frame section from the executable. - */ - .eh_frame_hdr : ALIGN(8) - { - KEEP (*(.eh_frame_hdr)) - . = ALIGN(8); - } > pfls - - .eh_frame : ALIGN(8) - { - __EH_FRAME_BEGIN__ = . ; - KEEP (*(.eh_frame)) - __EH_FRAME_END__ = . ; - . = ALIGN(8); - } > pfls - - /* - * Constructors and destructors. - */ - .ctors : FLAGS(ar) - { - _sinit = ABSOLUTE(.); - /* - * Code executed before calling main extra section for C++ constructor init - * -------------------------Start----------------------------------------- - */ - KEEP(*(SORT_BY_INIT_PRIORITY(.init_array.*) SORT_BY_INIT_PRIORITY(.ctors.*))) - KEEP(*(.init_array EXCLUDE_FILE(*crtbegin.o *crtbegin?.o *crtend.o *crtend?.o) .ctors)) - /* - * Code executed before calling main extra section for C++ constructor init - * -------------------------End----------------------------------------- - */ - _einit = ABSOLUTE(.); - . = ALIGN(8); - } > pfls - .dtors : FLAGS(ar) - { - __DTOR_LIST__ = . ; - LONG((__DTOR_END__ - __DTOR_LIST__) / 4 - 2); - /* - * Code executed before calling main extra section for C++ destructor init - * -------------------------Start----------------------------------------- - */ - KEEP (*crtbegin.o(.dtors)) - KEEP (*(EXCLUDE_FILE (*crtend.o ) .dtors)) - KEEP (*(SORT(.dtors.*))) - KEEP (*(.dtors)) - /* - * Code executed before calling main extra section for C++ destructor init - * -------------------------End----------------------------------------- - */ - LONG(0) ; - __DTOR_END__ = . ; - . = ALIGN(8); - } > pfls - /* - * DWARF debug sections. - * Symbols in the DWARF debugging sections are relative to the - * beginning of the section, so we begin them at 0. - */ - /* - * DWARF 1 - */ - .comment 0 : { *(.comment) } - .debug 0 : { *(.debug) } - .line 0 : { *(.line) } - /* - * GNU DWARF 1 extensions - */ - .debug_srcinfo 0 : { *(.debug_srcinfo) } - .debug_sfnames 0 : { *(.debug_sfnames) } - /* - * DWARF 1.1 and DWARF 2 - */ - .debug_aranges 0 : { *(.debug_aranges) } - .debug_pubnames 0 : { *(.debug_pubnames) } - /* - * DWARF 2 - */ - .debug_info 0 : { *(.debug_info) } - .debug_abbrev 0 : { *(.debug_abbrev) } - .debug_line 0 : { *(.debug_line) } - .debug_frame 0 : { *(.debug_frame) } - .debug_str 0 : { *(.debug_str) } - .debug_loc 0 : { *(.debug_loc) } - .debug_macinfo 0 : { *(.debug_macinfo) } - .debug_ranges 0 : { *(.debug_ranges) } - /* - * SGI/MIPS DWARF 2 extensions - */ - .debug_weaknames 0 : { *(.debug_weaknames) } - .debug_funcnames 0 : { *(.debug_funcnames) } - .debug_typenames 0 : { *(.debug_typenames) } - .debug_varnames 0 : { *(.debug_varnames) } - /* - * Optional sections that may only appear when relocating. - */ - /* - * Optional sections that may appear regardless of relocating. - */ - .version_info 0 : { *(.version_info) } - .boffs 0 : { KEEP (*(.boffs)) } -} diff --git a/boards/tricore/tc4xx/triboard_tc4x9_com/scripts/Make.defs b/boards/tricore/tc4xx/triboard_tc4x9_com/scripts/Make.defs index 433477bceaa..e20214c8773 100644 --- a/boards/tricore/tc4xx/triboard_tc4x9_com/scripts/Make.defs +++ b/boards/tricore/tc4xx/triboard_tc4x9_com/scripts/Make.defs @@ -25,15 +25,17 @@ include $(TOPDIR)/tools/Config.mk include $(TOPDIR)/arch/tricore/src/tc4xx/Toolchain.defs ifeq ($(CONFIG_TRICORE_TOOLCHAIN_TASKING),y) - TRICORE_TOOLCHAIN := Tasking + ARCHSCRIPT += $(BOARD_DIR)$(DELIM)scripts$(DELIM)Lcf_Tasking_Tricore_Tc.lsl.kernel else - TRICORE_TOOLCHAIN := Gnuc + ARCHSCRIPT += $(BOARD_DIR)$(DELIM)scripts$(DELIM)tricore.ld endif -ARCHSCRIPT += $(BOARD_DIR)$(DELIM)scripts$(DELIM)Lcf_$(TRICORE_TOOLCHAIN)_Tricore_Tc.lsl.kernel - ifeq ($(CONFIG_BUILD_PROTECTED),y) - ARCHSCRIPT += $(BOARD_DIR)$(DELIM)scripts$(DELIM)Lcf_$(TRICORE_TOOLCHAIN)_Tricore_Tc.lsl.user + ifeq ($(CONFIG_TRICORE_TOOLCHAIN_TASKING),y) + ARCHSCRIPT += $(BOARD_DIR)$(DELIM)scripts$(DELIM)Lcf_Tasking_Tricore_Tc.lsl.user + else + ARCHSCRIPT += $(BOARD_DIR)$(DELIM)scripts$(DELIM)Lcf_Gnuc_Tricore_Tc.lsl.user + endif endif CFLAGS := $(ARCHCFLAGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRAFLAGS) diff --git a/boards/tricore/tc4xx/triboard_tc4x9_com/scripts/tricore.ld b/boards/tricore/tc4xx/triboard_tc4x9_com/scripts/tricore.ld new file mode 100644 index 00000000000..8ef0f726123 --- /dev/null +++ b/boards/tricore/tc4xx/triboard_tc4x9_com/scripts/tricore.ld @@ -0,0 +1,202 @@ +/**************************************************************************** + * boards/tricore/tc4xx/triboard_tc4x9_com/scripts/tricore.ld + * + * 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. + * + ****************************************************************************/ + +#include <nuttx/config.h> + +#include "arch/board/board_memorymap.h" + +OUTPUT_FORMAT("elf32-tricore") +OUTPUT_ARCH("tricore") +ENTRY(__start) + +/* CPU0 only: program flash bank A, the data scratchpad RAM and a window of the + * DLMU of CPU0. + * The CSA, the interrupt stack and the idle stack are at the top of the + * data scratchpad RAM, the heap below them. + */ + +/* In the protected build, the user image has its stack in the DSPR below + * CORE0_DSPR_KERNEL_START, so the kernel takes only the DSPR above it + */ + +#ifdef CONFIG_BUILD_PROTECTED +# define DSPR_ORIGIN CORE0_DSPR_KERNEL_START +# define DSPR_LENGTH CORE0_DSPR_KERNEL_SIZE +#else +# define DSPR_ORIGIN 0x70000000 +# define DSPR_LENGTH 240K +#endif + +MEMORY +{ + pfls (rx!p) : ORIGIN = 0x80000000, LENGTH = 1024K + dspr (w!xp) : ORIGIN = DSPR_ORIGIN, LENGTH = DSPR_LENGTH + dlmu (w!xp) : ORIGIN = 0x90020400, LENGTH = 171K +} + +REGION_ALIAS("DATA", dlmu) + +__csa_size = 40K; +__istack_size = CONFIG_ARCH_INTERRUPTSTACK; +__ustack_size = CONFIG_IDLETHREAD_STACKSIZE; + +__csa_end = ORIGIN(dspr) + LENGTH(dspr); +__csa_begin = __csa_end - __csa_size; +__istack = __csa_begin; +__ustack = __istack - __istack_size; + +/* 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; + +/* The other cores start at the program flash of their own image */ + +PROVIDE(__start1 = 0x80200000); +PROVIDE(__start2 = 0x80580000); +PROVIDE(__start3 = 0x80680000); +PROVIDE(__start4 = 0x807e0000); +PROVIDE(__start5 = 0x8092c000); + +SECTIONS +{ + /* Reset entry, the trap table at +0x100 and the interrupt vector at + * +0x1fe0, which BIV points at with all priority bits set + */ + + .start ORIGIN(pfls) : + { + KEEP(*(.start)) + } > pfls + + .traptab ORIGIN(pfls) + 0x100 : + { + __TRAPTAB_CPU0 = .; + KEEP(*(.traptab_cpu0)) + } > pfls + + .intvec ORIGIN(pfls) + 0x1fe0 : + { + __INTTAB_CPU0 = ORIGIN(pfls); + KEEP(*(.intvec)) + } > pfls + + .text : + { + *(.text .text.*) + *(.gnu.linkonce.t.*) + . = ALIGN(8); + } > pfls + + .rodata : + { + *(.rodata .rodata.*) + *(.zrodata .zrodata.*) + *(.gnu.linkonce.r.*) + . = ALIGN(4); + } > pfls + + /* Small constants, addressed relative to A1 */ + + .srodata : + { + *(.srodata .srodata.*) + } > pfls + + __a1_mem = ADDR(.srodata) + 32K; + __a8_mem = __a1_mem; + + .ctors : + { + _sinit = ABSOLUTE(.); + KEEP(*(SORT_BY_INIT_PRIORITY(.init_array.*) SORT_BY_INIT_PRIORITY(.ctors.*))) + KEEP(*(.init_array .ctors)) + _einit = ABSOLUTE(.); + . = ALIGN(8); + } > pfls + + .eh_frame : + { + KEEP(*(.eh_frame)) + } > pfls + + /* Initialized data, small data (A0) first, copied from flash at startup */ + + .data : + { + _sdata = ABSOLUTE(.); + *(.sdata .sdata.*) + *(.zdata .zdata.*) + *(.data .data.*) + *(.gnu.linkonce.d.*) + . = ALIGN(4); + _edata = ABSOLUTE(.); + } > DATA AT > pfls + + _data_flash = LOADADDR(.data); + + .bss (NOLOAD) : + { + _sbss = ABSOLUTE(.); + *(.sbss .sbss.*) + *(.zbss .zbss.*) + *(.bss .bss.*) + *(.gnu.linkonce.b.*) + *(COMMON) + . = ALIGN(4); + _ebss = ABSOLUTE(.); + } > DATA + + __a0_mem = _sdata + 32K; + __a9_mem = __a0_mem; + + .heap (NOLOAD) : + { + . = ALIGN(8); + _sheap = ABSOLUTE(.); + } > dspr + + _eheap = __ustack - __ustack_size; + + .ustack __ustack - __ustack_size (NOLOAD) : + { + . += __ustack_size; + } > dspr + + .istack __istack - __istack_size (NOLOAD) : + { + . += __istack_size; + } > dspr + + .csa __csa_begin (NOLOAD) : + { + . += __csa_size; + } > dspr + + /DISCARD/ : + { + *(.comment) + } +} diff --git a/boards/tricore/tc4xx/triboard_tc4x9_com/src/CMakeLists.txt b/boards/tricore/tc4xx/triboard_tc4x9_com/src/CMakeLists.txt index 20e3c10b1e7..9ca2b78de37 100644 --- a/boards/tricore/tc4xx/triboard_tc4x9_com/src/CMakeLists.txt +++ b/boards/tricore/tc4xx/triboard_tc4x9_com/src/CMakeLists.txt @@ -25,19 +25,25 @@ set(SRCS tc4da_boardinit.c tc4da_bringup.c) target_sources(board PRIVATE ${SRCS}) if(CONFIG_TRICORE_TOOLCHAIN_TASKING) - set(toolchain "Tasking") + set_property( + GLOBAL + PROPERTY LD_SCRIPT + "${NUTTX_BOARD_DIR}/scripts/Lcf_Tasking_Tricore_Tc.lsl.kernel") else() - set(toolchain "Gnuc") + set_property(GLOBAL PROPERTY LD_SCRIPT + "${NUTTX_BOARD_DIR}/scripts/tricore.ld") endif() -set_property( - GLOBAL - PROPERTY LD_SCRIPT - "${NUTTX_BOARD_DIR}/scripts/Lcf_${toolchain}_Tricore_Tc.lsl.kernel") if(CONFIG_BUILD_PROTECTED) target_sources(board PRIVATE tc4d9_userspace.c) - set_property( - GLOBAL - PROPERTY LD_SCRIPT_USER - "${NUTTX_BOARD_DIR}/scripts/Lcf_${toolchain}_Tricore_Tc.lsl.user") + if(CONFIG_TRICORE_TOOLCHAIN_TASKING) + set_property( + GLOBAL + PROPERTY LD_SCRIPT_USER + "${NUTTX_BOARD_DIR}/scripts/Lcf_Tasking_Tricore_Tc.lsl.user") + else() + set_property( + GLOBAL PROPERTY LD_SCRIPT_USER + "${NUTTX_BOARD_DIR}/scripts/Lcf_Gnuc_Tricore_Tc.lsl.user") + endif() endif()
