1
0

flash_rtt.ld 8.0 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 : 256K;
  8. FLASH_SIZE = DEFINED(_flash_size) ? _flash_size : 16M;
  9. NONCACHEABLE_SIZE = DEFINED(_noncacheable_size) ? _noncacheable_size : 256K;
  10. SDRAM_SIZE = DEFINED(_sdram_size) ? _sdram_size : 32M;
  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 = 1280K
  17. NONCACHEABLE_RAM (wx) : ORIGIN = 0x11C0000, LENGTH = NONCACHEABLE_SIZE
  18. SDRAM (wx) : ORIGIN = 0x40000000, LENGTH = SDRAM_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. } > XPI0
  123. .rel : {
  124. KEEP(*(.rel*))
  125. } > XPI0
  126. PROVIDE (__etext = .);
  127. PROVIDE (_etext = .);
  128. PROVIDE (etext = .);
  129. .fast_ram (NOLOAD) : {
  130. KEEP(*(.fast_ram))
  131. } > DLM
  132. .bss(NOLOAD) : {
  133. . = ALIGN(8);
  134. __bss_start__ = .;
  135. *(.bss)
  136. *(.bss*)
  137. *(.sbss*)
  138. *(.scommon)
  139. *(.scommon*)
  140. *(.dynsbss*)
  141. *(COMMON)
  142. . = ALIGN(8);
  143. _end = .;
  144. __bss_end__ = .;
  145. } > AXI_SRAM
  146. /* Note: the .tbss and .tdata section should be adjacent */
  147. .tbss(NOLOAD) : {
  148. . = ALIGN(8);
  149. __tbss_start__ = .;
  150. *(.tbss*)
  151. *(.tcommon*)
  152. _end = .;
  153. __tbss_end__ = .;
  154. } > AXI_SRAM
  155. .tdata : AT(etext) {
  156. . = ALIGN(8);
  157. __tdata_start__ = .;
  158. __thread_pointer = .;
  159. *(.tdata)
  160. *(.tdata*)
  161. . = ALIGN(8);
  162. __tdata_end__ = .;
  163. } > AXI_SRAM
  164. .data : AT(etext + __tdata_end__ - __tdata_start__) {
  165. . = ALIGN(8);
  166. __data_start__ = .;
  167. __global_pointer$ = . + 0x800;
  168. *(.data)
  169. *(.data*)
  170. *(.sdata)
  171. *(.sdata*)
  172. KEEP(*(.jcr))
  173. KEEP(*(.dynamic))
  174. KEEP(*(.got*))
  175. KEEP(*(.got))
  176. KEEP(*(.gcc_except_table))
  177. KEEP(*(.gcc_except_table.*))
  178. . = ALIGN(8);
  179. PROVIDE(__preinit_array_start = .);
  180. KEEP(*(.preinit_array))
  181. PROVIDE(__preinit_array_end = .);
  182. . = ALIGN(8);
  183. PROVIDE(__init_array_start = .);
  184. KEEP(*(SORT_BY_INIT_PRIORITY(.init_array.*)))
  185. KEEP(*(.init_array))
  186. PROVIDE(__init_array_end = .);
  187. . = ALIGN(8);
  188. PROVIDE(__finit_array_start = .);
  189. KEEP(*(SORT_BY_INIT_PRIORITY(.finit_array.*)))
  190. KEEP(*(.finit_array))
  191. PROVIDE(__finit_array_end = .);
  192. . = ALIGN(8);
  193. PROVIDE(__ctors_start__ = .);
  194. KEEP(*crtbegin*.o(.ctors))
  195. KEEP(*(EXCLUDE_FILE (*crtend*.o) .ctors))
  196. KEEP(*(SORT(.ctors.*)))
  197. KEEP(*(.ctors))
  198. PROVIDE(__ctors_end__ = .);
  199. . = ALIGN(8);
  200. KEEP(*crtbegin*.o(.dtors))
  201. KEEP(*(EXCLUDE_FILE (*crtend*.o) .dtors))
  202. KEEP(*(SORT(.dtors.*)))
  203. KEEP(*(.dtors))
  204. . = ALIGN(8);
  205. __data_end__ = .;
  206. PROVIDE (__edata = .);
  207. PROVIDE (_edata = .);
  208. PROVIDE (edata = .);
  209. } > AXI_SRAM
  210. __fw_size__ = __data_end__ - __tdata_start__ + etext - __app_load_addr__;
  211. .heap(NOLOAD) : {
  212. . = ALIGN(8);
  213. __heap_start__ = .;
  214. . += HEAP_SIZE;
  215. __heap_end__ = .;
  216. } > AXI_SRAM
  217. .framebuffer (NOLOAD) : {
  218. . = ALIGN(8);
  219. KEEP(*(.framebuffer))
  220. . = ALIGN(8);
  221. } > AXI_SRAM
  222. .stack(NOLOAD) : {
  223. . = ALIGN(8);
  224. __stack_base__ = .;
  225. . += STACK_SIZE;
  226. . = ALIGN(8);
  227. PROVIDE (_stack = .);
  228. PROVIDE (_stack_in_dlm = .);
  229. PROVIDE( __rt_rvstack = . );
  230. } > AXI_SRAM
  231. .noncacheable.init : AT(etext + __data_end__ - __tdata_start__ + __ramfunc_end__ - __ramfunc_start__) {
  232. . = ALIGN(8);
  233. __noncacheable_init_start__ = .;
  234. KEEP(*(.noncacheable.init))
  235. __noncacheable_init_end__ = .;
  236. . = ALIGN(8);
  237. } > NONCACHEABLE_RAM
  238. .noncacheable.bss (NOLOAD) : {
  239. . = ALIGN(8);
  240. KEEP(*(.noncacheable))
  241. __noncacheable_bss_start__ = .;
  242. KEEP(*(.noncacheable.bss))
  243. __noncacheable_bss_end__ = .;
  244. . = ALIGN(8);
  245. } > NONCACHEABLE_RAM
  246. .ahb_sram (NOLOAD) : {
  247. KEEP(*(.ahb_sram))
  248. } > AHB_SRAM
  249. .apb_sram (NOLOAD) : {
  250. KEEP(*(.backup_sram))
  251. } > APB_SRAM
  252. __noncacheable_start__ = ORIGIN(NONCACHEABLE_RAM);
  253. __noncacheable_end__ = ORIGIN(NONCACHEABLE_RAM) + LENGTH(NONCACHEABLE_RAM);
  254. .sdram (NOLOAD) : {
  255. . = ALIGN(8);
  256. __sdram_start__ = .;
  257. . += SDRAM_SIZE;
  258. __sdram_end__ = .;
  259. } > SDRAM
  260. }