fsp.ld 25 KB

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