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 19ITCM_START = DEFINED(ITCM_START)? ITCM_START : 0; 20ITCM_LENGTH = DEFINED(ITCM_LENGTH)? ITCM_LENGTH : 0; 21DTCM_START = DEFINED(DTCM_START)? DTCM_START : 0; 22DTCM_LENGTH = DEFINED(DTCM_LENGTH)? DTCM_LENGTH : 0; 23NS_OFFSET_START = DEFINED(NS_OFFSET_START) ? NS_OFFSET_START : 0; 24NS_IMAGE_OFFSET = DEFINED(PROJECT_NONSECURE) ? NS_OFFSET_START : 0; 25RAM_NS_BUFFER_BLOCK_LENGTH = DEFINED(RAM_NS_BUFFER_LENGTH) ? ALIGN(RAM_NS_BUFFER_LENGTH, 8192) : 0; 26RAM_NS_BUFFER_LENGTH = DEFINED(RAM_NS_BUFFER_LENGTH) ? RAM_NS_BUFFER_LENGTH : 0; 27RAM_NS_BUFFER_START = RAM_START + RAM_LENGTH - RAM_NS_BUFFER_LENGTH; 28RAM_NS_BUFFER_BLOCK_START = RAM_START + RAM_LENGTH - RAM_NS_BUFFER_BLOCK_LENGTH; 29 30OPTION_SETTING_START_NS = DEFINED(PROJECT_NONSECURE) ? OPTION_SETTING_START : OPTION_SETTING_START + 0x80; 31 32/* This definition is used to avoid moving the counter in OPTION_SETTING regions for projects that should not configure option settings. 33 * Bootloader images do not configure option settings because they are owned by the bootloader. 34 * FSP_BOOTABLE_IMAGE is only defined in bootloader images. */ 35__bl_FSP_BOOTABLE_IMAGE = 1; 36__bln_FSP_BOOTABLE_IMAGE = 1; 37PROJECT_SECURE_OR_FLAT = (!DEFINED(PROJECT_NONSECURE) || DEFINED(PROJECT_SECURE)) && OPTION_SETTING_LENGTH && !DEFINED(FSP_BOOTABLE_IMAGE); 38USE_OPTION_SETTING_NS = DEFINED(PROJECT_NONSECURE) && !DEFINED(FSP_BOOTABLE_IMAGE); 39 40__bl_FLASH_IMAGE_START = !DEFINED(FLASH_BOOTLOADER_LENGTH) ? 0 : 41 FLASH_APPLICATION_IMAGE_NUMBER == 1 ? FLASH_BOOTLOADER_LENGTH + FLASH_BOOTLOADER_HEADER_LENGTH : 42 FLASH_BOOTLOADER_LENGTH + FLASH_BOOTLOADER_SCRATCH_LENGTH + FLASH_APPLICATION_S_LENGTH + FLASH_BOOTLOADER_HEADER_LENGTH; 43__bl_FLASH_IMAGE_LENGTH = !DEFINED(FLASH_BOOTLOADER_LENGTH) ? 0 : 44 FLASH_APPLICATION_S_LENGTH - FLASH_BOOTLOADER_HEADER_LENGTH; 45__bl_FLASH_IMAGE_END = __bl_FLASH_IMAGE_START + __bl_FLASH_IMAGE_LENGTH; 46__bl_XIP_SECONDARY_FLASH_IMAGE_START = !DEFINED(FLASH_BOOTLOADER_LENGTH) ? 0 : 47 FLASH_BOOTLOADER_LENGTH + FLASH_APPLICATION_S_LENGTH + FLASH_BOOTLOADER_HEADER_LENGTH; 48__bl_XIP_SECONDARY_FLASH_IMAGE_END = __bl_XIP_SECONDARY_FLASH_IMAGE_START + __bl_FLASH_IMAGE_LENGTH; 49__bl_FLASH_NS_START = !DEFINED(FLASH_BOOTLOADER_LENGTH) ? 0 : 50 FLASH_APPLICATION_NS_LENGTH == 0 ? __bl_FLASH_IMAGE_END : 51 __bl_FLASH_IMAGE_START - FLASH_BOOTLOADER_HEADER_LENGTH + FLASH_APPLICATION_S_LENGTH; 52__bl_FLASH_NSC_START = !DEFINED(FLASH_BOOTLOADER_LENGTH) ? 0 : 53 FLASH_APPLICATION_NS_LENGTH == 0 ? __bl_FLASH_IMAGE_END : 54 __bl_FLASH_NS_START - FLASH_APPLICATION_NSC_LENGTH; 55__bl_RAM_NS_START = !DEFINED(FLASH_BOOTLOADER_LENGTH) ? 0 : 56 FLASH_APPLICATION_NS_LENGTH == 0 ? RAM_START + RAM_LENGTH : 57 RAM_START + RAM_LENGTH - RAM_APPLICATION_NS_LENGTH; 58__bl_RAM_NSC_START = !DEFINED(FLASH_BOOTLOADER_LENGTH) ? 0 : 59 FLASH_APPLICATION_NS_LENGTH == 0 ? RAM_START + RAM_LENGTH : 60 __bl_RAM_NS_START - RAM_APPLICATION_NSC_LENGTH; 61__bl_FLASH_NS_IMAGE_START = !DEFINED(FLASH_BOOTLOADER_LENGTH) ? 0 : 62 FLASH_APPLICATION_NS_LENGTH == 0 ? __bl_FLASH_IMAGE_END : 63 __bl_FLASH_NS_START + FLASH_BOOTLOADER_HEADER_LENGTH_2; 64__bln_FLASH_IMAGE_START = __bl_FLASH_NS_IMAGE_START; 65__bln_FLASH_IMAGE_LENGTH = !DEFINED(FLASH_BOOTLOADER_LENGTH) ? 0 : 66 FLASH_APPLICATION_NS_LENGTH == 0 ? __bl_FLASH_IMAGE_END : 67 FLASH_APPLICATION_NS_LENGTH - FLASH_BOOTLOADER_HEADER_LENGTH_2; 68 69XIP_SECONDARY_SLOT_IMAGE = DEFINED(XIP_SECONDARY_SLOT_IMAGE) ? XIP_SECONDARY_SLOT_IMAGE : 0; 70FLASH_ORIGIN = !DEFINED(FLASH_IMAGE_START) ? FLASH_START : 71 XIP_SECONDARY_SLOT_IMAGE == 1 ? XIP_SECONDARY_FLASH_IMAGE_START : 72 FLASH_IMAGE_START; 73LIMITED_FLASH_LENGTH = DEFINED(FLASH_IMAGE_LENGTH) ? FLASH_IMAGE_LENGTH : 74 DEFINED(FLASH_BOOTLOADER_LENGTH) ? FLASH_BOOTLOADER_LENGTH : 75 FLASH_LENGTH; 76 77/* Define memory regions. */ 78MEMORY 79{ 80 ITCM (rx) : ORIGIN = ITCM_START + NS_IMAGE_OFFSET, LENGTH = ITCM_LENGTH 81 DTCM (rwx) : ORIGIN = DTCM_START + NS_IMAGE_OFFSET, LENGTH = DTCM_LENGTH 82 FLASH (rx) : ORIGIN = FLASH_ORIGIN + NS_IMAGE_OFFSET, LENGTH = LIMITED_FLASH_LENGTH 83 RAM (rwx) : ORIGIN = RAM_START + NS_IMAGE_OFFSET, LENGTH = RAM_LENGTH 84 DATA_FLASH (rx) : ORIGIN = DATA_FLASH_START + NS_IMAGE_OFFSET, LENGTH = DATA_FLASH_LENGTH 85 QSPI_FLASH (rx) : ORIGIN = QSPI_FLASH_START, LENGTH = QSPI_FLASH_PRV_LENGTH 86 OSPI_DEVICE_0 (rx) : ORIGIN = OSPI_DEVICE_0_START, LENGTH = OSPI_DEVICE_0_PRV_LENGTH 87 OSPI_DEVICE_1 (rx) : ORIGIN = OSPI_DEVICE_1_START, LENGTH = OSPI_DEVICE_1_PRV_LENGTH 88 OSPI_DEVICE_0_RAM (rwx) : ORIGIN = OSPI_DEVICE_0_START, LENGTH = OSPI_DEVICE_0_PRV_LENGTH 89 OSPI_DEVICE_1_RAM (rwx) : ORIGIN = OSPI_DEVICE_1_START, LENGTH = OSPI_DEVICE_1_PRV_LENGTH 90 SDRAM (rwx) : ORIGIN = SDRAM_START, LENGTH = SDRAM_LENGTH 91 OPTION_SETTING (r) : ORIGIN = OPTION_SETTING_START + NS_IMAGE_OFFSET, LENGTH = OPTION_SETTING_LENGTH 92 OPTION_SETTING_OFS (r) : ORIGIN = OPTION_SETTING_START + NS_IMAGE_OFFSET, LENGTH = 0x18 93 OPTION_SETTING_SAS (r) : ORIGIN = OPTION_SETTING_START + NS_IMAGE_OFFSET + 0x34, LENGTH = OPTION_SETTING_LENGTH - 0x34 94 OPTION_SETTING_S (r) : ORIGIN = OPTION_SETTING_S_START + NS_IMAGE_OFFSET, LENGTH = OPTION_SETTING_S_LENGTH 95 ID_CODE (rx) : ORIGIN = ID_CODE_START, LENGTH = ID_CODE_LENGTH 96} 97 98/* Library configurations */ 99GROUP(libc.a libm.a libnosys.a) 100 101/* Linker script to place sections and symbol values. Should be used together 102 * with other linker script that defines memory regions FLASH and RAM. 103 * It references following symbols, which must be DEFINED in code: 104 * Reset_Handler : Entry of reset handler 105 * 106 * It defines following symbols, which code can use without definition: 107 * __exidx_start 108 * __exidx_end 109 * __copy_table_start__ 110 * __copy_table_end__ 111 * __zero_table_start__ 112 * __zero_table_end__ 113 * __etext 114 * __data_start__ 115 * __preinit_array_start 116 * __preinit_array_end 117 * __init_array_start 118 * __init_array_end 119 * __fini_array_start 120 * __fini_array_end 121 * __data_end__ 122 * __bss_start__ 123 * __bss_end__ 124 * __HeapLimit 125 * __StackLimit 126 * __StackTop 127 * __stack 128 * __Vectors_End 129 * __Vectors_Size 130 * __qspi_flash_start__ 131 * __qspi_flash_end__ 132 * __qspi_flash_code_size__ 133 * __qspi_region_max_size__ 134 * __qspi_region_start_address__ 135 * __qspi_region_end_address__ 136 * __ospi_device_0_start__ 137 * __ospi_device_0_end__ 138 * __ospi_device_0_code_size__ 139 * __ospi_device_0_region_max_size__ 140 * __ospi_device_0_region_start_address__ 141 * __ospi_device_0_region_end_address__ 142 * __ospi_device_1_start__ 143 * __ospi_device_1_end__ 144 * __ospi_device_1_code_size__ 145 * __ospi_device_1_region_max_size__ 146 * __ospi_device_1_region_start_address__ 147 * __ospi_device_1_region_end_address__ 148 */ 149ENTRY(Reset_Handler) 150 151SECTIONS 152{ 153 .text : 154 { 155 __tz_FLASH_S = ABSOLUTE(FLASH_START); 156 __ROM_Start = .; 157 158 /* Even though the vector table is not 256 entries (1KB) long, we still allocate that much 159 * space because ROM registers are at address 0x400 and there is very little space 160 * in between. */ 161 KEEP(*(.fixed_vectors*)) 162 KEEP(*(.application_vectors*)) 163 __Vectors_End = .; 164 165 /* ROM Registers start at address 0x00000400 for devices that do not have the OPTION_SETTING region. */ 166 . = OPTION_SETTING_LENGTH > 0 ? . : __ROM_Start + 0x400; 167 KEEP(*(.rom_registers*)) 168 169 /* Reserving 0x100 bytes of space for ROM registers. */ 170 . = OPTION_SETTING_LENGTH > 0 ? . : __ROM_Start + 0x500; 171 172 /* Allocate flash write-boundary-aligned 173 * space for sce9 wrapped public keys for mcuboot if the module is used. 174 */ 175 . = ALIGN(128); 176 KEEP(*(.mcuboot_sce9_key*)) 177 178 *(.text*) 179 180 KEEP(*(.version)) 181 KEEP(*(.init)) 182 KEEP(*(.fini)) 183 184 /* section information for finsh shell */ 185 . = ALIGN(4); 186 __fsymtab_start = .; 187 KEEP(*(FSymTab)) 188 __fsymtab_end = .; 189 190 . = ALIGN(4); 191 __vsymtab_start = .; 192 KEEP(*(VSymTab)) 193 __vsymtab_end = .; 194 195 /* section information for initial. */ 196 . = ALIGN(4); 197 __rt_init_start = .; 198 KEEP(*(SORT(.rti_fn*))) 199 __rt_init_end = .; 200 201 . = ALIGN(4); 202 KEEP(*(FalPartTable)) 203 204 /* .ctors */ 205 *crtbegin.o(.ctors) 206 *crtbegin?.o(.ctors) 207 *(EXCLUDE_FILE(*crtend?.o *crtend.o) .ctors) 208 *(SORT(.ctors.*)) 209 *(.ctors) 210 211 /* .dtors */ 212 *crtbegin.o(.dtors) 213 *crtbegin?.o(.dtors) 214 *(EXCLUDE_FILE(*crtend?.o *crtend.o) .dtors) 215 *(SORT(.dtors.*)) 216 *(.dtors) 217 218 *(.rodata*) 219 __usb_dev_descriptor_start_fs = .; 220 KEEP(*(.usb_device_desc_fs*)) 221 __usb_cfg_descriptor_start_fs = .; 222 KEEP(*(.usb_config_desc_fs*)) 223 __usb_interface_descriptor_start_fs = .; 224 KEEP(*(.usb_interface_desc_fs*)) 225 __usb_descriptor_end_fs = .; 226 __usb_dev_descriptor_start_hs = .; 227 KEEP(*(.usb_device_desc_hs*)) 228 __usb_cfg_descriptor_start_hs = .; 229 KEEP(*(.usb_config_desc_hs*)) 230 __usb_interface_descriptor_start_hs = .; 231 KEEP(*(.usb_interface_desc_hs*)) 232 __usb_descriptor_end_hs = .; 233 234 KEEP(*(.eh_frame*)) 235 236 /* new GCC version uses .init_array */ 237 PROVIDE(__ctors_start__ = .); 238 KEEP (*(SORT(.init_array.*))) 239 KEEP (*(.init_array)) 240 PROVIDE(__ctors_end__ = .); 241 242 . = ALIGN(4); 243 244 __ROM_End = .; 245 } > FLASH = 0xFF 246 247 __Vectors_Size = __Vectors_End - __Vectors; 248 249 . = .; 250 __itcm_data_pre_location = .; 251 252 /* Initialized ITCM data. */ 253 /* Aligned to FCACHE2 for RA8. */ 254 .itcm_data : ALIGN(16) 255 { 256 /* Start of ITCM Secure Trustzone region. */ 257 __tz_ITCM_S = ABSOLUTE(ITCM_START); 258 259 /* All ITCM data start */ 260 __itcm_data_start = .; 261 262 KEEP(*(.itcm_data*)) 263 264 /* Pad to eight byte alignment in case of ECC initialization. Fill zero. */ 265 . = ALIGN(8); 266 267 /* All ITCM data end */ 268 __itcm_data_end = .; 269 270 /* 271 * Start of the ITCM Non-Secure Trustzone region. 272 * ITCM_NS_START can be used to set a fixed address for non-secure ITCM in secure projects or flat projects. 273 */ 274 __tz_ITCM_N = DEFINED(ITCM_NS_START) ? ABSOLUTE(ITCM_NS_START) : ALIGN(__itcm_data_end, 8192); 275 } > ITCM AT > FLASH = 0x00 276 277 /* Addresses exported for ITCM initialization. */ 278 __itcm_data_init_start = LOADADDR(.itcm_data); 279 __itcm_data_init_end = LOADADDR(.itcm_data) + SIZEOF(.itcm_data); 280 281 ASSERT(ORIGIN(ITCM) % 8 == 0, "ITCM memory region origin must be aligned to 8 bytes.") 282 ASSERT(LENGTH(ITCM) % 8 == 0, "ITCM memory region length must be a multiple of 8 bytes.") 283 ASSERT(LOADADDR(.itcm_data) % 16 == 0, ".itcm_data section must be aligned to 16 bytes.") 284 ASSERT(SIZEOF(.itcm_data) % 8 == 0, ".itcm_data section size must be a multiple of 8 bytes.") 285 286 /* Restore location counter. */ 287 /* If ITCM is not present, this will be the address stored in '.' before ALIGN was attempted. */ 288 /* If ITCM is present, this will be the absolute address that follows the ITCM ROM location. */ 289 . = (SIZEOF(.itcm_data) > 0) ? __itcm_data_init_end : __itcm_data_pre_location; 290 291 .ARM.extab : 292 { 293 *(.ARM.extab* .gnu.linkonce.armextab.*) 294 } > FLASH 295 296 __exidx_start = .; 297 .ARM.exidx : 298 { 299 *(.ARM.exidx* .gnu.linkonce.armexidx.*) 300 } > FLASH 301 __exidx_end = .; 302 303 /* To copy multiple ROM to RAM sections, 304 * uncomment .copy.table section and, 305 * define __STARTUP_COPY_MULTIPLE in startup_ARMCMx.S */ 306 /* 307 .copy.table : 308 { 309 . = ALIGN(4); 310 __copy_table_start__ = .; 311 LONG (__etext) 312 LONG (__data_start__) 313 LONG (__data_end__ - __data_start__) 314 LONG (__etext2) 315 LONG (__data2_start__) 316 LONG (__data2_end__ - __data2_start__) 317 __copy_table_end__ = .; 318 } > FLASH 319 */ 320 321 /* To clear multiple BSS sections, 322 * uncomment .zero.table section and, 323 * define __STARTUP_CLEAR_BSS_MULTIPLE in startup_ARMCMx.S */ 324 /* 325 .zero.table : 326 { 327 . = ALIGN(4); 328 __zero_table_start__ = .; 329 LONG (__bss_start__) 330 LONG (__bss_end__ - __bss_start__) 331 LONG (__bss2_start__) 332 LONG (__bss2_end__ - __bss2_start__) 333 __zero_table_end__ = .; 334 } > FLASH 335 */ 336 337 __etext = .; 338 339 __tz_RAM_S = ORIGIN(RAM); 340 341 /* If DTC is used, put the DTC vector table at the start of SRAM. 342 This avoids memory holes due to 1K alignment required by it. */ 343 .fsp_dtc_vector_table (NOLOAD) : 344 { 345 . = ORIGIN(RAM); 346 *(.fsp_dtc_vector_table) 347 } > RAM 348 349 /* Initialized data section. */ 350 .data : 351 { 352 __data_start__ = .; 353 . = ALIGN(4); 354 355 __Code_In_RAM_Start = .; 356 357 KEEP(*(.code_in_ram*)) 358 __Code_In_RAM_End = .; 359 360 *(vtable) 361 /* Don't use *(.data*) because it will place data meant for .data_flash in this section. */ 362 *(.data.*) 363 *(.data) 364 365 . = ALIGN(4); 366 /* preinit data */ 367 PROVIDE_HIDDEN (__preinit_array_start = .); 368 KEEP(*(.preinit_array)) 369 PROVIDE_HIDDEN (__preinit_array_end = .); 370 371 . = ALIGN(4); 372 /* init data */ 373 PROVIDE_HIDDEN (__init_array_start = .); 374 KEEP(*(SORT(.init_array.*))) 375 KEEP(*(.init_array)) 376 PROVIDE_HIDDEN (__init_array_end = .); 377 378 379 . = ALIGN(4); 380 /* finit data */ 381 PROVIDE_HIDDEN (__fini_array_start = .); 382 KEEP(*(SORT(.fini_array.*))) 383 KEEP(*(.fini_array)) 384 PROVIDE_HIDDEN (__fini_array_end = .); 385 386 KEEP(*(.jcr*)) 387 388 . = ALIGN(4); 389 390 /* All data end */ 391 __data_end__ = .; 392 393 } > RAM AT > FLASH 394 395 . = .; 396 __dtcm_data_pre_location = LOADADDR(.data) + SIZEOF(.data); 397 398 /* Initialized DTCM data. */ 399 /* Aligned to FCACHE2 for RA8. */ 400 .dtcm_data : ALIGN(16) 401 { 402 /* Start of DTCM Secure Trustzone region. */ 403 __tz_DTCM_S = ABSOLUTE(DTCM_START); 404 405 /* Initialized DTCM data start */ 406 __dtcm_data_start = .; 407 408 KEEP(*(.dtcm_data*)) 409 410 /* Pad to eight byte alignment in case of ECC initialization. Fill zero. */ 411 . = ALIGN(8); 412 413 /* Initialized DTCM data end */ 414 __dtcm_data_end = .; 415 } > DTCM AT > FLASH = 0x00 416 417 . = __dtcm_data_end; 418 /* Uninitialized DTCM data. */ 419 /* ALIGN appears on the left side of the colon because it is being used to assign the VMA directly, as opposed to a right side appearance which would control the LMA. */ 420 .dtcm_bss ALIGN(8) (NOLOAD) : 421 { 422 /* Uninitialized DTCM data start */ 423 __dtcm_bss_start = .; 424 425 KEEP(*(.dtcm_bss*)) 426 427 /* Pad to eight byte alignment in case of ECC initialization. No fill because of NOLOAD. */ 428 . = ALIGN(8); 429 430 /* Uninitialized DTCM data end */ 431 __dtcm_bss_end = .; 432 433 /* 434 * Start of the DTCM Non-Secure Trustzone region. 435 * DTCM_NS_START can be used to set a fixed address for non-secure DTCM in secure projects or flat projects. 436 */ 437 __tz_DTCM_N = DEFINED(DTCM_NS_START) ? ABSOLUTE(DTCM_NS_START) : ALIGN(__dtcm_bss_end, 8192); 438 } > DTCM 439 440 /* Addresses exported for DTCM initialization. */ 441 __dtcm_data_init_start = LOADADDR(.dtcm_data); 442 __dtcm_data_init_end = LOADADDR(.dtcm_data) + SIZEOF(.dtcm_data); 443 444 ASSERT(ORIGIN(DTCM) % 8 == 0, "DTCM memory region origin must be aligned to 8 bytes.") 445 ASSERT(LENGTH(DTCM) % 8 == 0, "DTCM memory region length must be a multiple of 8 bytes.") 446 ASSERT(LOADADDR(.dtcm_bss) == ADDR(.dtcm_bss), ".dtcm_bss has (VMA != LMA) but should be NOLOAD (VMA == LMA).") 447 ASSERT(LOADADDR(.dtcm_data) % 16 == 0, ".dtcm_data section must be aligned to 16 bytes.") 448 ASSERT(SIZEOF(.dtcm_data) % 8 == 0, ".dtcm_data section size must be a multiple of 8 bytes.") 449 ASSERT(LOADADDR(.dtcm_bss) % 8 == 0, ".dtcm_bss section must be aligned to 8 bytes.") 450 ASSERT(SIZEOF(.dtcm_bss) % 8 == 0, ".dtcm_bss section size must be a multiple of 8 bytes.") 451 ASSERT(__dtcm_bss_start == __dtcm_data_end, ".dtcm_bss section is not adjacent to .dtcm_data section.") 452 453 /* Restore location counter. */ 454 /* If DTCM is not present, this will be the address stored in '.' before ALIGN was attempted. */ 455 /* If DTCM is present, this will be the absolute address that follows the DTCM ROM location. */ 456 . = (SIZEOF(.dtcm_data) > 0) ? __dtcm_data_init_end : __dtcm_data_pre_location; 457 458 /* TrustZone Secure Gateway Stubs Section */ 459 460 /* Store location counter for SPI non-retentive sections. */ 461 sgstubs_pre_location = .; 462 463 /* Determine the secure gateway stubs address either by the provided linker variable or the next 1024-byte block. */ 464 SGSTUBS_LOC = (DEFINED(PROJECT_SECURE) && DEFINED(FLASH_NSC_START)) ? ABSOLUTE(FLASH_NSC_START) : ALIGN(1024); 465 .gnu.sgstubs SGSTUBS_LOC : ALIGN(1024) 466 { 467 __tz_FLASH_C = DEFINED(FLASH_NSC_START) ? ABSOLUTE(FLASH_NSC_START) : __RESERVE_NS_RAM ? ABSOLUTE(FLASH_START + FLASH_LENGTH) : ALIGN(1024); 468 _start_sg = .; 469 *(.gnu.sgstubs*) 470 . = ALIGN(32); 471 _end_sg = .; 472 } > FLASH 473 474 __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); 475 FLASH_NS_IMAGE_START = DEFINED(FLASH_NS_IMAGE_START) ? FLASH_NS_IMAGE_START : __tz_FLASH_N; 476 477 /* Note: There are no secure/non-secure boundaries for QSPI. These symbols are provided for the RA configuration tool. */ 478 __tz_QSPI_FLASH_S = ORIGIN(QSPI_FLASH); 479 480 /* QSPI_FLASH section to be downloaded via debugger */ 481 .qspi_flash : 482 { 483 __qspi_flash_start__ = .; 484 KEEP(*(.qspi_flash*)) 485 KEEP(*(.code_in_qspi*)) 486 __qspi_flash_end__ = .; 487 } > QSPI_FLASH 488 __qspi_flash_code_size__ = __qspi_flash_end__ - __qspi_flash_start__; 489 490 /* QSPI_FLASH non-retentive section, creates a copy in internal flash that can be copied to QSPI */ 491 __qspi_flash_code_addr__ = sgstubs_pre_location; 492 .qspi_non_retentive : AT(__qspi_flash_code_addr__) 493 { 494 __qspi_non_retentive_start__ = .; 495 KEEP(*(.qspi_non_retentive*)) 496 __qspi_non_retentive_end__ = .; 497 } > QSPI_FLASH 498 __qspi_non_retentive_size__ = __qspi_non_retentive_end__ - __qspi_non_retentive_start__; 499 500 __qspi_region_max_size__ = 0x4000000; /* Must be the same as defined in MEMORY above */ 501 __qspi_region_start_address__ = __qspi_flash_start__; 502 __qspi_region_end_address__ = __qspi_flash_start__ + __qspi_region_max_size__; 503 504 /* Note: There are no secure/non-secure boundaries for QSPI. These symbols are provided for the RA configuration tool. */ 505 __tz_QSPI_FLASH_N = __qspi_non_retentive_end__; 506 507 /* Support for OctaRAM */ 508 .OSPI_DEVICE_0_NO_LOAD (NOLOAD): 509 { 510 . = ALIGN(4); 511 __ospi_device_0_start__ = .; 512 *(.ospi_device_0_no_load*) 513 . = ALIGN(4); 514 __ospi_device_0_end__ = .; 515 } > OSPI_DEVICE_0_RAM 516 517 .OSPI_DEVICE_1_NO_LOAD (NOLOAD): 518 { 519 . = ALIGN(4); 520 __ospi_device_1_start__ = .; 521 *(.ospi_device_1_no_load*) 522 . = ALIGN(4); 523 __ospi_device_1_end__ = .; 524 } > OSPI_DEVICE_1_RAM 525 526 /* Note: There are no secure/non-secure boundaries for QSPI. These symbols are provided for the RA configuration tool. */ 527 __tz_OSPI_DEVICE_0_S = ORIGIN(OSPI_DEVICE_0); 528 529 /* OSPI_DEVICE_0 section to be downloaded via debugger */ 530 .OSPI_DEVICE_0 : 531 { 532 __ospi_device_0_start__ = .; 533 KEEP(*(.ospi_device_0*)) 534 KEEP(*(.code_in_ospi_device_0*)) 535 __ospi_device_0_end__ = .; 536 } > OSPI_DEVICE_0 537 __ospi_device_0_code_size__ = __ospi_device_0_end__ - __ospi_device_0_start__; 538 539 /* OSPI_DEVICE_0 non-retentive section, creates a copy in internal flash that can be copied to OSPI */ 540 __ospi_device_0_code_addr__ = sgstubs_pre_location + (SIZEOF(.qspi_non_retentive)); 541 .ospi_device_0_non_retentive : AT(__ospi_device_0_code_addr__) 542 { 543 __ospi_device_0_non_retentive_start__ = .; 544 KEEP(*(.ospi_device_0_non_retentive*)) 545 __ospi_device_0_non_retentive_end__ = .; 546 } > OSPI_DEVICE_0 547 __ospi_device_0_non_retentive_size__ = __ospi_device_0_non_retentive_end__ - __ospi_device_0_non_retentive_start__; 548 549 __ospi_device_0_region_max_size__ = 0x8000000; /* Must be the same as defined in MEMORY above */ 550 __ospi_device_0_region_start_address__ = __ospi_device_0_start__; 551 __ospi_device_0_region_end_address__ = __ospi_device_0_start__ + __ospi_device_0_region_max_size__; 552 553 /* Note: There are no secure/non-secure boundaries for OSPI. These symbols are provided for the RA configuration tool. */ 554 __tz_OSPI_DEVICE_0_N = __ospi_device_0_non_retentive_end__; 555 556 /* Note: There are no secure/non-secure boundaries for OSPI. These symbols are provided for the RA configuration tool. */ 557 __tz_OSPI_DEVICE_1_S = ORIGIN(OSPI_DEVICE_1); 558 559 /* OSPI_DEVICE_1 section to be downloaded via debugger */ 560 .OSPI_DEVICE_1 : 561 { 562 __ospi_device_1_start__ = .; 563 KEEP(*(.ospi_device_1*)) 564 KEEP(*(.code_in_ospi_device_1*)) 565 __ospi_device_1_end__ = .; 566 } > OSPI_DEVICE_1 567 __ospi_device_1_code_size__ = __ospi_device_1_end__ - __ospi_device_1_start__; 568 569 /* OSPI_DEVICE_1 non-retentive section, creates a copy in internal flash that can be copied to OSPI */ 570 __ospi_device_1_code_addr__ = sgstubs_pre_location + (SIZEOF(.qspi_non_retentive) + SIZEOF(.ospi_device_0_non_retentive)); 571 .ospi_device_1_non_retentive : AT(__ospi_device_1_code_addr__) 572 { 573 __ospi_device_1_non_retentive_start__ = .; 574 KEEP(*(.ospi_device_1_non_retentive*)) 575 __ospi_device_1_non_retentive_end__ = .; 576 } > OSPI_DEVICE_1 577 __ospi_device_1_non_retentive_size__ = __ospi_device_1_non_retentive_end__ - __ospi_device_1_non_retentive_start__; 578 579 __ospi_device_1_region_max_size__ = 0x10000000; /* Must be the same as defined in MEMORY above */ 580 __ospi_device_1_region_start_address__ = __ospi_device_1_start__; 581 __ospi_device_1_region_end_address__ = __ospi_device_1_start__ + __ospi_device_1_region_max_size__; 582 583 /* Note: There are no secure/non-secure boundaries for OSPI. These symbols are provided for the RA configuration tool. */ 584 __tz_OSPI_DEVICE_1_N = __ospi_device_1_non_retentive_end__; 585 586 .noinit (NOLOAD): 587 { 588 . = ALIGN(4); 589 __noinit_start = .; 590 KEEP(*(.noinit*)) 591 . = ALIGN(8); 592 /* Place the FreeRTOS heap here so that the __HeapLimit calculation does not include the freertos heap. */ 593 KEEP(*(.heap.*)) 594 __noinit_end = .; 595 } > RAM 596 597 . = .; 598 __nocache_pre_location = .; 599 .nocache ALIGN(32) (NOLOAD): 600 { 601 __nocache_start = .; 602 603 KEEP(*(.nocache)) 604 605 . = ALIGN(32); 606 __nocache_end = .; 607 } > RAM 608 . = (SIZEOF(.nocache) > 0) ? __nocache_end : __nocache_pre_location; 609 610 .bss : 611 { 612 . = ALIGN(4); 613 __bss_start__ = .; 614 *(.bss*) 615 *(COMMON) 616 . = ALIGN(4); 617 __bss_end__ = .; 618 } > RAM 619 620 .heap (NOLOAD): 621 { 622 . = ALIGN(8); 623 __HeapBase = .; 624 /* Place the STD heap here. */ 625 KEEP(*(.heap)) 626 __HeapLimit = .; 627 } > RAM 628 629 /* Stacks are stored in this section. */ 630 .stack_dummy (NOLOAD): 631 { 632 . = ALIGN(8); 633 __StackLimit = .; 634 /* Main stack */ 635 KEEP(*(.stack)) 636 __StackTop = .; 637 /* Thread stacks */ 638 KEEP(*(.stack*)) 639 __StackTopAll = .; 640 } > RAM 641 642 PROVIDE(__stack = __StackTopAll); 643 644 /* This symbol represents the end of user allocated RAM. The RAM after this symbol can be used 645 at run time for things such as ThreadX memory pool allocations. */ 646 __RAM_segment_used_end__ = ALIGN(__StackTopAll , 4); 647 648 /* RAM_NSC_START can be used to set a fixed address for non-secure callable RAM in secure projects. 649 * If it is not specified, the address for NSC RAM is the end of RAM aligned to a 1K boundary. 650 * In flat projects that require non-secure RAM, this variable is set to the start of non-secure RAM. */ 651 __tz_RAM_C = DEFINED(RAM_NSC_START) ? ABSOLUTE(RAM_NSC_START - RAM_NS_BUFFER_BLOCK_LENGTH) : __RESERVE_NS_RAM ? ABSOLUTE(RAM_NS_BUFFER_BLOCK_START) : ALIGN(__RAM_segment_used_end__, 1024); 652 653 /* RAM_NS_START can be used to set a fixed address for non-secure RAM in secure projects or flat projects. 654 * RAM_NS_BUFFER_BLOCK_LENGTH is used to allocate non-secure buffers in a flat project. If it is not 655 * specified, the address for NSC RAM is the end of RAM aligned to an 8K boundary. 656 * In flat projects that require non-secure RAM, this variable is set to the start of non-secure RAM. */ 657 __tz_RAM_N = DEFINED(RAM_NS_START) ? ABSOLUTE(RAM_NS_START - RAM_NS_BUFFER_BLOCK_LENGTH) : __RESERVE_NS_RAM ? ABSOLUTE(RAM_NS_BUFFER_BLOCK_START) : ALIGN(__tz_RAM_C, 8192); 658 659 /* Non-secure buffers must be in non-secure RAM. This is primarily used for the EDMAC in flat projects. 660 * The EDMAC is a non-secure bus master and can only access non-secure RAM. */ 661 .ns_buffer (NOLOAD): 662 { 663 /* Allocate RAM on a 32-byte boundary to help with placement of Ethernet buffers. */ 664 . = __RESERVE_NS_RAM ? ABSOLUTE(RAM_NS_BUFFER_START & 0xFFFFFFE0) : .; 665 666 KEEP(*(.ns_buffer*)) 667 } > RAM 668 669 /* Data flash. */ 670 .data_flash : 671 { 672 . = ORIGIN(DATA_FLASH); 673 __tz_DATA_FLASH_S = .; 674 __Data_Flash_Start = .; 675 KEEP(*(.data_flash*)) 676 __Data_Flash_End = .; 677 678 __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); 679 } > DATA_FLASH 680 681 /* Note: There are no secure/non-secure boundaries for SDRAM. These symbols are provided for the RA configuration tool. */ 682 __tz_SDRAM_S = ORIGIN(SDRAM); 683 684 /* SDRAM */ 685 .sdram (NOLOAD): 686 { 687 __SDRAM_Start = .; 688 KEEP(*(.sdram*)) 689 KEEP(*(.frame*)) 690 __SDRAM_End = .; 691 } > SDRAM 692 693 . = .; 694 __nocache_sdram_pre_location = .; 695 .nocache_sdram ALIGN(32) (NOLOAD): 696 { 697 __nocache_sdram_start = .; 698 699 KEEP(*(.nocache_sdram)) 700 701 . = ALIGN(32); 702 __nocache_sdram_end = .; 703 } > SDRAM 704 . = (SIZEOF(.nocache_sdram) > 0) ? __nocache_sdram_end : __nocache_sdram_pre_location; 705 706 /* Note: There are no secure/non-secure boundaries for SDRAM. These symbols are provided for the RA configuration tool. */ 707 __tz_SDRAM_N = __SDRAM_End; 708 709 /* Note: There are no secure/non-secure boundaries for ID_CODE. These symbols are provided for the RA configuration tool. */ 710 __tz_ID_CODE_S = ORIGIN(ID_CODE); 711 712 /* Note: There are no secure/non-secure boundaries for ID_CODE. These symbols are provided for the RA configuration tool. 713 * Set this symbol to the same value as __tz_ID_CODE_S so the RA configuration tool does not split the ID_CODE 714 * memory region between TrustZone projects. */ 715 __tz_ID_CODE_N = __tz_ID_CODE_S; 716 717 .id_code : 718 { 719 __ID_Code_Start = .; 720 KEEP(*(.id_code*)) 721 __ID_Code_End = .; 722 } > ID_CODE 723 724 725 /* Symbol required for RA Configuration tool. */ 726 __tz_OPTION_SETTING_S = ORIGIN(OPTION_SETTING_OFS); 727 728 .option_setting_ofs : 729 { 730 __OPTION_SETTING_OFS_Start = .; 731 KEEP(*(.option_setting_ofs0)) 732 . = PROJECT_SECURE_OR_FLAT ? __OPTION_SETTING_OFS_Start + 0x04 : __OPTION_SETTING_OFS_Start; 733 KEEP(*(.option_setting_ofs2)) 734 . = PROJECT_SECURE_OR_FLAT ? __OPTION_SETTING_OFS_Start + 0x10 : __OPTION_SETTING_OFS_Start; 735 KEEP(*(.option_setting_dualsel)) 736 __OPTION_SETTING_OFS_End = .; 737 } > OPTION_SETTING_OFS = 0xFF 738 739 .option_setting_sas : 740 { 741 __OPTION_SETTING_SAS_Start = .; 742 KEEP(*(.option_setting_sas)) 743 __OPTION_SETTING_SAS_End = .; 744 } > OPTION_SETTING_SAS = 0xFF 745 746 /* Symbol required for RA Configuration tool. */ 747 __tz_OPTION_SETTING_N = ABSOLUTE(OPTION_SETTING_START_NS); 748 749 .option_setting_ns : 750 { 751 __OPTION_SETTING_NS_Start = .; 752 KEEP(*(.option_setting_ofs1)) 753 . = USE_OPTION_SETTING_NS ? __OPTION_SETTING_NS_Start + 0x04 : __OPTION_SETTING_NS_Start; 754 KEEP(*(.option_setting_ofs3)) 755 . = USE_OPTION_SETTING_NS ? __OPTION_SETTING_NS_Start + 0x10 : __OPTION_SETTING_NS_Start; 756 KEEP(*(.option_setting_banksel)) 757 . = USE_OPTION_SETTING_NS ? __OPTION_SETTING_NS_Start + 0x40 : __OPTION_SETTING_NS_Start; 758 KEEP(*(.option_setting_bps0)) 759 . = USE_OPTION_SETTING_NS ? __OPTION_SETTING_NS_Start + 0x44 : __OPTION_SETTING_NS_Start; 760 KEEP(*(.option_setting_bps1)) 761 . = USE_OPTION_SETTING_NS ? __OPTION_SETTING_NS_Start + 0x48 : __OPTION_SETTING_NS_Start; 762 KEEP(*(.option_setting_bps2)) 763 . = USE_OPTION_SETTING_NS ? __OPTION_SETTING_NS_Start + 0x4C : __OPTION_SETTING_NS_Start; 764 KEEP(*(.option_setting_bps3)) 765 . = USE_OPTION_SETTING_NS ? __OPTION_SETTING_NS_Start + 0x60 : __OPTION_SETTING_NS_Start; 766 KEEP(*(.option_setting_pbps0)) 767 . = USE_OPTION_SETTING_NS ? __OPTION_SETTING_NS_Start + 0x64 : __OPTION_SETTING_NS_Start; 768 KEEP(*(.option_setting_pbps1)) 769 . = USE_OPTION_SETTING_NS ? __OPTION_SETTING_NS_Start + 0x68 : __OPTION_SETTING_NS_Start; 770 KEEP(*(.option_setting_pbps2)) 771 . = USE_OPTION_SETTING_NS ? __OPTION_SETTING_NS_Start + 0x6C : __OPTION_SETTING_NS_Start; 772 KEEP(*(.option_setting_pbps3)) 773 __OPTION_SETTING_NS_End = .; 774 } > OPTION_SETTING = 0xFF 775 776 /* Symbol required for RA Configuration tool. */ 777 __tz_OPTION_SETTING_S_S = ORIGIN(OPTION_SETTING_S); 778 779 .option_setting_s : 780 { 781 __OPTION_SETTING_S_Start = .; 782 KEEP(*(.option_setting_ofs1_sec)) 783 . = PROJECT_SECURE_OR_FLAT ? __OPTION_SETTING_S_Start + 0x04 : __OPTION_SETTING_S_Start; 784 KEEP(*(.option_setting_ofs3_sec)) 785 . = PROJECT_SECURE_OR_FLAT ? __OPTION_SETTING_S_Start + 0x10 : __OPTION_SETTING_S_Start; 786 KEEP(*(.option_setting_banksel_sec)) 787 . = PROJECT_SECURE_OR_FLAT ? __OPTION_SETTING_S_Start + 0x40 : __OPTION_SETTING_S_Start; 788 KEEP(*(.option_setting_bps_sec0)) 789 . = PROJECT_SECURE_OR_FLAT ? __OPTION_SETTING_S_Start + 0x44 : __OPTION_SETTING_S_Start; 790 KEEP(*(.option_setting_bps_sec1)) 791 . = PROJECT_SECURE_OR_FLAT ? __OPTION_SETTING_S_Start + 0x48 : __OPTION_SETTING_S_Start; 792 KEEP(*(.option_setting_bps_sec2)) 793 . = PROJECT_SECURE_OR_FLAT ? __OPTION_SETTING_S_Start + 0x4C : __OPTION_SETTING_S_Start; 794 KEEP(*(.option_setting_bps_sec3)) 795 . = PROJECT_SECURE_OR_FLAT ? __OPTION_SETTING_S_Start + 0x60 : __OPTION_SETTING_S_Start; 796 KEEP(*(.option_setting_pbps_sec0)) 797 . = PROJECT_SECURE_OR_FLAT ? __OPTION_SETTING_S_Start + 0x64 : __OPTION_SETTING_S_Start; 798 KEEP(*(.option_setting_pbps_sec1)) 799 . = PROJECT_SECURE_OR_FLAT ? __OPTION_SETTING_S_Start + 0x68 : __OPTION_SETTING_S_Start; 800 KEEP(*(.option_setting_pbps_sec2)) 801 . = PROJECT_SECURE_OR_FLAT ? __OPTION_SETTING_S_Start + 0x6C : __OPTION_SETTING_S_Start; 802 KEEP(*(.option_setting_pbps_sec3)) 803 . = PROJECT_SECURE_OR_FLAT ? __OPTION_SETTING_S_Start + 0x80 : __OPTION_SETTING_S_Start; 804 KEEP(*(.option_setting_ofs1_sel)) 805 . = PROJECT_SECURE_OR_FLAT ? __OPTION_SETTING_S_Start + 0x84 : __OPTION_SETTING_S_Start; 806 KEEP(*(.option_setting_ofs3_sel)) 807 . = PROJECT_SECURE_OR_FLAT ? __OPTION_SETTING_S_Start + 0x90 : __OPTION_SETTING_S_Start; 808 KEEP(*(.option_setting_banksel_sel)) 809 . = PROJECT_SECURE_OR_FLAT ? __OPTION_SETTING_S_Start + 0xC0 : __OPTION_SETTING_S_Start; 810 KEEP(*(.option_setting_bps_sel0)) 811 . = PROJECT_SECURE_OR_FLAT ? __OPTION_SETTING_S_Start + 0xC4 : __OPTION_SETTING_S_Start; 812 KEEP(*(.option_setting_bps_sel1)) 813 . = PROJECT_SECURE_OR_FLAT ? __OPTION_SETTING_S_Start + 0xC8 : __OPTION_SETTING_S_Start; 814 KEEP(*(.option_setting_bps_sel2)) 815 . = PROJECT_SECURE_OR_FLAT ? __OPTION_SETTING_S_Start + 0xCC : __OPTION_SETTING_S_Start; 816 KEEP(*(.option_setting_bps_sel3)) 817 __OPTION_SETTING_S_End = .; 818 } > OPTION_SETTING_S = 0xFF 819 820 /* Symbol required for RA Configuration tool. */ 821 __tz_OPTION_SETTING_S_N = __OPTION_SETTING_S_End; 822} 823