gcc_xip_off.ld.S 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191
  1. /* SPDX-License-Identifier: BSD-3-Clause */
  2. /*
  3. * Copyright (c) 2021 Rockchip Electronics Co., Ltd.
  4. */
  5. #include "rtconfig.h"
  6. MEMORY
  7. {
  8. FLASH (rx) : ORIGIN = 0x18000000, LENGTH = 16M /* Nor Flash */
  9. SRAM_I (rxw) : ORIGIN = 0x04000000, LENGTH = 1M /* SRAM */
  10. SRAM_D (rxw) : ORIGIN = 0x20000000, LENGTH = 1M /* SRAM */
  11. }
  12. MAIN_STACK_SIZE = 0x400;
  13. ENTRY(Reset_Handler)
  14. SECTIONS
  15. {
  16. .text :
  17. {
  18. . = ALIGN(32);
  19. KEEP(*(.vectors))
  20. . = ALIGN(32);
  21. *(.text*)
  22. KEEP(*(.init))
  23. KEEP(*(.fini))
  24. *(.rodata*)
  25. *(COMMON)
  26. /* section information for finsh shell */
  27. . = ALIGN(4);
  28. __fsymtab_start = .;
  29. KEEP(*(FSymTab))
  30. __fsymtab_end = .;
  31. . = ALIGN(4);
  32. __vsymtab_start = .;
  33. KEEP(*(VSymTab))
  34. __vsymtab_end = .;
  35. . = ALIGN(4);
  36. /* section information for initial. */
  37. . = ALIGN(4);
  38. __rt_init_start = .;
  39. KEEP(*(SORT(.rti_fn*)))
  40. __rt_init_end = .;
  41. . = ALIGN(4);
  42. /* section information for modules */
  43. . = ALIGN(4);
  44. __rtmsymtab_start = .;
  45. KEEP(*(RTMSymTab))
  46. __rtmsymtab_end = .;
  47. . = ALIGN(4);
  48. KEEP(*(.eh_frame*))
  49. } > SRAM_I
  50. .ARM.extab :
  51. {
  52. *(.ARM.extab* .gnu.linkonce.armextab.*)
  53. } > SRAM_I
  54. .ARM.exidx :
  55. {
  56. __exidx_start = .;
  57. *(.ARM.exidx* .gnu.linkonce.armexidx.*)
  58. __exidx_end = .;
  59. } > SRAM_I
  60. .ctors :
  61. {
  62. . = ALIGN(32);
  63. PROVIDE(__ctors_start__ = .);
  64. KEEP(*(SORT(.ctors.*)))
  65. KEEP(*(.ctors))
  66. . = ALIGN(32);
  67. PROVIDE(__ctors_end__ = .);
  68. } > SRAM_I
  69. .dtors :
  70. {
  71. . = ALIGN(32);
  72. PROVIDE(__dtors_start__ = .);
  73. KEEP(*(SORT(.dtors.*)))
  74. KEEP(*(.dtors))
  75. . = ALIGN(32);
  76. PROVIDE(__dtors_end__ = .);
  77. } > SRAM_I
  78. .copy.table :
  79. {
  80. . = ALIGN(32);
  81. PROVIDE(__copy_table_start__ = .);
  82. LONG (__etext)
  83. LONG (__data_start__)
  84. LONG ((__data_end__ - __data_start__) / 4)
  85. PROVIDE(__copy_table_end__ = .);
  86. } > SRAM_I
  87. .zero.table :
  88. {
  89. . = ALIGN(32);
  90. PROVIDE(__zero_table_start__ = .);
  91. LONG (__bss_start__)
  92. LONG ((__bss_end__ - __bss_start__) / 4)
  93. PROVIDE(__zero_table_end__ = .);
  94. } > SRAM_I
  95. /**
  96. * Location counter can end up 2byte aligned with narrow Thumb code but
  97. * __etext is assumed by startup code to be the LMA of a section in RAM
  98. * which must be 4byte aligned. In addition, 32byte cacheline alignment
  99. * is required here, because of RK2108 with cache.
  100. */
  101. __etext = ALIGN (32);
  102. SRAM_DATA_DEST = ORIGIN(SRAM_D) + __etext - ORIGIN(SRAM_I);
  103. .data SRAM_DATA_DEST : AT (__etext)
  104. {
  105. __data_start__ = ALIGN (32);
  106. *(vtable)
  107. *(.data)
  108. *(.data.*)
  109. . = ALIGN(4);
  110. /* preinit data */
  111. PROVIDE_HIDDEN (__preinit_array_start = .);
  112. KEEP(*(.preinit_array))
  113. PROVIDE_HIDDEN (__preinit_array_end = .);
  114. . = ALIGN(4);
  115. /* init data */
  116. PROVIDE_HIDDEN (__init_array_start = .);
  117. KEEP(*(SORT(.init_array.*)))
  118. KEEP(*(.init_array))
  119. PROVIDE_HIDDEN (__init_array_end = .);
  120. . = ALIGN(4);
  121. /* finit data */
  122. PROVIDE_HIDDEN (__fini_array_start = .);
  123. KEEP(*(SORT(.fini_array.*)))
  124. KEEP(*(.fini_array))
  125. PROVIDE_HIDDEN (__fini_array_end = .);
  126. KEEP(*(.jcr*))
  127. . = ALIGN(4);
  128. _gp = ABSOLUTE(.); /* Base of small data */
  129. . = ALIGN(32);
  130. /* All data end */
  131. __data_end__ = .;
  132. } > SRAM_D
  133. .bss :
  134. {
  135. . = ALIGN(32);
  136. PROVIDE(__bss_start__ = .);
  137. *(.bss)
  138. *(.bss.*)
  139. *(.dynbss)
  140. *(COMMON)
  141. . = ALIGN(32);
  142. PROVIDE(__bss_end__ = .);
  143. } > SRAM_D
  144. .stack :
  145. {
  146. . = ALIGN(32);
  147. __StackLimit = .;
  148. . = . + MAIN_STACK_SIZE;
  149. . = ALIGN(32);
  150. __StackTop = .;
  151. __stack = __StackTop;
  152. } > SRAM_D
  153. .heap :
  154. {
  155. . = ALIGN(32);
  156. PROVIDE(__heap_begin = .);
  157. __end__ = .;
  158. PROVIDE(end = .);
  159. . = ORIGIN(SRAM_D) + LENGTH(SRAM_D);
  160. __HeapLimit = .;
  161. PROVIDE(__heap_end = .);
  162. } > SRAM_D
  163. }