fsp.ld 25 KB

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