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