ram_sdram_rtt.ld 6.1 KB

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