flash_sdram_rtt.ld 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304
  1. /*
  2. * Copyright 2021-2023 HPMicro
  3. * SPDX-License-Identifier: BSD-3-Clause
  4. */
  5. ENTRY(_start)
  6. STACK_SIZE = DEFINED(_stack_size) ? _stack_size : 0x4000;
  7. HEAP_SIZE = DEFINED(_heap_size) ? _heap_size : 1M;
  8. FLASH_SIZE = DEFINED(_flash_size) ? _flash_size : 16M;
  9. SDRAM_SIZE = DEFINED(_sdram_size) ? _sdram_size : 32M;
  10. NONCACHEABLE_SIZE = DEFINED(_noncacheable_size) ? _noncacheable_size : 4M;
  11. MEMORY
  12. {
  13. XPI0 (rx) : ORIGIN = 0x80000000, LENGTH = FLASH_SIZE
  14. ILM (wx) : ORIGIN = 0, LENGTH = 256K
  15. DLM (w) : ORIGIN = 0x80000, LENGTH = 256K
  16. AXI_SRAM (wx) : ORIGIN = 0x1080000, LENGTH = 1536K
  17. SDRAM (wx) : ORIGIN = 0x40000000, LENGTH = SDRAM_SIZE - NONCACHEABLE_SIZE
  18. NONCACHEABLE_RAM (wx) : ORIGIN = 0x40000000 + SDRAM_SIZE - NONCACHEABLE_SIZE, LENGTH = NONCACHEABLE_SIZE
  19. AHB_SRAM (w) : ORIGIN = 0xF0300000, LENGTH = 32k
  20. APB_SRAM (w): ORIGIN = 0xF40F0000, LENGTH = 8k
  21. }
  22. __nor_cfg_option_load_addr__ = ORIGIN(XPI0) + 0x400;
  23. __boot_header_load_addr__ = ORIGIN(XPI0) + 0x1000;
  24. __app_load_addr__ = ORIGIN(XPI0) + 0x3000;
  25. __boot_header_length__ = __boot_header_end__ - __boot_header_start__;
  26. __app_offset__ = __app_load_addr__ - __boot_header_load_addr__;
  27. SECTIONS
  28. {
  29. .nor_cfg_option __nor_cfg_option_load_addr__ : {
  30. KEEP(*(.nor_cfg_option))
  31. } > XPI0
  32. .boot_header __boot_header_load_addr__ : {
  33. __boot_header_start__ = .;
  34. KEEP(*(.boot_header))
  35. KEEP(*(.fw_info_table))
  36. KEEP(*(.dc_info))
  37. __boot_header_end__ = .;
  38. } > XPI0
  39. .start __app_load_addr__ : {
  40. . = ALIGN(8);
  41. KEEP(*(.start))
  42. } > XPI0
  43. __vector_load_addr__ = ADDR(.start) + SIZEOF(.start);
  44. .vectors : AT(__vector_load_addr__) {
  45. . = ALIGN(8);
  46. __vector_ram_start__ = .;
  47. KEEP(*(.vector_table))
  48. KEEP(*(.isr_vector))
  49. . = ALIGN(8);
  50. __vector_ram_end__ = .;
  51. } > AXI_SRAM
  52. .fast : AT(etext + __data_end__ - __tdata_start__) {
  53. . = ALIGN(8);
  54. __ramfunc_start__ = .;
  55. *(.fast)
  56. /* RT-Thread Core Start */
  57. KEEP(*context_gcc.o(.text* .rodata*))
  58. KEEP(*port*.o (.text .text* .rodata .rodata*))
  59. KEEP(*interrupt_gcc.o (.text .text* .rodata .rodata*))
  60. KEEP(*trap_common.o (.text .text* .rodata .rodata*))
  61. KEEP(*irq.o (.text .text* .rodata .rodata*))
  62. KEEP(*clock.o (.text .text* .rodata .rodata*))
  63. KEEP(*kservice.o (.text .text* .rodata .rodata*))
  64. KEEP(*scheduler.o (.text .text* .rodata .rodata*))
  65. KEEP(*trap*.o (.text .text* .rodata .rodata*))
  66. KEEP(*idle.o (.text .text* .rodata .rodata*))
  67. KEEP(*ipc.o (.text .text* .rodata .rodata*))
  68. KEEP(*thread.o (.text .text* .rodata .rodata*))
  69. KEEP(*object.o (.text .text* .rodata .rodata*))
  70. KEEP(*timer.o (.text .text* .rodata .rodata*))
  71. KEEP(*mem.o (.text .text* .rodata .rodata*))
  72. KEEP(*mempool.o (.text .text* .rodata .rodata*))
  73. /* RT-Thread Core End */
  74. /* HPMicro Driver Wrapper */
  75. KEEP(*drv_*.o (.text .text* .rodata .rodata*))
  76. . = ALIGN(8);
  77. __ramfunc_end__ = .;
  78. } > AXI_SRAM
  79. .text (__vector_load_addr__ + __vector_ram_end__ - __vector_ram_start__) : {
  80. . = ALIGN(8);
  81. *(.text)
  82. *(.text*)
  83. *(.rodata)
  84. *(.rodata*)
  85. *(.srodata)
  86. *(.srodata*)
  87. *(.hash)
  88. *(.dyn*)
  89. *(.gnu*)
  90. *(.pl*)
  91. KEEP(*(.eh_frame))
  92. *(.eh_frame*)
  93. KEEP (*(.init))
  94. KEEP (*(.fini))
  95. . = ALIGN(8);
  96. /*********************************************
  97. *
  98. * RT-Thread related sections - Start
  99. *
  100. *********************************************/
  101. /* section information for finsh shell */
  102. . = ALIGN(4);
  103. __fsymtab_start = .;
  104. KEEP(*(FSymTab))
  105. __fsymtab_end = .;
  106. . = ALIGN(4);
  107. __vsymtab_start = .;
  108. KEEP(*(VSymTab))
  109. __vsymtab_end = .;
  110. . = ALIGN(4);
  111. . = ALIGN(4);
  112. __rt_init_start = .;
  113. KEEP(*(SORT(.rti_fn*)))
  114. __rt_init_end = .;
  115. . = ALIGN(4);
  116. /* section information for modules */
  117. . = ALIGN(4);
  118. __rtmsymtab_start = .;
  119. KEEP(*(RTMSymTab))
  120. __rtmsymtab_end = .;
  121. /* RT-Thread related sections - end */
  122. /* section information for usbh class */
  123. . = ALIGN(8);
  124. __usbh_class_info_start__ = .;
  125. KEEP(*(.usbh_class_info))
  126. __usbh_class_info_end__ = .;
  127. } > XPI0
  128. .rel : {
  129. KEEP(*(.rel*))
  130. } > XPI0
  131. PROVIDE (__etext = .);
  132. PROVIDE (_etext = .);
  133. PROVIDE (etext = .);
  134. .fast_ram (NOLOAD) : {
  135. KEEP(*(.fast_ram))
  136. } > DLM
  137. .bss(NOLOAD) : {
  138. . = ALIGN(8);
  139. __bss_start__ = .;
  140. *(.bss)
  141. *(.bss*)
  142. *(.sbss*)
  143. *(.scommon)
  144. *(.scommon*)
  145. *(.dynsbss*)
  146. *(COMMON)
  147. . = ALIGN(8);
  148. _end = .;
  149. __bss_end__ = .;
  150. } > AXI_SRAM
  151. .tbss(NOLOAD) : {
  152. . = ALIGN(8);
  153. __tbss_start__ = .;
  154. *(.tbss*)
  155. *(.tcommon*)
  156. _end = .;
  157. __tbss_end__ = .;
  158. } > AXI_SRAM
  159. .tdata : AT(etext) {
  160. . = ALIGN(8);
  161. __tdata_start__ = .;
  162. __thread_pointer = .;
  163. *(.tdata)
  164. *(.tdata*)
  165. . = ALIGN(8);
  166. __tdata_end__ = .;
  167. } > AXI_SRAM
  168. .data : AT(etext + __tdata_end__ - __tdata_start__) {
  169. . = ALIGN(8);
  170. __data_start__ = .;
  171. __global_pointer$ = . + 0x800;
  172. *(.data)
  173. *(.data*)
  174. *(.sdata)
  175. *(.sdata*)
  176. KEEP(*(.jcr))
  177. KEEP(*(.dynamic))
  178. KEEP(*(.got*))
  179. KEEP(*(.got))
  180. KEEP(*(.gcc_except_table))
  181. KEEP(*(.gcc_except_table.*))
  182. . = ALIGN(8);
  183. PROVIDE(__preinit_array_start = .);
  184. KEEP(*(.preinit_array))
  185. PROVIDE(__preinit_array_end = .);
  186. . = ALIGN(8);
  187. PROVIDE(__init_array_start = .);
  188. KEEP(*(SORT_BY_INIT_PRIORITY(.init_array.*)))
  189. KEEP(*(.init_array))
  190. PROVIDE(__init_array_end = .);
  191. . = ALIGN(8);
  192. PROVIDE(__finit_array_start = .);
  193. KEEP(*(SORT_BY_INIT_PRIORITY(.finit_array.*)))
  194. KEEP(*(.finit_array))
  195. PROVIDE(__finit_array_end = .);
  196. . = ALIGN(8);
  197. PROVIDE(__ctors_start__ = .);
  198. KEEP(*crtbegin*.o(.ctors))
  199. KEEP(*(EXCLUDE_FILE (*crtend*.o) .ctors))
  200. KEEP(*(SORT(.ctors.*)))
  201. KEEP(*(.ctors))
  202. PROVIDE(__ctors_end__ = .);
  203. . = ALIGN(8);
  204. KEEP(*crtbegin*.o(.dtors))
  205. KEEP(*(EXCLUDE_FILE (*crtend*.o) .dtors))
  206. KEEP(*(SORT(.dtors.*)))
  207. KEEP(*(.dtors))
  208. . = ALIGN(8);
  209. __data_end__ = .;
  210. PROVIDE (__edata = .);
  211. PROVIDE (_edata = .);
  212. PROVIDE (edata = .);
  213. } > AXI_SRAM
  214. __fw_size__ = __data_end__ - __tdata_start__ + etext - __app_load_addr__;
  215. .noncacheable.init : AT(etext + __data_end__ - __tdata_start__ + __ramfunc_end__ - __ramfunc_start__) {
  216. . = ALIGN(8);
  217. __noncacheable_init_start__ = .;
  218. KEEP(*(.noncacheable.init))
  219. __noncacheable_init_end__ = .;
  220. . = ALIGN(8);
  221. } > NONCACHEABLE_RAM
  222. .noncacheable.bss (NOLOAD) : {
  223. . = ALIGN(8);
  224. KEEP(*(.noncacheable))
  225. __noncacheable_bss_start__ = .;
  226. KEEP(*(.noncacheable.bss))
  227. __noncacheable_bss_end__ = .;
  228. . = ALIGN(8);
  229. } > NONCACHEABLE_RAM
  230. .ahb_sram (NOLOAD) : {
  231. KEEP(*(.ahb_sram))
  232. } > AHB_SRAM
  233. .apb_sram (NOLOAD) : {
  234. KEEP(*(.backup_sram))
  235. } > APB_SRAM
  236. .heap(NOLOAD) : {
  237. . = ALIGN(8);
  238. __heap_start__ = .;
  239. . += HEAP_SIZE;
  240. __heap_end__ = .;
  241. } > SDRAM
  242. .framebuffer (NOLOAD) : {
  243. . = ALIGN(8);
  244. KEEP(*(.framebuffer))
  245. . = ALIGN(8);
  246. } > SDRAM
  247. .stack(NOLOAD) : {
  248. . = ALIGN(8);
  249. __stack_base__ = .;
  250. . += STACK_SIZE;
  251. . = ALIGN(8);
  252. PROVIDE (_stack = .);
  253. PROVIDE (_stack_in_dlm = .);
  254. PROVIDE( __rt_rvstack = . );
  255. } > AXI_SRAM
  256. __noncacheable_start__ = ORIGIN(NONCACHEABLE_RAM);
  257. __noncacheable_end__ = ORIGIN(NONCACHEABLE_RAM) + LENGTH(NONCACHEABLE_RAM);
  258. }