ram_rtt.ld 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248
  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 : 128K;
  8. NONCACHEABLE_SIZE = DEFINED(_noncacheable_size) ? _noncacheable_size : 512K;
  9. MEMORY
  10. {
  11. ILM (wx) : ORIGIN = 0, LENGTH = 256K
  12. DLM (w) : ORIGIN = 0x00200000, LENGTH = 256K
  13. AXI_SRAM (wx) : ORIGIN = 0x01200000, LENGTH = 512K
  14. NONCACHEABLE_RAM (wx) : ORIGIN = 0x01280000, LENGTH = NONCACHEABLE_SIZE
  15. AHB_SRAM (w) : ORIGIN = 0xF0200000, LENGTH = 32k
  16. }
  17. SECTIONS
  18. {
  19. .start : {
  20. . = ALIGN(8);
  21. KEEP(*(.start))
  22. } > ILM
  23. .vectors : {
  24. . = ALIGN(8);
  25. KEEP(*(.isr_vector))
  26. KEEP(*(.vector_table))
  27. . = ALIGN(8);
  28. } > ILM
  29. .text : {
  30. . = ALIGN(8);
  31. *(.text)
  32. *(.text*)
  33. *(.rodata)
  34. *(.rodata*)
  35. *(.srodata)
  36. *(.srodata*)
  37. *(.hash)
  38. *(.dyn*)
  39. *(.gnu*)
  40. *(.pl*)
  41. *(FalPartTable)
  42. KEEP(*(.eh_frame))
  43. *(.eh_frame*)
  44. KEEP (*(.init))
  45. KEEP (*(.fini))
  46. . = ALIGN(8);
  47. /*********************************************
  48. *
  49. * RT-Thread related sections - Start
  50. *
  51. *********************************************/
  52. /* section information for finsh shell */
  53. . = ALIGN(4);
  54. __fsymtab_start = .;
  55. KEEP(*(FSymTab))
  56. __fsymtab_end = .;
  57. . = ALIGN(4);
  58. __vsymtab_start = .;
  59. KEEP(*(VSymTab))
  60. __vsymtab_end = .;
  61. . = ALIGN(4);
  62. . = ALIGN(4);
  63. __rt_init_start = .;
  64. KEEP(*(SORT(.rti_fn*)))
  65. __rt_init_end = .;
  66. . = ALIGN(4);
  67. /* section information for modules */
  68. . = ALIGN(4);
  69. __rtmsymtab_start = .;
  70. KEEP(*(RTMSymTab))
  71. __rtmsymtab_end = .;
  72. /* RT-Thread related sections - end */
  73. /* section information for usbh class */
  74. . = ALIGN(8);
  75. __usbh_class_info_start__ = .;
  76. KEEP(*(.usbh_class_info))
  77. __usbh_class_info_end__ = .;
  78. PROVIDE (__etext = .);
  79. PROVIDE (_etext = .);
  80. PROVIDE (etext = .);
  81. } > ILM
  82. .rel : {
  83. KEEP(*(.rel*))
  84. } > AXI_SRAM
  85. .fast_ram (NOLOAD) : {
  86. KEEP(*(.fast_ram))
  87. } > DLM
  88. .bss(NOLOAD) : {
  89. . = ALIGN(8);
  90. __bss_start__ = .;
  91. *(.bss)
  92. *(.bss*)
  93. *(.sbss*)
  94. *(.scommon)
  95. *(.scommon*)
  96. *(.dynsbss*)
  97. *(COMMON)
  98. . = ALIGN(8);
  99. _end = .;
  100. __bss_end__ = .;
  101. } > DLM
  102. /* Note: .tbss and .tdata should be adjacent */
  103. .tbss(NOLOAD) : {
  104. . = ALIGN(8);
  105. __tbss_start__ = .;
  106. *(.tbss*)
  107. *(.tcommon*)
  108. _end = .;
  109. __tbss_end__ = .;
  110. } > DLM
  111. .tdata : AT(etext) {
  112. . = ALIGN(8);
  113. __tdata_start__ = .;
  114. __thread_pointer = .;
  115. *(.tdata)
  116. *(.tdata*)
  117. . = ALIGN(8);
  118. __tdata_end__ = .;
  119. } > DLM
  120. .data : AT(etext + __tdata_end__ - __tdata_start__) {
  121. . = ALIGN(8);
  122. __data_start__ = .;
  123. __global_pointer$ = . + 0x800;
  124. *(.data)
  125. *(.data*)
  126. *(.sdata)
  127. *(.sdata*)
  128. KEEP(*(.jcr))
  129. KEEP(*(.dynamic))
  130. KEEP(*(.got*))
  131. KEEP(*(.got))
  132. KEEP(*(.gcc_except_table))
  133. KEEP(*(.gcc_except_table.*))
  134. . = ALIGN(8);
  135. PROVIDE(__preinit_array_start = .);
  136. KEEP(*(.preinit_array))
  137. PROVIDE(__preinit_array_end = .);
  138. . = ALIGN(8);
  139. PROVIDE(__init_array_start = .);
  140. KEEP(*(SORT_BY_INIT_PRIORITY(.init_array.*)))
  141. KEEP(*(.init_array))
  142. PROVIDE(__init_array_end = .);
  143. . = ALIGN(8);
  144. PROVIDE(__finit_array_start = .);
  145. KEEP(*(SORT_BY_INIT_PRIORITY(.finit_array.*)))
  146. KEEP(*(.finit_array))
  147. PROVIDE(__finit_array_end = .);
  148. . = ALIGN(8);
  149. PROVIDE(__ctors_start__ = .);
  150. KEEP(*crtbegin*.o(.ctors))
  151. KEEP(*(EXCLUDE_FILE (*crtend*.o) .ctors))
  152. KEEP(*(SORT(.ctors.*)))
  153. KEEP(*(.ctors))
  154. PROVIDE(__ctors_end__ = .);
  155. . = ALIGN(8);
  156. KEEP(*crtbegin*.o(.dtors))
  157. KEEP(*(EXCLUDE_FILE (*crtend*.o) .dtors))
  158. KEEP(*(SORT(.dtors.*)))
  159. KEEP(*(.dtors))
  160. . = ALIGN(8);
  161. __data_end__ = .;
  162. PROVIDE (__edata = .);
  163. PROVIDE (_edata = .);
  164. PROVIDE (edata = .);
  165. } > DLM
  166. .fast : AT(etext + __data_end__ - __tdata_start__) {
  167. . = ALIGN(8);
  168. PROVIDE(__ramfunc_start__ = .);
  169. *(.fast)
  170. . = ALIGN(8);
  171. PROVIDE(__ramfunc_end__ = .);
  172. } > AXI_SRAM
  173. .noncacheable.init : AT(etext + __data_end__ - __tdata_start__ + __ramfunc_end__ - __ramfunc_start__) {
  174. . = ALIGN(8);
  175. __noncacheable_init_start__ = .;
  176. KEEP(*(.noncacheable.init))
  177. __noncacheable_init_end__ = .;
  178. . = ALIGN(8);
  179. } > NONCACHEABLE_RAM
  180. .noncacheable.bss (NOLOAD) : {
  181. . = ALIGN(8);
  182. KEEP(*(.noncacheable))
  183. __noncacheable_bss_start__ = .;
  184. KEEP(*(.noncacheable.bss))
  185. __noncacheable_bss_end__ = .;
  186. . = ALIGN(8);
  187. } > NONCACHEABLE_RAM
  188. __noncacheable_start__ = ORIGIN(NONCACHEABLE_RAM);
  189. __noncacheable_end__ = ORIGIN(NONCACHEABLE_RAM) + LENGTH(NONCACHEABLE_RAM);
  190. .ahb_sram (NOLOAD) : {
  191. KEEP(*(.ahb_sram))
  192. } > AHB_SRAM
  193. .stack(NOLOAD) : {
  194. . = ALIGN(8);
  195. __stack_base__ = .;
  196. . += STACK_SIZE;
  197. PROVIDE (_stack = .);
  198. PROVIDE (_stack_in_dlm = .);
  199. PROVIDE (__rt_rvstack = .);
  200. } > DLM
  201. .framebuffer (NOLOAD) : {
  202. KEEP(*(.framebuffer))
  203. } > AXI_SRAM
  204. .heap (NOLOAD) : {
  205. . = ALIGN(8);
  206. __heap_start__ = .;
  207. . += HEAP_SIZE;
  208. __heap_end__ = .;
  209. } > AXI_SRAM
  210. }