flash_rtt_enet.ld 9.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322
  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. KEEP(*api_lib*.o (.text .text* .rodata .rodata*))
  77. KEEP(*api_msg*.o (.text .text* .rodata .rodata*))
  78. KEEP(*if_api*.o (.text .text* .rodata .rodata*))
  79. KEEP(*netbuf*.o (.text .text* .rodata .rodata*))
  80. KEEP(*netdb*.o (.text .text* .rodata .rodata*))
  81. KEEP(*netifapi*.o (.text .text* .rodata .rodata*))
  82. KEEP(*sockets*.o (.text .text* .rodata .rodata*))
  83. KEEP(*tcpip*.o (.text .text* .rodata .rodata*))
  84. KEEP(*inet_chksum*.o (.text .text* .rodata .rodata*))
  85. KEEP(*ip*.o (.text .text* .rodata .rodata*))
  86. KEEP(*memp*.o (.text .text* .rodata .rodata*))
  87. KEEP(*netif*.o (.text .text* .rodata .rodata*))
  88. KEEP(*pbuf*.o (.text .text* .rodata .rodata*))
  89. KEEP(*tcp_in*.o (.text .text* .rodata .rodata*))
  90. KEEP(*tcp_out*.o (.text .text* .rodata .rodata*))
  91. KEEP(*tcp*.o (.text .text* .rodata .rodata*))
  92. KEEP(*ethernet*.o (.text .text* .rodata .rodata*))
  93. KEEP(*ethernetif*.o (.text .text* .rodata .rodata*))
  94. . = ALIGN(8);
  95. __ramfunc_end__ = .;
  96. } > AXI_SRAM
  97. .fast_ram (NOLOAD) : {
  98. KEEP(*(.fast_ram))
  99. } > DLM
  100. .text (__vector_load_addr__ + __vector_ram_end__ - __vector_ram_start__) : {
  101. . = ALIGN(8);
  102. *(.text)
  103. *(.text*)
  104. *(.rodata)
  105. *(.rodata*)
  106. *(.srodata)
  107. *(.srodata*)
  108. *(.hash)
  109. *(.dyn*)
  110. *(.gnu*)
  111. *(.pl*)
  112. KEEP(*(.eh_frame))
  113. *(.eh_frame*)
  114. KEEP (*(.init))
  115. KEEP (*(.fini))
  116. . = ALIGN(8);
  117. /*********************************************
  118. *
  119. * RT-Thread related sections - Start
  120. *
  121. *********************************************/
  122. /* section information for finsh shell */
  123. . = ALIGN(4);
  124. __fsymtab_start = .;
  125. KEEP(*(FSymTab))
  126. __fsymtab_end = .;
  127. . = ALIGN(4);
  128. __vsymtab_start = .;
  129. KEEP(*(VSymTab))
  130. __vsymtab_end = .;
  131. . = ALIGN(4);
  132. . = ALIGN(4);
  133. __rt_init_start = .;
  134. KEEP(*(SORT(.rti_fn*)))
  135. __rt_init_end = .;
  136. . = ALIGN(4);
  137. /* section information for modules */
  138. . = ALIGN(4);
  139. __rtmsymtab_start = .;
  140. KEEP(*(RTMSymTab))
  141. __rtmsymtab_end = .;
  142. /* RT-Thread related sections - end */
  143. } > XPI0
  144. .rel : {
  145. KEEP(*(.rel*))
  146. } > XPI0
  147. PROVIDE (__etext = .);
  148. PROVIDE (_etext = .);
  149. PROVIDE (etext = .);
  150. .bss(NOLOAD) : {
  151. . = ALIGN(8);
  152. __bss_start__ = .;
  153. *(.bss)
  154. *(.bss*)
  155. *(.sbss*)
  156. *(.scommon)
  157. *(.scommon*)
  158. *(.dynsbss*)
  159. *(COMMON)
  160. . = ALIGN(8);
  161. _end = .;
  162. __bss_end__ = .;
  163. } > AXI_SRAM
  164. /* Note: the .tbss and .tdata section should be adjacent */
  165. .tbss(NOLOAD) : {
  166. . = ALIGN(8);
  167. __tbss_start__ = .;
  168. *(.tbss*)
  169. *(.tcommon*)
  170. _end = .;
  171. __tbss_end__ = .;
  172. } > AXI_SRAM
  173. .tdata : AT(etext) {
  174. . = ALIGN(8);
  175. __tdata_start__ = .;
  176. __thread_pointer = .;
  177. *(.tdata)
  178. *(.tdata*)
  179. . = ALIGN(8);
  180. __tdata_end__ = .;
  181. } > AXI_SRAM
  182. .data : AT(etext + __tdata_end__ - __tdata_start__) {
  183. . = ALIGN(8);
  184. __data_start__ = .;
  185. __global_pointer$ = . + 0x800;
  186. *(.data)
  187. *(.data*)
  188. *(.sdata)
  189. *(.sdata*)
  190. KEEP(*(.jcr))
  191. KEEP(*(.dynamic))
  192. KEEP(*(.got*))
  193. KEEP(*(.got))
  194. KEEP(*(.gcc_except_table))
  195. KEEP(*(.gcc_except_table.*))
  196. . = ALIGN(8);
  197. PROVIDE(__preinit_array_start = .);
  198. KEEP(*(.preinit_array))
  199. PROVIDE(__preinit_array_end = .);
  200. . = ALIGN(8);
  201. PROVIDE(__init_array_start = .);
  202. KEEP(*(SORT_BY_INIT_PRIORITY(.init_array.*)))
  203. KEEP(*(.init_array))
  204. PROVIDE(__init_array_end = .);
  205. . = ALIGN(8);
  206. PROVIDE(__finit_array_start = .);
  207. KEEP(*(SORT_BY_INIT_PRIORITY(.finit_array.*)))
  208. KEEP(*(.finit_array))
  209. PROVIDE(__finit_array_end = .);
  210. . = ALIGN(8);
  211. PROVIDE(__ctors_start__ = .);
  212. KEEP(*crtbegin*.o(.ctors))
  213. KEEP(*(EXCLUDE_FILE (*crtend*.o) .ctors))
  214. KEEP(*(SORT(.ctors.*)))
  215. KEEP(*(.ctors))
  216. PROVIDE(__ctors_end__ = .);
  217. . = ALIGN(8);
  218. KEEP(*crtbegin*.o(.dtors))
  219. KEEP(*(EXCLUDE_FILE (*crtend*.o) .dtors))
  220. KEEP(*(SORT(.dtors.*)))
  221. KEEP(*(.dtors))
  222. . = ALIGN(8);
  223. __data_end__ = .;
  224. PROVIDE (__edata = .);
  225. PROVIDE (_edata = .);
  226. PROVIDE (edata = .);
  227. } > AXI_SRAM
  228. __fw_size__ = __data_end__ - __tdata_start__ + etext - __app_load_addr__;
  229. .heap(NOLOAD) : {
  230. . = ALIGN(8);
  231. __heap_start__ = .;
  232. . += HEAP_SIZE;
  233. __heap_end__ = .;
  234. } > AXI_SRAM
  235. .framebuffer (NOLOAD) : {
  236. . = ALIGN(8);
  237. KEEP(*(.framebuffer))
  238. . = ALIGN(8);
  239. } > AXI_SRAM
  240. .stack(NOLOAD) : {
  241. . = ALIGN(8);
  242. __stack_base__ = .;
  243. . += STACK_SIZE;
  244. . = ALIGN(8);
  245. PROVIDE (_stack = .);
  246. PROVIDE (_stack_in_dlm = .);
  247. PROVIDE( __rt_rvstack = . );
  248. } > AXI_SRAM
  249. .noncacheable.init : AT(etext + __data_end__ - __tdata_start__ + __ramfunc_end__ - __ramfunc_start__) {
  250. . = ALIGN(8);
  251. __noncacheable_init_start__ = .;
  252. KEEP(*(.noncacheable.init))
  253. __noncacheable_init_end__ = .;
  254. . = ALIGN(8);
  255. } > NONCACHEABLE_RAM
  256. .noncacheable.bss (NOLOAD) : {
  257. . = ALIGN(8);
  258. KEEP(*(.noncacheable))
  259. __noncacheable_bss_start__ = .;
  260. KEEP(*(.noncacheable.bss))
  261. __noncacheable_bss_end__ = .;
  262. . = ALIGN(8);
  263. } > NONCACHEABLE_RAM
  264. .ahb_sram (NOLOAD) : {
  265. KEEP(*(.ahb_sram))
  266. } > AHB_SRAM
  267. .apb_sram (NOLOAD) : {
  268. KEEP(*(.backup_sram))
  269. } > APB_SRAM
  270. __noncacheable_start__ = ORIGIN(NONCACHEABLE_RAM);
  271. __noncacheable_end__ = ORIGIN(NONCACHEABLE_RAM) + LENGTH(NONCACHEABLE_RAM);
  272. .sdram (NOLOAD) : {
  273. . = ALIGN(8);
  274. __sdram_start__ = .;
  275. . += SDRAM_SIZE;
  276. __sdram_end__ = .;
  277. } > SDRAM
  278. }