xref: /btstack/port/renesas-ek-ra6m4a-da14531/e2-project/script/fsp.ld (revision ce6f85e79d1d141c1b45dfa16b2671762457cbb4)
1/*
2                  Linker File for Renesas FSP
3*/
4
5INCLUDE memory_regions.ld
6
7/* Uncomment and set XIP_SECONDARY_SLOT_IMAGE to 1 below for the secondary XIP application image.*/
8/*
9 XIP_SECONDARY_SLOT_IMAGE = 1;
10*/
11
12QSPI_FLASH_PRV_LENGTH = DEFINED(QSPI_FLASH_SIZE) ? ABSOLUTE(QSPI_FLASH_SIZE) : ABSOLUTE(QSPI_FLASH_LENGTH);
13OSPI_DEVICE_0_PRV_LENGTH = DEFINED(OSPI_DEVICE_0_SIZE) ? ABSOLUTE(OSPI_DEVICE_0_SIZE) : ABSOLUTE(OSPI_DEVICE_0_LENGTH);
14OSPI_DEVICE_1_PRV_LENGTH = DEFINED(OSPI_DEVICE_1_SIZE) ? ABSOLUTE(OSPI_DEVICE_1_SIZE) : ABSOLUTE(OSPI_DEVICE_1_LENGTH);
15
16/* If a flat (secure) project has DEFINED RAM_NS_BUFFER_LENGTH, then emit IDAU symbols to allocate non-secure RAM. */
17__RESERVE_NS_RAM = !DEFINED(PROJECT_NONSECURE) && DEFINED(RAM_NS_BUFFER_LENGTH) && (OPTION_SETTING_S_LENGTH != 0);
18
19RAM_NS_BUFFER_BLOCK_LENGTH = DEFINED(RAM_NS_BUFFER_LENGTH) ? ALIGN(RAM_NS_BUFFER_LENGTH, 8192) : 0;
20RAM_NS_BUFFER_LENGTH = DEFINED(RAM_NS_BUFFER_LENGTH) ? RAM_NS_BUFFER_LENGTH : 0;
21RAM_NS_BUFFER_START = RAM_START + RAM_LENGTH - RAM_NS_BUFFER_LENGTH;
22RAM_NS_BUFFER_BLOCK_START = RAM_START + RAM_LENGTH - RAM_NS_BUFFER_BLOCK_LENGTH;
23
24OPTION_SETTING_START_NS = 0x0100A180;
25
26/* This definition is used to avoid moving the counter in OPTION_SETTING regions for projects that should not configure option settings.
27 * Bootloader images do not configure option settings because they are owned by the bootloader.
28 * FSP_BOOTABLE_IMAGE is only defined in bootloader images. */
29__bl_FSP_BOOTABLE_IMAGE = 1;
30__bln_FSP_BOOTABLE_IMAGE = 1;
31PROJECT_SECURE_OR_FLAT = !DEFINED(PROJECT_NONSECURE) && OPTION_SETTING_LENGTH && !DEFINED(FSP_BOOTABLE_IMAGE);
32USE_OPTION_SETTING_NS = DEFINED(PROJECT_NONSECURE) && !DEFINED(FSP_BOOTABLE_IMAGE);
33
34__bl_FLASH_IMAGE_START = !DEFINED(FLASH_BOOTLOADER_LENGTH) ? 0 :
35                         FLASH_APPLICATION_IMAGE_NUMBER == 1 ? FLASH_BOOTLOADER_LENGTH + FLASH_BOOTLOADER_HEADER_LENGTH :
36                         FLASH_BOOTLOADER_LENGTH + FLASH_BOOTLOADER_SCRATCH_LENGTH + FLASH_APPLICATION_S_LENGTH + FLASH_BOOTLOADER_HEADER_LENGTH;
37__bl_FLASH_IMAGE_LENGTH = !DEFINED(FLASH_BOOTLOADER_LENGTH) ? 0 :
38                          FLASH_APPLICATION_S_LENGTH - FLASH_BOOTLOADER_HEADER_LENGTH;
39__bl_FLASH_IMAGE_END    = __bl_FLASH_IMAGE_START + __bl_FLASH_IMAGE_LENGTH;
40__bl_XIP_SECONDARY_FLASH_IMAGE_START = !DEFINED(FLASH_BOOTLOADER_LENGTH) ? 0 :
41                         FLASH_BOOTLOADER_LENGTH + FLASH_APPLICATION_S_LENGTH + FLASH_BOOTLOADER_HEADER_LENGTH;
42__bl_XIP_SECONDARY_FLASH_IMAGE_END = __bl_XIP_SECONDARY_FLASH_IMAGE_START + __bl_FLASH_IMAGE_LENGTH;
43__bl_FLASH_NS_START = !DEFINED(FLASH_BOOTLOADER_LENGTH) ? 0 :
44                        FLASH_APPLICATION_NS_LENGTH == 0 ? __bl_FLASH_IMAGE_END :
45                        __bl_FLASH_IMAGE_START - FLASH_BOOTLOADER_HEADER_LENGTH + FLASH_APPLICATION_S_LENGTH;
46__bl_FLASH_NSC_START = !DEFINED(FLASH_BOOTLOADER_LENGTH) ? 0 :
47                        FLASH_APPLICATION_NS_LENGTH == 0 ? __bl_FLASH_IMAGE_END :
48                        __bl_FLASH_NS_START - FLASH_APPLICATION_NSC_LENGTH;
49__bl_RAM_NS_START    = !DEFINED(FLASH_BOOTLOADER_LENGTH) ? 0 :
50                       FLASH_APPLICATION_NS_LENGTH == 0 ? RAM_START + RAM_LENGTH :
51                       RAM_START + RAM_LENGTH - RAM_APPLICATION_NS_LENGTH;
52__bl_RAM_NSC_START   = !DEFINED(FLASH_BOOTLOADER_LENGTH) ? 0 :
53                       FLASH_APPLICATION_NS_LENGTH == 0 ? RAM_START + RAM_LENGTH :
54                       __bl_RAM_NS_START - RAM_APPLICATION_NSC_LENGTH;
55__bl_FLASH_NS_IMAGE_START = !DEFINED(FLASH_BOOTLOADER_LENGTH) ? 0 :
56                            FLASH_APPLICATION_NS_LENGTH == 0 ? __bl_FLASH_IMAGE_END :
57                            __bl_FLASH_NS_START + FLASH_BOOTLOADER_HEADER_LENGTH_2;
58__bln_FLASH_IMAGE_START = __bl_FLASH_NS_IMAGE_START;
59__bln_FLASH_IMAGE_LENGTH = !DEFINED(FLASH_BOOTLOADER_LENGTH) ? 0 :
60                           FLASH_APPLICATION_NS_LENGTH == 0 ? __bl_FLASH_IMAGE_END :
61                           FLASH_APPLICATION_NS_LENGTH - FLASH_BOOTLOADER_HEADER_LENGTH_2;
62
63XIP_SECONDARY_SLOT_IMAGE = DEFINED(XIP_SECONDARY_SLOT_IMAGE) ? XIP_SECONDARY_SLOT_IMAGE : 0;
64FLASH_ORIGIN = !DEFINED(FLASH_IMAGE_START) ? FLASH_START :
65                XIP_SECONDARY_SLOT_IMAGE == 1 ? XIP_SECONDARY_FLASH_IMAGE_START :
66                FLASH_IMAGE_START;
67LIMITED_FLASH_LENGTH = DEFINED(FLASH_IMAGE_LENGTH) ? FLASH_IMAGE_LENGTH :
68                       DEFINED(FLASH_BOOTLOADER_LENGTH) ? FLASH_BOOTLOADER_LENGTH :
69                       FLASH_LENGTH;
70
71/* Define memory regions. */
72MEMORY
73{
74  FLASH (rx)      : ORIGIN = FLASH_ORIGIN, LENGTH = LIMITED_FLASH_LENGTH
75  RAM (rwx)       : ORIGIN = RAM_START, LENGTH = RAM_LENGTH
76  DATA_FLASH (rx) : ORIGIN = DATA_FLASH_START, LENGTH = DATA_FLASH_LENGTH
77  QSPI_FLASH (rx) : ORIGIN = QSPI_FLASH_START, LENGTH = QSPI_FLASH_PRV_LENGTH
78  OSPI_DEVICE_0 (rx) : ORIGIN = OSPI_DEVICE_0_START, LENGTH = OSPI_DEVICE_0_PRV_LENGTH
79  OSPI_DEVICE_1 (rx) : ORIGIN = OSPI_DEVICE_1_START, LENGTH = OSPI_DEVICE_1_PRV_LENGTH
80  OSPI_DEVICE_0_RAM (rwx) : ORIGIN = OSPI_DEVICE_0_START, LENGTH = OSPI_DEVICE_0_PRV_LENGTH
81  OSPI_DEVICE_1_RAM (rwx) : ORIGIN = OSPI_DEVICE_1_START, LENGTH = OSPI_DEVICE_1_PRV_LENGTH
82  SDRAM (rwx)     : ORIGIN = SDRAM_START, LENGTH = SDRAM_LENGTH
83  OPTION_SETTING (r): ORIGIN = OPTION_SETTING_START, LENGTH = OPTION_SETTING_LENGTH
84  OPTION_SETTING_S (r): ORIGIN = OPTION_SETTING_S_START, LENGTH = OPTION_SETTING_S_LENGTH
85  ID_CODE (rx)    : ORIGIN = ID_CODE_START, LENGTH = ID_CODE_LENGTH
86}
87
88/* Library configurations */
89GROUP(libgcc.a libc.a libm.a libnosys.a)
90
91/* Linker script to place sections and symbol values. Should be used together
92 * with other linker script that defines memory regions FLASH and RAM.
93 * It references following symbols, which must be DEFINED in code:
94 *   Reset_Handler : Entry of reset handler
95 *
96 * It defines following symbols, which code can use without definition:
97 *   __exidx_start
98 *   __exidx_end
99 *   __copy_table_start__
100 *   __copy_table_end__
101 *   __zero_table_start__
102 *   __zero_table_end__
103 *   __etext
104 *   __data_start__
105 *   __preinit_array_start
106 *   __preinit_array_end
107 *   __init_array_start
108 *   __init_array_end
109 *   __fini_array_start
110 *   __fini_array_end
111 *   __data_end__
112 *   __bss_start__
113 *   __bss_end__
114 *   __HeapLimit
115 *   __StackLimit
116 *   __StackTop
117 *   __stack
118 *   __Vectors_End
119 *   __Vectors_Size
120 *   __qspi_flash_start__
121 *   __qspi_flash_end__
122 *   __qspi_flash_code_size__
123 *   __qspi_region_max_size__
124 *   __qspi_region_start_address__
125 *   __qspi_region_end_address__
126 *   __ospi_device_0_start__
127 *   __ospi_device_0_end__
128 *   __ospi_device_0_code_size__
129 *   __ospi_device_0_region_max_size__
130 *   __ospi_device_0_region_start_address__
131 *   __ospi_device_0_region_end_address__
132 *   __ospi_device_1_start__
133 *   __ospi_device_1_end__
134 *   __ospi_device_1_code_size__
135 *   __ospi_device_1_region_max_size__
136 *   __ospi_device_1_region_start_address__
137 *   __ospi_device_1_region_end_address__
138 */
139ENTRY(Reset_Handler)
140
141SECTIONS
142{
143    .text :
144    {
145        __tz_FLASH_S = ABSOLUTE(FLASH_START);
146        __ROM_Start = .;
147
148        /* Even though the vector table is not 256 entries (1KB) long, we still allocate that much
149         * space because ROM registers are at address 0x400 and there is very little space
150         * in between. */
151        KEEP(*(.fixed_vectors*))
152        KEEP(*(.application_vectors*))
153        __Vectors_End = .;
154
155        /* ROM Registers start at address 0x00000400 for devices that do not have the OPTION_SETTING region. */
156        . = OPTION_SETTING_LENGTH > 0 ? . : __ROM_Start + 0x400;
157        KEEP(*(.rom_registers*))
158
159        /* Reserving 0x100 bytes of space for ROM registers. */
160        . = OPTION_SETTING_LENGTH > 0 ? . : __ROM_Start + 0x500;
161
162        /* Allocate flash write-boundary-aligned
163         * space for sce9 wrapped public keys for mcuboot if the module is used.
164         */
165		. = ALIGN(128);
166        KEEP(*(.mcuboot_sce9_key*))
167
168        *(.text*)
169
170        KEEP(*(.version))
171        KEEP(*(.init))
172        KEEP(*(.fini))
173
174        /* .ctors */
175        *crtbegin.o(.ctors)
176        *crtbegin?.o(.ctors)
177        *(EXCLUDE_FILE(*crtend?.o *crtend.o) .ctors)
178        *(SORT(.ctors.*))
179        *(.ctors)
180
181        /* .dtors */
182        *crtbegin.o(.dtors)
183        *crtbegin?.o(.dtors)
184        *(EXCLUDE_FILE(*crtend?.o *crtend.o) .dtors)
185        *(SORT(.dtors.*))
186        *(.dtors)
187
188        *(.rodata*)
189        __usb_dev_descriptor_start_fs = .;
190        KEEP(*(.usb_device_desc_fs*))
191        __usb_cfg_descriptor_start_fs = .;
192        KEEP(*(.usb_config_desc_fs*))
193        __usb_interface_descriptor_start_fs = .;
194        KEEP(*(.usb_interface_desc_fs*))
195        __usb_descriptor_end_fs = .;
196        __usb_dev_descriptor_start_hs = .;
197        KEEP(*(.usb_device_desc_hs*))
198        __usb_cfg_descriptor_start_hs = .;
199        KEEP(*(.usb_config_desc_hs*))
200        __usb_interface_descriptor_start_hs = .;
201        KEEP(*(.usb_interface_desc_hs*))
202        __usb_descriptor_end_hs = .;
203
204        KEEP(*(.eh_frame*))
205
206        __ROM_End = .;
207    } > FLASH = 0xFF
208
209    __Vectors_Size = __Vectors_End - __Vectors;
210
211    .ARM.extab :
212    {
213        *(.ARM.extab* .gnu.linkonce.armextab.*)
214    } > FLASH
215
216    __exidx_start = .;
217    .ARM.exidx :
218    {
219        *(.ARM.exidx* .gnu.linkonce.armexidx.*)
220    } > FLASH
221    __exidx_end = .;
222
223    /* To copy multiple ROM to RAM sections,
224     * uncomment .copy.table section and,
225     * define __STARTUP_COPY_MULTIPLE in startup_ARMCMx.S */
226    /*
227    .copy.table :
228    {
229        . = ALIGN(4);
230        __copy_table_start__ = .;
231        LONG (__etext)
232        LONG (__data_start__)
233        LONG (__data_end__ - __data_start__)
234        LONG (__etext2)
235        LONG (__data2_start__)
236        LONG (__data2_end__ - __data2_start__)
237        __copy_table_end__ = .;
238    } > FLASH
239    */
240
241    /* To clear multiple BSS sections,
242     * uncomment .zero.table section and,
243     * define __STARTUP_CLEAR_BSS_MULTIPLE in startup_ARMCMx.S */
244    /*
245    .zero.table :
246    {
247        . = ALIGN(4);
248        __zero_table_start__ = .;
249        LONG (__bss_start__)
250        LONG (__bss_end__ - __bss_start__)
251        LONG (__bss2_start__)
252        LONG (__bss2_end__ - __bss2_start__)
253        __zero_table_end__ = .;
254    } > FLASH
255    */
256
257    __etext = .;
258
259    __tz_RAM_S = ORIGIN(RAM);
260
261    /* If DTC is used, put the DTC vector table at the start of SRAM.
262       This avoids memory holes due to 1K alignment required by it. */
263    .fsp_dtc_vector_table (NOLOAD) :
264    {
265        . = ORIGIN(RAM);
266        *(.fsp_dtc_vector_table)
267    } > RAM
268
269    /* Initialized data section. */
270    .data :
271    {
272        __data_start__ = .;
273        . = ALIGN(4);
274
275        __Code_In_RAM_Start = .;
276
277        KEEP(*(.code_in_ram*))
278        __Code_In_RAM_End = .;
279
280        *(vtable)
281        /* Don't use *(.data*) because it will place data meant for .data_flash in this section. */
282        *(.data.*)
283        *(.data)
284
285        . = ALIGN(4);
286        /* preinit data */
287        PROVIDE_HIDDEN (__preinit_array_start = .);
288        KEEP(*(.preinit_array))
289        PROVIDE_HIDDEN (__preinit_array_end = .);
290
291        . = ALIGN(4);
292        /* init data */
293        PROVIDE_HIDDEN (__init_array_start = .);
294        KEEP(*(SORT(.init_array.*)))
295        KEEP(*(.init_array))
296        PROVIDE_HIDDEN (__init_array_end = .);
297
298
299        . = ALIGN(4);
300        /* finit data */
301        PROVIDE_HIDDEN (__fini_array_start = .);
302        KEEP(*(SORT(.fini_array.*)))
303        KEEP(*(.fini_array))
304        PROVIDE_HIDDEN (__fini_array_end = .);
305
306        KEEP(*(.jcr*))
307
308        . = ALIGN(4);
309
310        /* All data end */
311        __data_end__ = .;
312
313    } > RAM AT > FLASH
314
315
316    /* TrustZone Secure Gateway Stubs Section. */
317
318    /* Some arithmetic is needed to eliminate unnecessary FILL for secure projects. */
319    /* 1. Get the address to the next block after the .data section in FLASH. */
320    DATA_END = LOADADDR(.data) + SIZEOF(.data);
321    /* 2. Determine the secure gateway stubs address either by the provided linker variable or the next 1024-byte block after .data */
322    SGSTUBS_LOC = (DEFINED(PROJECT_SECURE) && DEFINED(FLASH_NSC_START)) ? ABSOLUTE(FLASH_NSC_START) : ALIGN(DATA_END, 1024);
323    /* 3. Manually specify the start location for .gnu.sgstubs */
324    .gnu.sgstubs SGSTUBS_LOC : ALIGN(1024)
325    {
326        __tz_FLASH_C = DEFINED(FLASH_NSC_START) ? ABSOLUTE(FLASH_NSC_START) : __RESERVE_NS_RAM ? ABSOLUTE(FLASH_START + FLASH_LENGTH) : ALIGN(1024);
327        _start_sg = .;
328        *(.gnu.sgstubs*)
329        . = ALIGN(32);
330        _end_sg = .;
331    } > FLASH
332
333    __tz_FLASH_N = DEFINED(FLASH_NS_START) ? ABSOLUTE(FLASH_NS_START) : __RESERVE_NS_RAM ? ABSOLUTE(FLASH_START + FLASH_LENGTH) : FLASH_LENGTH < 32768 ? FLASH_LENGTH : ALIGN(32768);
334    FLASH_NS_IMAGE_START = DEFINED(FLASH_NS_IMAGE_START) ? FLASH_NS_IMAGE_START : __tz_FLASH_N;
335
336    /* Note: There are no secure/non-secure boundaries for QSPI.  These symbols are provided for the RA configuration tool. */
337    __tz_QSPI_FLASH_S = ORIGIN(QSPI_FLASH);
338
339    /* QSPI_FLASH section to be downloaded via debugger */
340    .qspi_flash :
341    {
342        __qspi_flash_start__ = .;
343        KEEP(*(.qspi_flash*))
344        KEEP(*(.code_in_qspi*))
345        __qspi_flash_end__ = .;
346    } > QSPI_FLASH
347    __qspi_flash_code_size__ = __qspi_flash_end__ - __qspi_flash_start__;
348
349    /* QSPI_FLASH non-retentive section, creates a copy in internal flash that can be copied to QSPI */
350    __qspi_flash_code_addr__ = __etext + (__data_end__ - __data_start__);
351    .qspi_non_retentive : AT (__qspi_flash_code_addr__)
352    {
353        __qspi_non_retentive_start__ = .;
354        KEEP(*(.qspi_non_retentive*))
355        __qspi_non_retentive_end__ = .;
356    } > QSPI_FLASH
357    __qspi_non_retentive_size__ = __qspi_non_retentive_end__ - __qspi_non_retentive_start__;
358
359    __qspi_region_max_size__ = 0x4000000;   /* Must be the same as defined in MEMORY above */
360    __qspi_region_start_address__ = __qspi_flash_start__;
361    __qspi_region_end_address__ = __qspi_flash_start__ + __qspi_region_max_size__;
362
363    /* Note: There are no secure/non-secure boundaries for QSPI.  These symbols are provided for the RA configuration tool. */
364    __tz_QSPI_FLASH_N = __qspi_non_retentive_end__;
365
366    /* Support for OctaRAM */
367    .OSPI_DEVICE_0_NO_LOAD (NOLOAD):
368    {
369        . = ALIGN(4);
370        __ospi_device_0_start__ = .;
371        *(.ospi_device_0_no_load*)
372        . = ALIGN(4);
373        __ospi_device_0_end__ = .;
374    } > OSPI_DEVICE_0_RAM
375
376    .OSPI_DEVICE_1_NO_LOAD (NOLOAD):
377    {
378        . = ALIGN(4);
379        __ospi_device_1_start__ = .;
380        *(.ospi_device_1_no_load*)
381        . = ALIGN(4);
382        __ospi_device_1_end__ = .;
383    } > OSPI_DEVICE_1_RAM
384
385    /* Note: There are no secure/non-secure boundaries for QSPI.  These symbols are provided for the RA configuration tool. */
386    __tz_OSPI_DEVICE_0_S = ORIGIN(OSPI_DEVICE_0);
387
388    /* OSPI_DEVICE_0 section to be downloaded via debugger */
389    .OSPI_DEVICE_0 :
390    {
391        __ospi_device_0_start__ = .;
392        KEEP(*(.ospi_device_0*))
393        KEEP(*(.code_in_ospi_device_0*))
394        __ospi_device_0_end__ = .;
395    } > OSPI_DEVICE_0
396    __ospi_device_0_code_size__ = __ospi_device_0_end__ - __ospi_device_0_start__;
397
398    /* OSPI_DEVICE_0 non-retentive section, creates a copy in internal flash that can be copied to OSPI */
399    __ospi_device_0_code_addr__ = __etext + (__data_end__ - __data_start__);
400    .ospi_device_0_non_retentive : AT (__ospi_device_0_code_addr__)
401    {
402        __ospi_device_0_non_retentive_start__ = .;
403        KEEP(*(.ospi_device_0_non_retentive*))
404        __ospi_device_0_non_retentive_end__ = .;
405    } > OSPI_DEVICE_0
406    __ospi_device_0_non_retentive_size__ = __ospi_device_0_non_retentive_end__ - __ospi_device_0_non_retentive_start__;
407
408    __ospi_device_0_region_max_size__ = 0x8000000;   /* Must be the same as defined in MEMORY above */
409    __ospi_device_0_region_start_address__ = __ospi_device_0_start__;
410    __ospi_device_0_region_end_address__ = __ospi_device_0_start__ + __ospi_device_0_region_max_size__;
411
412    /* Note: There are no secure/non-secure boundaries for OSPI.  These symbols are provided for the RA configuration tool. */
413    __tz_OSPI_DEVICE_0_N = __ospi_device_0_non_retentive_end__;
414
415    /* Note: There are no secure/non-secure boundaries for OSPI.  These symbols are provided for the RA configuration tool. */
416    __tz_OSPI_DEVICE_1_S = ORIGIN(OSPI_DEVICE_1);
417
418    /* OSPI_DEVICE_1 section to be downloaded via debugger */
419    .OSPI_DEVICE_1 :
420    {
421        __ospi_device_1_start__ = .;
422        KEEP(*(.ospi_device_1*))
423        KEEP(*(.code_in_ospi_device_1*))
424        __ospi_device_1_end__ = .;
425    } > OSPI_DEVICE_1
426    __ospi_device_1_code_size__ = __ospi_device_1_end__ - __ospi_device_1_start__;
427
428    /* OSPI_DEVICE_1 non-retentive section, creates a copy in internal flash that can be copied to OSPI */
429    __ospi_device_1_code_addr__ = __etext + (__data_end__ - __data_start__);
430    .ospi_device_1_non_retentive : AT (__ospi_device_1_code_addr__)
431    {
432        __ospi_device_1_non_retentive_start__ = .;
433        KEEP(*(.ospi_device_1_non_retentive*))
434        __ospi_device_1_non_retentive_end__ = .;
435    } > OSPI_DEVICE_1
436    __ospi_device_1_non_retentive_size__ = __ospi_device_1_non_retentive_end__ - __ospi_device_1_non_retentive_start__;
437
438    __ospi_device_1_region_max_size__ = 0x10000000;   /* Must be the same as defined in MEMORY above */
439    __ospi_device_1_region_start_address__ = __ospi_device_1_start__;
440    __ospi_device_1_region_end_address__ = __ospi_device_1_start__ + __ospi_device_1_region_max_size__;
441
442    /* Note: There are no secure/non-secure boundaries for OSPI.  These symbols are provided for the RA configuration tool. */
443    __tz_OSPI_DEVICE_1_N = __ospi_device_1_non_retentive_end__;
444
445    .noinit (NOLOAD):
446    {
447        . = ALIGN(4);
448        __noinit_start = .;
449        KEEP(*(.noinit*))
450        . = ALIGN(8);
451        /* Place the FreeRTOS heap here so that the __HeapLimit calculation does not include the freertos heap. */
452        KEEP(*(.heap.*))
453        __noinit_end = .;
454    } > RAM
455
456    .bss :
457    {
458        . = ALIGN(4);
459        __bss_start__ = .;
460        *(.bss*)
461        *(COMMON)
462        . = ALIGN(4);
463        __bss_end__ = .;
464    } > RAM
465
466    .heap (NOLOAD):
467    {
468        . = ALIGN(8);
469        __HeapBase = .;
470        /* Place the STD heap here. */
471        KEEP(*(.heap))
472        __HeapLimit = .;
473    } > RAM
474
475    /* Stacks are stored in this section. */
476    .stack_dummy (NOLOAD):
477    {
478        . = ALIGN(8);
479        __StackLimit = .;
480        /* Main stack */
481        KEEP(*(.stack))
482        __StackTop = .;
483        /* Thread stacks */
484        KEEP(*(.stack*))
485        __StackTopAll = .;
486    } > RAM
487
488    PROVIDE(__stack = __StackTopAll);
489
490    /* This symbol represents the end of user allocated RAM. The RAM after this symbol can be used
491       at run time for things such as ThreadX memory pool allocations. */
492    __RAM_segment_used_end__ = ALIGN(__StackTopAll , 4);
493
494    /* RAM_NSC_START can be used to set a fixed address for non-secure callable RAM in secure projects.
495     * If it is not specified, the address for NSC RAM is the end of RAM aligned to a 1K boundary.
496     * In flat projects that require non-secure RAM, this variable is set to the start of non-secure RAM. */
497    __tz_RAM_C = DEFINED(RAM_NSC_START) ? ABSOLUTE(RAM_NSC_START) : __RESERVE_NS_RAM ? ABSOLUTE(RAM_NS_BUFFER_BLOCK_START) : ALIGN(__RAM_segment_used_end__, 1024);
498
499    /* RAM_NS_START can be used to set a fixed address for non-secure RAM in secure projects or flat projects.
500     * RAM_NS_BUFFER_BLOCK_LENGTH is used to allocate non-secure buffers in a flat project. If it is not
501     * specified, the address for NSC RAM is the end of RAM aligned to an 8K boundary.
502     * In flat projects that require non-secure RAM, this variable is set to the start of non-secure RAM. */
503    __tz_RAM_N = DEFINED(RAM_NS_START) ? ABSOLUTE(RAM_NS_START) : __RESERVE_NS_RAM ? ABSOLUTE(RAM_NS_BUFFER_BLOCK_START) : ALIGN(__tz_RAM_C, 8192);
504
505    /* Non-secure buffers must be in non-secure RAM. This is primarily used for the EDMAC in flat projects.
506     * The EDMAC is a non-secure bus master and can only access non-secure RAM. */
507    .ns_buffer (NOLOAD):
508    {
509        /* Allocate RAM on a 32-byte boundary to help with placement of Ethernet buffers. */
510        . = __RESERVE_NS_RAM ? ABSOLUTE(RAM_NS_BUFFER_START & 0xFFFFFFE0) : .;
511
512        KEEP(*(.ns_buffer*))
513    } > RAM
514
515    /* Data flash. */
516    .data_flash :
517    {
518        . = ORIGIN(DATA_FLASH);
519        __tz_DATA_FLASH_S = .;
520        __Data_Flash_Start = .;
521        KEEP(*(.data_flash*))
522        __Data_Flash_End = .;
523
524        __tz_DATA_FLASH_N = DEFINED(DATA_FLASH_NS_START) ? ABSOLUTE(DATA_FLASH_NS_START) : __RESERVE_NS_RAM ? ABSOLUTE(DATA_FLASH_START + DATA_FLASH_LENGTH) : ALIGN(1024);
525    } > DATA_FLASH
526
527    /* Note: There are no secure/non-secure boundaries for SDRAM.  These symbols are provided for the RA configuration tool. */
528    __tz_SDRAM_S = ORIGIN(SDRAM);
529
530    /* SDRAM */
531    .sdram (NOLOAD):
532    {
533        __SDRAM_Start = .;
534        KEEP(*(.sdram*))
535        KEEP(*(.frame*))
536        __SDRAM_End = .;
537    } > SDRAM
538
539    /* Note: There are no secure/non-secure boundaries for SDRAM.  These symbols are provided for the RA configuration tool. */
540    __tz_SDRAM_N = __SDRAM_End;
541
542    /* Note: There are no secure/non-secure boundaries for ID_CODE.  These symbols are provided for the RA configuration tool. */
543    __tz_ID_CODE_S = ORIGIN(ID_CODE);
544
545    .id_code :
546    {
547        __ID_Code_Start = .;
548        KEEP(*(.id_code*))
549        __ID_Code_End = .;
550    } > ID_CODE
551
552    /* Note: There are no secure/non-secure boundaries for ID_CODE.  These symbols are provided for the RA configuration tool. */
553    __tz_ID_CODE_N = __ID_Code_End;
554
555    /* Symbol required for RA Configuration tool. */
556    __tz_OPTION_SETTING_S = ORIGIN(OPTION_SETTING);
557
558    .option_setting :
559    {
560        __OPTION_SETTING_Start = .;
561        KEEP(*(.option_setting_ofs0))
562        . = PROJECT_SECURE_OR_FLAT ? __OPTION_SETTING_Start + 0x10 : __OPTION_SETTING_Start;
563        KEEP(*(.option_setting_dualsel))
564        . = PROJECT_SECURE_OR_FLAT ? __OPTION_SETTING_Start + 0x34 : __OPTION_SETTING_Start;
565        KEEP(*(.option_setting_sas))
566        __OPTION_SETTING_End = .;
567    } > OPTION_SETTING = 0xFF
568
569    /* Symbol required for RA Configuration tool. */
570    __tz_OPTION_SETTING_N = OPTION_SETTING_START_NS;
571
572    .option_setting_ns :
573    {
574        __OPTION_SETTING_NS_Start = .;
575        KEEP(*(.option_setting_ofs1))
576        . = USE_OPTION_SETTING_NS ? __OPTION_SETTING_NS_Start + 0x10 : __OPTION_SETTING_NS_Start;
577        KEEP(*(.option_setting_banksel))
578        . = USE_OPTION_SETTING_NS ? __OPTION_SETTING_NS_Start + 0x40 : __OPTION_SETTING_NS_Start;
579        KEEP(*(.option_setting_bps0))
580        . = USE_OPTION_SETTING_NS ? __OPTION_SETTING_NS_Start + 0x44 : __OPTION_SETTING_NS_Start;
581        KEEP(*(.option_setting_bps1))
582        . = USE_OPTION_SETTING_NS ? __OPTION_SETTING_NS_Start + 0x48 : __OPTION_SETTING_NS_Start;
583        KEEP(*(.option_setting_bps2))
584        . = USE_OPTION_SETTING_NS ? __OPTION_SETTING_NS_Start + 0x60 : __OPTION_SETTING_NS_Start;
585        KEEP(*(.option_setting_pbps0))
586        . = USE_OPTION_SETTING_NS ? __OPTION_SETTING_NS_Start + 0x64 : __OPTION_SETTING_NS_Start;
587        KEEP(*(.option_setting_pbps1))
588        . = USE_OPTION_SETTING_NS ? __OPTION_SETTING_NS_Start + 0x68 : __OPTION_SETTING_NS_Start;
589        KEEP(*(.option_setting_pbps2))
590        __OPTION_SETTING_NS_End = .;
591    } > OPTION_SETTING = 0xFF
592
593    /* Symbol required for RA Configuration tool. */
594    __tz_OPTION_SETTING_S_S = ORIGIN(OPTION_SETTING_S);
595
596    .option_setting_s :
597    {
598        __OPTION_SETTING_S_Start = .;
599        KEEP(*(.option_setting_ofs1_sec))
600        . = PROJECT_SECURE_OR_FLAT ? __OPTION_SETTING_S_Start + 0x10 : __OPTION_SETTING_S_Start;
601        KEEP(*(.option_setting_banksel_sec))
602        . = PROJECT_SECURE_OR_FLAT ? __OPTION_SETTING_S_Start + 0x40 : __OPTION_SETTING_S_Start;
603        KEEP(*(.option_setting_bps_sec0))
604        . = PROJECT_SECURE_OR_FLAT ? __OPTION_SETTING_S_Start + 0x44 : __OPTION_SETTING_S_Start;
605        KEEP(*(.option_setting_bps_sec1))
606        . = PROJECT_SECURE_OR_FLAT ? __OPTION_SETTING_S_Start + 0x48 : __OPTION_SETTING_S_Start;
607        KEEP(*(.option_setting_bps_sec2))
608        . = PROJECT_SECURE_OR_FLAT ? __OPTION_SETTING_S_Start + 0x60 : __OPTION_SETTING_S_Start;
609        KEEP(*(.option_setting_pbps_sec0))
610        . = PROJECT_SECURE_OR_FLAT ? __OPTION_SETTING_S_Start + 0x64 : __OPTION_SETTING_S_Start;
611        KEEP(*(.option_setting_pbps_sec1))
612        . = PROJECT_SECURE_OR_FLAT ? __OPTION_SETTING_S_Start + 0x68 : __OPTION_SETTING_S_Start;
613        KEEP(*(.option_setting_pbps_sec2))
614        . = PROJECT_SECURE_OR_FLAT ? __OPTION_SETTING_S_Start + 0x80 : __OPTION_SETTING_S_Start;
615        KEEP(*(.option_setting_ofs1_sel))
616        . = PROJECT_SECURE_OR_FLAT ? __OPTION_SETTING_S_Start + 0x90 : __OPTION_SETTING_S_Start;
617        KEEP(*(.option_setting_banksel_sel))
618        . = PROJECT_SECURE_OR_FLAT ? __OPTION_SETTING_S_Start + 0xC0 : __OPTION_SETTING_S_Start;
619        KEEP(*(.option_setting_bps_sel0))
620        . = PROJECT_SECURE_OR_FLAT ? __OPTION_SETTING_S_Start + 0xC4 : __OPTION_SETTING_S_Start;
621        KEEP(*(.option_setting_bps_sel1))
622        . = PROJECT_SECURE_OR_FLAT ? __OPTION_SETTING_S_Start + 0xC8 : __OPTION_SETTING_S_Start;
623        KEEP(*(.option_setting_bps_sel2))
624        __OPTION_SETTING_S_End = .;
625    } > OPTION_SETTING_S = 0xFF
626
627    /* Symbol required for RA Configuration tool. */
628    __tz_OPTION_SETTING_S_N = __OPTION_SETTING_S_End;
629}
630