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