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