fsp.ld 23 KB

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