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