1
0

flash_rtt.ld 7.7 KB

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