da1469x.ld 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245
  1. /*
  2. * Licensed to the Apache Software Foundation (ASF) under one
  3. * or more contributor license agreements. See the NOTICE file
  4. * distributed with this work for additional information
  5. * regarding copyright ownership. The ASF licenses this file
  6. * to you under the Apache License, Version 2.0 (the
  7. * "License"); you may not use this file except in compliance
  8. * with the License. You may obtain a copy of the License at
  9. *
  10. * http://www.apache.org/licenses/LICENSE-2.0
  11. *
  12. * Unless required by applicable law or agreed to in writing,
  13. * software distributed under the License is distributed on an
  14. * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  15. * KIND, either express or implied. See the License for the
  16. * specific language governing permissions and limitations
  17. * under the License.
  18. */
  19. MEMORY
  20. {
  21. /*
  22. * Flash is remapped at 0x0 by 1st stage bootloader, but this is done with
  23. * an offset derived from image header thus it is safer to use remapped
  24. * address space at 0x0 instead of QSPI_M address space at 0x16000000.
  25. * Bootloader partition is 32K, but 9K is currently reserved for product
  26. * header (8K) and image header (1K).
  27. * First 512 bytes of SYSRAM are remapped at 0x0 and used as ISR vector
  28. * (there's no need to reallocate ISR vector) and thus cannot be used by
  29. * application.
  30. */
  31. FLASH (r) : ORIGIN = (0x00000000), LENGTH = (1024 * 1024)
  32. RAM (rw) : ORIGIN = (0x20000000), LENGTH = (512 * 1024)
  33. }
  34. OUTPUT_FORMAT ("elf32-littlearm", "elf32-bigarm", "elf32-littlearm")
  35. /* Linker script to place sections and symbol values. Should be used together
  36. * with other linker script that defines memory regions FLASH and RAM.
  37. * It references following symbols, which must be defined in code:
  38. * Reset_Handler : Entry of reset handler
  39. *
  40. * It defines following symbols, which code can use without definition:
  41. * __exidx_start
  42. * __exidx_end
  43. * __etext
  44. * __data_start__
  45. * __preinit_array_start
  46. * __preinit_array_end
  47. * __init_array_start
  48. * __init_array_end
  49. * __fini_array_start
  50. * __fini_array_end
  51. * __data_end__
  52. * __bss_start__
  53. * __bss_end__
  54. * __HeapBase
  55. * __HeapLimit
  56. * __StackLimit
  57. * __StackTop
  58. * __stack
  59. * __bssnz_start__
  60. * __bssnz_end__
  61. */
  62. ENTRY(Reset_Handler)
  63. SECTIONS
  64. {
  65. __text = .;
  66. .text :
  67. {
  68. __isr_vector_start = .;
  69. KEEP(*(.isr_vector))
  70. /* ISR vector shall have exactly 512 bytes */
  71. . = __isr_vector_start + 0x200;
  72. __isr_vector_end = .;
  73. *(.text)
  74. *(.text.*)
  75. *(.libcmac.rom)
  76. KEEP(*(.init))
  77. KEEP(*(.fini))
  78. /* .ctors */
  79. *crtbegin.o(.ctors)
  80. *crtbegin?.o(.ctors)
  81. *(EXCLUDE_FILE(*crtend?.o *crtend.o) .ctors)
  82. *(SORT(.ctors.*))
  83. *(.ctors)
  84. /* .dtors */
  85. *crtbegin.o(.dtors)
  86. *crtbegin?.o(.dtors)
  87. *(EXCLUDE_FILE(*crtend?.o *crtend.o) .dtors)
  88. *(SORT(.dtors.*))
  89. *(.dtors)
  90. *(.rodata*)
  91. *(.eh_frame*)
  92. . = ALIGN(4);
  93. } > FLASH
  94. .ARM.extab :
  95. {
  96. *(.ARM.extab* .gnu.linkonce.armextab.*)
  97. . = ALIGN(4);
  98. } > FLASH
  99. __exidx_start = .;
  100. .ARM :
  101. {
  102. *(.ARM.exidx* .gnu.linkonce.armexidx.*)
  103. . = ALIGN(4);
  104. } > FLASH
  105. __exidx_end = .;
  106. .intvect :
  107. {
  108. . = ALIGN(4);
  109. __intvect_start__ = .;
  110. . = . + (__isr_vector_end - __isr_vector_start);
  111. . = ALIGN(4);
  112. } > RAM
  113. .sleep_state (NOLOAD) :
  114. {
  115. . = ALIGN(4);
  116. *(sleep_state)
  117. } > RAM
  118. /* This section will be zeroed by RTT package init */
  119. .rtt (NOLOAD):
  120. {
  121. . = ALIGN(4);
  122. *(.rtt)
  123. . = ALIGN(4);
  124. } > RAM
  125. __text_ram_addr = LOADADDR(.text_ram);
  126. .text_ram :
  127. {
  128. . = ALIGN(4);
  129. __text_ram_start__ = .;
  130. *(.text_ram*)
  131. . = ALIGN(4);
  132. __text_ram_end__ = .;
  133. } > RAM AT > FLASH
  134. __etext = LOADADDR(.data);
  135. .data :
  136. {
  137. __data_start__ = .;
  138. *(vtable)
  139. *(.data*)
  140. . = ALIGN(4);
  141. /* preinit data */
  142. PROVIDE_HIDDEN (__preinit_array_start = .);
  143. *(.preinit_array)
  144. PROVIDE_HIDDEN (__preinit_array_end = .);
  145. . = ALIGN(4);
  146. /* init data */
  147. PROVIDE_HIDDEN (__init_array_start = .);
  148. *(SORT(.init_array.*))
  149. *(.init_array)
  150. PROVIDE_HIDDEN (__init_array_end = .);
  151. . = ALIGN(4);
  152. /* finit data */
  153. PROVIDE_HIDDEN (__fini_array_start = .);
  154. *(SORT(.fini_array.*))
  155. *(.fini_array)
  156. PROVIDE_HIDDEN (__fini_array_end = .);
  157. *(.jcr)
  158. . = ALIGN(4);
  159. /* All data end */
  160. __data_end__ = .;
  161. } > RAM AT > FLASH
  162. .bssnz :
  163. {
  164. . = ALIGN(4);
  165. __bssnz_start__ = .;
  166. *(.bss.core.nz*)
  167. . = ALIGN(4);
  168. __bssnz_end__ = .;
  169. } > RAM
  170. .bss :
  171. {
  172. . = ALIGN(4);
  173. __bss_start__ = .;
  174. *(.bss*)
  175. *(COMMON)
  176. . = ALIGN(4);
  177. __bss_end__ = .;
  178. } > RAM
  179. .cmac (NOLOAD) :
  180. {
  181. . = ALIGN(0x400);
  182. *(.libcmac.ram)
  183. } > RAM
  184. /* Heap starts after BSS */
  185. . = ALIGN(8);
  186. __HeapBase = .;
  187. /* .stack_dummy section doesn't contains any symbols. It is only
  188. * used for linker to calculate size of stack sections, and assign
  189. * values to stack symbols later */
  190. .stack_dummy (COPY):
  191. {
  192. *(.stack*)
  193. } > RAM
  194. _ram_start = ORIGIN(RAM);
  195. /* Set stack top to end of RAM, and stack limit move down by
  196. * size of stack_dummy section */
  197. __StackTop = ORIGIN(RAM) + LENGTH(RAM);
  198. __StackLimit = __StackTop - SIZEOF(.stack_dummy);
  199. PROVIDE(__stack = __StackTop);
  200. /* Top of head is the bottom of the stack */
  201. __HeapLimit = __StackLimit;
  202. end = __HeapLimit;
  203. /* Check if data + heap + stack exceeds RAM limit */
  204. ASSERT(__HeapBase <= __HeapLimit, "region RAM overflowed with stack")
  205. /* Check that intvect is at the beginning of RAM */
  206. ASSERT(__intvect_start__ == ORIGIN(RAM), "intvect is not at beginning of RAM")
  207. }