ram_rtt.ld 5.7 KB

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