fsp.ld 23 KB

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