ram.ld 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208
  1. /*
  2. * Copyright (c) 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 : 0x4000;
  8. MEMORY
  9. {
  10. ILM (wx) : ORIGIN = 0x00000000, LENGTH = 128K
  11. DLM (w) : ORIGIN = 0x00080000, LENGTH = 128K
  12. AXI_SRAM_NONCACHEABLE (wx) : ORIGIN = 0x01080000, LENGTH = 128K
  13. AXI_SRAM (wx) : ORIGIN = 0x010A0000, LENGTH = 112K
  14. SHARE_RAM (w) : ORIGIN = 0x010BC000, LENGTH = 16K
  15. AHB_SRAM (w) : ORIGIN = 0xF0300000, 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. KEEP(*(.isr_s_vector))
  28. KEEP(*(.vector_s_table))
  29. . = ALIGN(8);
  30. } > ILM
  31. .rel : {
  32. KEEP(*(.rel*))
  33. } > ILM
  34. .text : {
  35. . = ALIGN(8);
  36. *(.text)
  37. *(.text*)
  38. *(.rodata)
  39. *(.rodata*)
  40. *(.srodata)
  41. *(.srodata*)
  42. *(.hash)
  43. *(.dyn*)
  44. *(.gnu*)
  45. *(.pl*)
  46. KEEP(*(.eh_frame))
  47. *(.eh_frame*)
  48. KEEP (*(.init))
  49. KEEP (*(.fini))
  50. /* section information for usbh class */
  51. . = ALIGN(8);
  52. __usbh_class_info_start__ = .;
  53. KEEP(*(.usbh_class_info))
  54. __usbh_class_info_end__ = .;
  55. . = ALIGN(8);
  56. PROVIDE (__etext = .);
  57. PROVIDE (_etext = .);
  58. PROVIDE (etext = .);
  59. } > ILM
  60. .data : AT(etext) {
  61. . = ALIGN(8);
  62. __data_start__ = .;
  63. __global_pointer$ = . + 0x800;
  64. *(.data)
  65. *(.data*)
  66. *(.sdata)
  67. *(.sdata*)
  68. *(.tdata)
  69. *(.tdata*)
  70. KEEP(*(.jcr))
  71. KEEP(*(.dynamic))
  72. KEEP(*(.got*))
  73. KEEP(*(.got))
  74. KEEP(*(.gcc_except_table))
  75. KEEP(*(.gcc_except_table.*))
  76. . = ALIGN(8);
  77. PROVIDE(__preinit_array_start = .);
  78. KEEP(*(.preinit_array))
  79. PROVIDE(__preinit_array_end = .);
  80. . = ALIGN(8);
  81. PROVIDE(__init_array_start = .);
  82. KEEP(*(SORT_BY_INIT_PRIORITY(.init_array.*)))
  83. KEEP(*(.init_array))
  84. PROVIDE(__init_array_end = .);
  85. . = ALIGN(8);
  86. PROVIDE(__finit_array_start = .);
  87. KEEP(*(SORT_BY_INIT_PRIORITY(.finit_array.*)))
  88. KEEP(*(.finit_array))
  89. PROVIDE(__finit_array_end = .);
  90. . = ALIGN(8);
  91. KEEP(*crtbegin*.o(.ctors))
  92. KEEP(*(EXCLUDE_FILE (*crtend*.o) .ctors))
  93. KEEP(*(SORT(.ctors.*)))
  94. KEEP(*(.ctors))
  95. . = ALIGN(8);
  96. KEEP(*crtbegin*.o(.dtors))
  97. KEEP(*(EXCLUDE_FILE (*crtend*.o) .dtors))
  98. KEEP(*(SORT(.dtors.*)))
  99. KEEP(*(.dtors))
  100. . = ALIGN(8);
  101. __data_end__ = .;
  102. PROVIDE (__edata = .);
  103. PROVIDE (_edata = .);
  104. PROVIDE (edata = .);
  105. } > AXI_SRAM
  106. .fast : AT(etext + __data_end__ - __data_start__) {
  107. . = ALIGN(8);
  108. PROVIDE(__ramfunc_start__ = .);
  109. *(.fast)
  110. . = ALIGN(8);
  111. PROVIDE(__ramfunc_end__ = .);
  112. } > ILM
  113. .bss (NOLOAD) : {
  114. . = ALIGN(8);
  115. __bss_start__ = .;
  116. *(.bss)
  117. *(.bss*)
  118. *(.tbss*)
  119. *(.sbss*)
  120. *(.scommon)
  121. *(.scommon*)
  122. *(.tcommon*)
  123. *(.dynsbss*)
  124. *(COMMON)
  125. . = ALIGN(8);
  126. _end = .;
  127. __bss_end__ = .;
  128. } > AXI_SRAM
  129. .framebuffer (NOLOAD) : {
  130. . = ALIGN(8);
  131. KEEP(*(.framebuffer))
  132. . = ALIGN(8);
  133. } > AXI_SRAM
  134. .noncacheable.init : AT(etext + __data_end__ - __data_start__ + __ramfunc_end__ - __ramfunc_start__) {
  135. . = ALIGN(8);
  136. __noncacheable_init_start__ = .;
  137. KEEP(*(.noncacheable.init))
  138. __noncacheable_init_end__ = .;
  139. . = ALIGN(8);
  140. } > AXI_SRAM_NONCACHEABLE
  141. .noncacheable.bss (NOLOAD) : {
  142. . = ALIGN(8);
  143. KEEP(*(.noncacheable))
  144. __noncacheable_bss_start__ = .;
  145. KEEP(*(.noncacheable.bss))
  146. __noncacheable_bss_end__ = .;
  147. . = ALIGN(8);
  148. } > AXI_SRAM_NONCACHEABLE
  149. .ahb_sram (NOLOAD) : {
  150. KEEP(*(.ahb_sram))
  151. } > AHB_SRAM
  152. .sh_mem (NOLOAD) : {
  153. KEEP(*(.sh_mem))
  154. } > SHARE_RAM
  155. .fast_ram (NOLOAD) : {
  156. KEEP(*(.fast_ram))
  157. } > DLM
  158. .heap (NOLOAD) : {
  159. . = ALIGN(8);
  160. __heap_start__ = .;
  161. . += HEAP_SIZE;
  162. __heap_end__ = .;
  163. } > DLM
  164. .stack (NOLOAD) : {
  165. . = ALIGN(8);
  166. __stack_base__ = .;
  167. . += STACK_SIZE;
  168. PROVIDE (_stack = .);
  169. PROVIDE (_stack_safe = .);
  170. } > DLM
  171. __noncacheable_start__ = ORIGIN(AXI_SRAM_NONCACHEABLE);
  172. __noncacheable_end__ = ORIGIN(AXI_SRAM_NONCACHEABLE) + LENGTH(AXI_SRAM_NONCACHEABLE);
  173. __share_mem_start__ = ORIGIN(SHARE_RAM);
  174. __share_mem_end__ = ORIGIN(SHARE_RAM) + LENGTH(SHARE_RAM);
  175. ASSERT((STACK_SIZE + HEAP_SIZE) <= 128K, "stack and heap total size larger than 128k")
  176. }