fsp.ld 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665
  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(libc.a libm.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. /* section information for finsh shell */
  155. . = ALIGN(4);
  156. __fsymtab_start = .;
  157. KEEP(*(FSymTab))
  158. __fsymtab_end = .;
  159. . = ALIGN(4);
  160. __vsymtab_start = .;
  161. KEEP(*(VSymTab))
  162. __vsymtab_end = .;
  163. /* section information for initial. */
  164. . = ALIGN(4);
  165. __rt_init_start = .;
  166. KEEP(*(SORT(.rti_fn*)))
  167. __rt_init_end = .;
  168. . = ALIGN(4);
  169. KEEP(*(FalPartTable))
  170. /* .ctors */
  171. *crtbegin.o(.ctors)
  172. *crtbegin?.o(.ctors)
  173. *(EXCLUDE_FILE(*crtend?.o *crtend.o) .ctors)
  174. *(SORT(.ctors.*))
  175. *(.ctors)
  176. /* .dtors */
  177. *crtbegin.o(.dtors)
  178. *crtbegin?.o(.dtors)
  179. *(EXCLUDE_FILE(*crtend?.o *crtend.o) .dtors)
  180. *(SORT(.dtors.*))
  181. *(.dtors)
  182. *(.rodata*)
  183. __usb_dev_descriptor_start_fs = .;
  184. KEEP(*(.usb_device_desc_fs*))
  185. __usb_cfg_descriptor_start_fs = .;
  186. KEEP(*(.usb_config_desc_fs*))
  187. __usb_interface_descriptor_start_fs = .;
  188. KEEP(*(.usb_interface_desc_fs*))
  189. __usb_descriptor_end_fs = .;
  190. __usb_dev_descriptor_start_hs = .;
  191. KEEP(*(.usb_device_desc_hs*))
  192. __usb_cfg_descriptor_start_hs = .;
  193. KEEP(*(.usb_config_desc_hs*))
  194. __usb_interface_descriptor_start_hs = .;
  195. KEEP(*(.usb_interface_desc_hs*))
  196. __usb_descriptor_end_hs = .;
  197. KEEP(*(.eh_frame*))
  198. /* new GCC version uses .init_array */
  199. PROVIDE(__ctors_start__ = .);
  200. KEEP (*(SORT(.init_array.*)))
  201. KEEP (*(.init_array))
  202. PROVIDE(__ctors_end__ = .);
  203. . = ALIGN(4);
  204. __ROM_End = .;
  205. } > FLASH = 0xFF
  206. __Vectors_Size = __Vectors_End - __Vectors;
  207. .ARM.extab :
  208. {
  209. *(.ARM.extab* .gnu.linkonce.armextab.*)
  210. } > FLASH
  211. __exidx_start = .;
  212. .ARM.exidx :
  213. {
  214. *(.ARM.exidx* .gnu.linkonce.armexidx.*)
  215. } > FLASH
  216. __exidx_end = .;
  217. /* To copy multiple ROM to RAM sections,
  218. * uncomment .copy.table section and,
  219. * define __STARTUP_COPY_MULTIPLE in startup_ARMCMx.S */
  220. /*
  221. .copy.table :
  222. {
  223. . = ALIGN(4);
  224. __copy_table_start__ = .;
  225. LONG (__etext)
  226. LONG (__data_start__)
  227. LONG (__data_end__ - __data_start__)
  228. LONG (__etext2)
  229. LONG (__data2_start__)
  230. LONG (__data2_end__ - __data2_start__)
  231. __copy_table_end__ = .;
  232. } > FLASH
  233. */
  234. /* To clear multiple BSS sections,
  235. * uncomment .zero.table section and,
  236. * define __STARTUP_CLEAR_BSS_MULTIPLE in startup_ARMCMx.S */
  237. /*
  238. .zero.table :
  239. {
  240. . = ALIGN(4);
  241. __zero_table_start__ = .;
  242. LONG (__bss_start__)
  243. LONG (__bss_end__ - __bss_start__)
  244. LONG (__bss2_start__)
  245. LONG (__bss2_end__ - __bss2_start__)
  246. __zero_table_end__ = .;
  247. } > FLASH
  248. */
  249. __etext = .;
  250. __tz_RAM_S = ORIGIN(RAM);
  251. /* If DTC is used, put the DTC vector table at the start of SRAM.
  252. This avoids memory holes due to 1K alignment required by it. */
  253. .fsp_dtc_vector_table (NOLOAD) :
  254. {
  255. . = ORIGIN(RAM);
  256. *(.fsp_dtc_vector_table)
  257. } > RAM
  258. /* Initialized data section. */
  259. .data :
  260. {
  261. __data_start__ = .;
  262. . = ALIGN(4);
  263. __Code_In_RAM_Start = .;
  264. KEEP(*(.code_in_ram*))
  265. __Code_In_RAM_End = .;
  266. *(vtable)
  267. /* Don't use *(.data*) because it will place data meant for .data_flash in this section. */
  268. *(.data.*)
  269. *(.data)
  270. . = ALIGN(4);
  271. /* preinit data */
  272. PROVIDE_HIDDEN (__preinit_array_start = .);
  273. KEEP(*(.preinit_array))
  274. PROVIDE_HIDDEN (__preinit_array_end = .);
  275. . = ALIGN(4);
  276. /* init data */
  277. PROVIDE_HIDDEN (__init_array_start = .);
  278. KEEP(*(SORT(.init_array.*)))
  279. KEEP(*(.init_array))
  280. PROVIDE_HIDDEN (__init_array_end = .);
  281. . = ALIGN(4);
  282. /* finit data */
  283. PROVIDE_HIDDEN (__fini_array_start = .);
  284. KEEP(*(SORT(.fini_array.*)))
  285. KEEP(*(.fini_array))
  286. PROVIDE_HIDDEN (__fini_array_end = .);
  287. KEEP(*(.jcr*))
  288. . = ALIGN(4);
  289. /* .data section which is used for initialized data */
  290. PROVIDE(__dtors_start__ = .);
  291. KEEP(*(SORT(.dtors.*)))
  292. KEEP(*(.dtors))
  293. PROVIDE(__dtors_end__ = .);
  294. . = ALIGN(4);
  295. /* All data end */
  296. __data_end__ = .;
  297. } > RAM AT > FLASH
  298. /* TrustZone Secure Gateway Stubs Section. */
  299. /* Some arithmetic is needed to eliminate unnecessary FILL for secure projects. */
  300. /* 1. Get the address to the next block after the .data section in FLASH. */
  301. DATA_END = LOADADDR(.data) + SIZEOF(.data);
  302. /* 2. Determine the secure gateway stubs address either by the provided linker variable or the next 1024-byte block after .data */
  303. SGSTUBS_LOC = (DEFINED(PROJECT_SECURE) && DEFINED(FLASH_NSC_START)) ? ABSOLUTE(FLASH_NSC_START) : ALIGN(DATA_END, 1024);
  304. /* 3. Manually specify the start location for .gnu.sgstubs */
  305. .gnu.sgstubs SGSTUBS_LOC : ALIGN(1024)
  306. {
  307. __tz_FLASH_C = DEFINED(FLASH_NSC_START) ? ABSOLUTE(FLASH_NSC_START) : __RESERVE_NS_RAM ? ABSOLUTE(FLASH_START + FLASH_LENGTH) : ALIGN(1024);
  308. _start_sg = .;
  309. *(.gnu.sgstubs*)
  310. . = ALIGN(32);
  311. _end_sg = .;
  312. } > FLASH
  313. __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);
  314. FLASH_NS_IMAGE_START = DEFINED(FLASH_NS_IMAGE_START) ? FLASH_NS_IMAGE_START : __tz_FLASH_N;
  315. /* Note: There are no secure/non-secure boundaries for QSPI. These symbols are provided for the RA configuration tool. */
  316. __tz_QSPI_FLASH_S = ORIGIN(QSPI_FLASH);
  317. /* QSPI_FLASH section to be downloaded via debugger */
  318. .qspi_flash :
  319. {
  320. __qspi_flash_start__ = .;
  321. KEEP(*(.qspi_flash*))
  322. KEEP(*(.code_in_qspi*))
  323. __qspi_flash_end__ = .;
  324. } > QSPI_FLASH
  325. __qspi_flash_code_size__ = __qspi_flash_end__ - __qspi_flash_start__;
  326. /* QSPI_FLASH non-retentive section, creates a copy in internal flash that can be copied to QSPI */
  327. __qspi_flash_code_addr__ = __etext + (__data_end__ - __data_start__);
  328. .qspi_non_retentive : AT (__qspi_flash_code_addr__)
  329. {
  330. __qspi_non_retentive_start__ = .;
  331. KEEP(*(.qspi_non_retentive*))
  332. __qspi_non_retentive_end__ = .;
  333. } > QSPI_FLASH
  334. __qspi_non_retentive_size__ = __qspi_non_retentive_end__ - __qspi_non_retentive_start__;
  335. __qspi_region_max_size__ = 0x4000000; /* Must be the same as defined in MEMORY above */
  336. __qspi_region_start_address__ = __qspi_flash_start__;
  337. __qspi_region_end_address__ = __qspi_flash_start__ + __qspi_region_max_size__;
  338. /* Note: There are no secure/non-secure boundaries for QSPI. These symbols are provided for the RA configuration tool. */
  339. __tz_QSPI_FLASH_N = __qspi_non_retentive_end__;
  340. /* Support for OctaRAM */
  341. .OSPI_DEVICE_0_NO_LOAD (NOLOAD):
  342. {
  343. . = ALIGN(4);
  344. __ospi_device_0_start__ = .;
  345. *(.ospi_device_0_no_load*)
  346. . = ALIGN(4);
  347. __ospi_device_0_end__ = .;
  348. } > OSPI_DEVICE_0_RAM
  349. .OSPI_DEVICE_1_NO_LOAD (NOLOAD):
  350. {
  351. . = ALIGN(4);
  352. __ospi_device_1_start__ = .;
  353. *(.ospi_device_1_no_load*)
  354. . = ALIGN(4);
  355. __ospi_device_1_end__ = .;
  356. } > OSPI_DEVICE_1_RAM
  357. /* Note: There are no secure/non-secure boundaries for QSPI. These symbols are provided for the RA configuration tool. */
  358. __tz_OSPI_DEVICE_0_S = ORIGIN(OSPI_DEVICE_0);
  359. /* OSPI_DEVICE_0 section to be downloaded via debugger */
  360. .OSPI_DEVICE_0 :
  361. {
  362. __ospi_device_0_start__ = .;
  363. KEEP(*(.ospi_device_0*))
  364. KEEP(*(.code_in_ospi_device_0*))
  365. __ospi_device_0_end__ = .;
  366. } > OSPI_DEVICE_0
  367. __ospi_device_0_code_size__ = __ospi_device_0_end__ - __ospi_device_0_start__;
  368. /* OSPI_DEVICE_0 non-retentive section, creates a copy in internal flash that can be copied to OSPI */
  369. __ospi_device_0_code_addr__ = __etext + (__data_end__ - __data_start__);
  370. .ospi_device_0_non_retentive : AT (__ospi_device_0_code_addr__)
  371. {
  372. __ospi_device_0_non_retentive_start__ = .;
  373. KEEP(*(.ospi_device_0_non_retentive*))
  374. __ospi_device_0_non_retentive_end__ = .;
  375. } > OSPI_DEVICE_0
  376. __ospi_device_0_non_retentive_size__ = __ospi_device_0_non_retentive_end__ - __ospi_device_0_non_retentive_start__;
  377. __ospi_device_0_region_max_size__ = 0x8000000; /* Must be the same as defined in MEMORY above */
  378. __ospi_device_0_region_start_address__ = __ospi_device_0_start__;
  379. __ospi_device_0_region_end_address__ = __ospi_device_0_start__ + __ospi_device_0_region_max_size__;
  380. /* Note: There are no secure/non-secure boundaries for OSPI. These symbols are provided for the RA configuration tool. */
  381. __tz_OSPI_DEVICE_0_N = __ospi_device_0_non_retentive_end__;
  382. /* Note: There are no secure/non-secure boundaries for OSPI. These symbols are provided for the RA configuration tool. */
  383. __tz_OSPI_DEVICE_1_S = ORIGIN(OSPI_DEVICE_1);
  384. /* OSPI_DEVICE_1 section to be downloaded via debugger */
  385. .OSPI_DEVICE_1 :
  386. {
  387. __ospi_device_1_start__ = .;
  388. KEEP(*(.ospi_device_1*))
  389. KEEP(*(.code_in_ospi_device_1*))
  390. __ospi_device_1_end__ = .;
  391. } > OSPI_DEVICE_1
  392. __ospi_device_1_code_size__ = __ospi_device_1_end__ - __ospi_device_1_start__;
  393. /* OSPI_DEVICE_1 non-retentive section, creates a copy in internal flash that can be copied to OSPI */
  394. __ospi_device_1_code_addr__ = __etext + (__data_end__ - __data_start__);
  395. .ospi_device_1_non_retentive : AT (__ospi_device_1_code_addr__)
  396. {
  397. __ospi_device_1_non_retentive_start__ = .;
  398. KEEP(*(.ospi_device_1_non_retentive*))
  399. __ospi_device_1_non_retentive_end__ = .;
  400. } > OSPI_DEVICE_1
  401. __ospi_device_1_non_retentive_size__ = __ospi_device_1_non_retentive_end__ - __ospi_device_1_non_retentive_start__;
  402. __ospi_device_1_region_max_size__ = 0x10000000; /* Must be the same as defined in MEMORY above */
  403. __ospi_device_1_region_start_address__ = __ospi_device_1_start__;
  404. __ospi_device_1_region_end_address__ = __ospi_device_1_start__ + __ospi_device_1_region_max_size__;
  405. /* Note: There are no secure/non-secure boundaries for OSPI. These symbols are provided for the RA configuration tool. */
  406. __tz_OSPI_DEVICE_1_N = __ospi_device_1_non_retentive_end__;
  407. .noinit (NOLOAD):
  408. {
  409. . = ALIGN(4);
  410. __noinit_start = .;
  411. KEEP(*(.noinit*))
  412. . = ALIGN(8);
  413. /* Place the FreeRTOS heap here so that the __HeapLimit calculation does not include the freertos heap. */
  414. KEEP(*(.heap.*))
  415. __noinit_end = .;
  416. } > RAM
  417. .bss :
  418. {
  419. . = ALIGN(4);
  420. __bss_start__ = .;
  421. *(.bss*)
  422. *(COMMON)
  423. . = ALIGN(4);
  424. __bss_end__ = .;
  425. } > RAM
  426. .heap (NOLOAD):
  427. {
  428. . = ALIGN(8);
  429. __HeapBase = .;
  430. /* Place the STD heap here. */
  431. KEEP(*(.heap))
  432. __HeapLimit = .;
  433. } > RAM
  434. /* Stacks are stored in this section. */
  435. .stack_dummy (NOLOAD):
  436. {
  437. . = ALIGN(8);
  438. __StackLimit = .;
  439. /* Main stack */
  440. KEEP(*(.stack))
  441. __StackTop = .;
  442. /* Thread stacks */
  443. KEEP(*(.stack*))
  444. __StackTopAll = .;
  445. } > RAM
  446. PROVIDE(__stack = __StackTopAll);
  447. /* This symbol represents the end of user allocated RAM. The RAM after this symbol can be used
  448. at run time for things such as ThreadX memory pool allocations. */
  449. __RAM_segment_used_end__ = ALIGN(__StackTopAll , 4);
  450. /* RAM_NSC_START can be used to set a fixed address for non-secure callable RAM in secure projects.
  451. * If it is not specified, the address for NSC RAM is the end of RAM aligned to a 1K boundary.
  452. * In flat projects that require non-secure RAM, this variable is set to the start of non-secure RAM. */
  453. __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);
  454. /* RAM_NS_START can be used to set a fixed address for non-secure RAM in secure projects or flat projects.
  455. * RAM_NS_BUFFER_BLOCK_LENGTH is used to allocate non-secure buffers in a flat project. If it is not
  456. * specified, the address for NSC RAM is the end of RAM aligned to an 8K boundary.
  457. * In flat projects that require non-secure RAM, this variable is set to the start of non-secure RAM. */
  458. __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);
  459. /* Non-secure buffers must be in non-secure RAM. This is primarily used for the EDMAC in flat projects.
  460. * The EDMAC is a non-secure bus master and can only access non-secure RAM. */
  461. .ns_buffer (NOLOAD):
  462. {
  463. /* Allocate RAM on a 32-byte boundary to help with placement of Ethernet buffers. */
  464. . = __RESERVE_NS_RAM ? ABSOLUTE(RAM_NS_BUFFER_START & 0xFFFFFFE0) : .;
  465. KEEP(*(.ns_buffer*))
  466. } > RAM
  467. /* Data flash. */
  468. .data_flash :
  469. {
  470. . = ORIGIN(DATA_FLASH);
  471. __tz_DATA_FLASH_S = .;
  472. __Data_Flash_Start = .;
  473. KEEP(*(.data_flash*))
  474. __Data_Flash_End = .;
  475. __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);
  476. } > DATA_FLASH
  477. /* Note: There are no secure/non-secure boundaries for SDRAM. These symbols are provided for the RA configuration tool. */
  478. __tz_SDRAM_S = ORIGIN(SDRAM);
  479. /* SDRAM */
  480. .sdram (NOLOAD):
  481. {
  482. __SDRAM_Start = .;
  483. KEEP(*(.sdram*))
  484. KEEP(*(.frame*))
  485. __SDRAM_End = .;
  486. } > SDRAM
  487. /* Note: There are no secure/non-secure boundaries for SDRAM. These symbols are provided for the RA configuration tool. */
  488. __tz_SDRAM_N = __SDRAM_End;
  489. /* Note: There are no secure/non-secure boundaries for ID_CODE. These symbols are provided for the RA configuration tool. */
  490. __tz_ID_CODE_S = ORIGIN(ID_CODE);
  491. .id_code :
  492. {
  493. __ID_Code_Start = .;
  494. KEEP(*(.id_code*))
  495. __ID_Code_End = .;
  496. } > ID_CODE
  497. /* Note: There are no secure/non-secure boundaries for ID_CODE. These symbols are provided for the RA configuration tool. */
  498. __tz_ID_CODE_N = __ID_Code_End;
  499. /* Symbol required for RA Configuration tool. */
  500. __tz_OPTION_SETTING_S = ORIGIN(OPTION_SETTING);
  501. .option_setting :
  502. {
  503. __OPTION_SETTING_Start = .;
  504. KEEP(*(.option_setting_ofs0))
  505. . = PROJECT_SECURE_OR_FLAT ? __OPTION_SETTING_Start + 0x10 : __OPTION_SETTING_Start;
  506. KEEP(*(.option_setting_dualsel))
  507. . = PROJECT_SECURE_OR_FLAT ? __OPTION_SETTING_Start + 0x34 : __OPTION_SETTING_Start;
  508. KEEP(*(.option_setting_sas))
  509. __OPTION_SETTING_End = .;
  510. } > OPTION_SETTING = 0xFF
  511. /* Symbol required for RA Configuration tool. */
  512. __tz_OPTION_SETTING_N = OPTION_SETTING_START_NS;
  513. .option_setting_ns :
  514. {
  515. __OPTION_SETTING_NS_Start = .;
  516. KEEP(*(.option_setting_ofs1))
  517. . = USE_OPTION_SETTING_NS ? __OPTION_SETTING_NS_Start + 0x10 : __OPTION_SETTING_NS_Start;
  518. KEEP(*(.option_setting_banksel))
  519. . = USE_OPTION_SETTING_NS ? __OPTION_SETTING_NS_Start + 0x40 : __OPTION_SETTING_NS_Start;
  520. KEEP(*(.option_setting_bps0))
  521. . = USE_OPTION_SETTING_NS ? __OPTION_SETTING_NS_Start + 0x44 : __OPTION_SETTING_NS_Start;
  522. KEEP(*(.option_setting_bps1))
  523. . = USE_OPTION_SETTING_NS ? __OPTION_SETTING_NS_Start + 0x48 : __OPTION_SETTING_NS_Start;
  524. KEEP(*(.option_setting_bps2))
  525. . = USE_OPTION_SETTING_NS ? __OPTION_SETTING_NS_Start + 0x60 : __OPTION_SETTING_NS_Start;
  526. KEEP(*(.option_setting_pbps0))
  527. . = USE_OPTION_SETTING_NS ? __OPTION_SETTING_NS_Start + 0x64 : __OPTION_SETTING_NS_Start;
  528. KEEP(*(.option_setting_pbps1))
  529. . = USE_OPTION_SETTING_NS ? __OPTION_SETTING_NS_Start + 0x68 : __OPTION_SETTING_NS_Start;
  530. KEEP(*(.option_setting_pbps2))
  531. __OPTION_SETTING_NS_End = .;
  532. } > OPTION_SETTING = 0xFF
  533. /* Symbol required for RA Configuration tool. */
  534. __tz_OPTION_SETTING_S_S = ORIGIN(OPTION_SETTING_S);
  535. .option_setting_s :
  536. {
  537. __OPTION_SETTING_S_Start = .;
  538. KEEP(*(.option_setting_ofs1_sec))
  539. . = PROJECT_SECURE_OR_FLAT ? __OPTION_SETTING_S_Start + 0x10 : __OPTION_SETTING_S_Start;
  540. KEEP(*(.option_setting_banksel_sec))
  541. . = PROJECT_SECURE_OR_FLAT ? __OPTION_SETTING_S_Start + 0x40 : __OPTION_SETTING_S_Start;
  542. KEEP(*(.option_setting_bps_sec0))
  543. . = PROJECT_SECURE_OR_FLAT ? __OPTION_SETTING_S_Start + 0x44 : __OPTION_SETTING_S_Start;
  544. KEEP(*(.option_setting_bps_sec1))
  545. . = PROJECT_SECURE_OR_FLAT ? __OPTION_SETTING_S_Start + 0x48 : __OPTION_SETTING_S_Start;
  546. KEEP(*(.option_setting_bps_sec2))
  547. . = PROJECT_SECURE_OR_FLAT ? __OPTION_SETTING_S_Start + 0x60 : __OPTION_SETTING_S_Start;
  548. KEEP(*(.option_setting_pbps_sec0))
  549. . = PROJECT_SECURE_OR_FLAT ? __OPTION_SETTING_S_Start + 0x64 : __OPTION_SETTING_S_Start;
  550. KEEP(*(.option_setting_pbps_sec1))
  551. . = PROJECT_SECURE_OR_FLAT ? __OPTION_SETTING_S_Start + 0x68 : __OPTION_SETTING_S_Start;
  552. KEEP(*(.option_setting_pbps_sec2))
  553. . = PROJECT_SECURE_OR_FLAT ? __OPTION_SETTING_S_Start + 0x80 : __OPTION_SETTING_S_Start;
  554. KEEP(*(.option_setting_ofs1_sel))
  555. . = PROJECT_SECURE_OR_FLAT ? __OPTION_SETTING_S_Start + 0x90 : __OPTION_SETTING_S_Start;
  556. KEEP(*(.option_setting_banksel_sel))
  557. . = PROJECT_SECURE_OR_FLAT ? __OPTION_SETTING_S_Start + 0xC0 : __OPTION_SETTING_S_Start;
  558. KEEP(*(.option_setting_bps_sel0))
  559. . = PROJECT_SECURE_OR_FLAT ? __OPTION_SETTING_S_Start + 0xC4 : __OPTION_SETTING_S_Start;
  560. KEEP(*(.option_setting_bps_sel1))
  561. . = PROJECT_SECURE_OR_FLAT ? __OPTION_SETTING_S_Start + 0xC8 : __OPTION_SETTING_S_Start;
  562. KEEP(*(.option_setting_bps_sel2))
  563. __OPTION_SETTING_S_End = .;
  564. } > OPTION_SETTING_S = 0xFF
  565. /* Symbol required for RA Configuration tool. */
  566. __tz_OPTION_SETTING_S_N = __OPTION_SETTING_S_End;
  567. }