fsp.ld 24 KB

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