1
0

fsp.ld 24 KB

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