link.lds 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288
  1. /*
  2. ** ###################################################################
  3. ** Processors: MIMXRT1062CVJ5A
  4. ** MIMXRT1062CVL5A
  5. ** MIMXRT1062DVJ6A
  6. ** MIMXRT1062DVL6A
  7. ** MIMXRT1062DVN6B
  8. ** MIMXRT1062XVN5B
  9. **
  10. ** Compiler: GNU C Compiler
  11. ** Reference manual: IMXRT1060RM Rev.3, 07/2021 | IMXRT106XSRM Rev.0
  12. ** Version: rev. 0.2, 2022-03-25
  13. ** Build: b220401
  14. **
  15. ** Abstract:
  16. ** Linker file for the GNU C Compiler
  17. **
  18. ** Copyright 2016 Freescale Semiconductor, Inc.
  19. ** Copyright 2016-2022 NXP
  20. ** All rights reserved.
  21. **
  22. ** SPDX-License-Identifier: BSD-3-Clause
  23. **
  24. ** http: www.nxp.com
  25. ** mail: support@nxp.com
  26. **
  27. ** ###################################################################
  28. */
  29. /* Entry Point */
  30. ENTRY(Reset_Handler)
  31. HEAP_SIZE = DEFINED(__heap_size__) ? __heap_size__ : 0x2000;
  32. STACK_SIZE = DEFINED(__stack_size__) ? __stack_size__ : 0x2000;
  33. VECTOR_RAM_SIZE = DEFINED(__ram_vector_table__) ? 0x00000400 : 0;
  34. /* Specify the memory areas */
  35. MEMORY
  36. {
  37. m_flash_config (RX) : ORIGIN = 0x60000000, LENGTH = 0x00001000
  38. m_ivt (RX) : ORIGIN = 0x60001000, LENGTH = 0x00001000
  39. m_interrupts (RX) : ORIGIN = 0x60002000, LENGTH = 0x00000400
  40. m_text (RX) : ORIGIN = 0x60002400, LENGTH = 0x007FDC00
  41. m_qacode (RX) : ORIGIN = 0x00000000, LENGTH = 0x00020000
  42. m_data (RW) : ORIGIN = 0x20000000, LENGTH = 0x00020000
  43. m_data2 (RW) : ORIGIN = 0x20200000, LENGTH = 0x000C0000
  44. }
  45. /* Define output sections */
  46. SECTIONS
  47. {
  48. __NCACHE_REGION_START = ORIGIN(m_data2);
  49. __NCACHE_REGION_SIZE = 0;
  50. .flash_config :
  51. {
  52. . = ALIGN(4);
  53. __FLASH_BASE = .;
  54. KEEP(* (.boot_hdr.conf)) /* flash config section */
  55. . = ALIGN(4);
  56. } > m_flash_config
  57. ivt_begin = ORIGIN(m_flash_config) + LENGTH(m_flash_config);
  58. .ivt : AT(ivt_begin)
  59. {
  60. . = ALIGN(4);
  61. KEEP(* (.boot_hdr.ivt)) /* ivt section */
  62. KEEP(* (.boot_hdr.boot_data)) /* boot section */
  63. KEEP(* (.boot_hdr.dcd_data)) /* dcd section */
  64. . = ALIGN(4);
  65. } > m_ivt
  66. /* The startup code goes first into internal RAM */
  67. .interrupts :
  68. {
  69. __VECTOR_TABLE = .;
  70. __Vectors = .;
  71. . = ALIGN(4);
  72. KEEP(*(.isr_vector)) /* Startup code */
  73. . = ALIGN(4);
  74. } > m_interrupts
  75. /* The program code and other data goes into internal RAM */
  76. .text :
  77. {
  78. . = ALIGN(4);
  79. *(.text) /* .text sections (code) */
  80. *(.text*) /* .text* sections (code) */
  81. *(.rodata) /* .rodata sections (constants, strings, etc.) */
  82. *(.rodata*) /* .rodata* sections (constants, strings, etc.) */
  83. *(.glue_7) /* glue arm to thumb code */
  84. *(.glue_7t) /* glue thumb to arm code */
  85. *(.eh_frame)
  86. KEEP (*(.init))
  87. KEEP (*(.fini))
  88. . = ALIGN(4);
  89. /* section information for finsh shell */
  90. . = ALIGN(4);
  91. __fsymtab_start = .;
  92. KEEP(*(FSymTab))
  93. __fsymtab_end = .;
  94. . = ALIGN(4);
  95. __vsymtab_start = .;
  96. KEEP(*(VSymTab))
  97. __vsymtab_end = .;
  98. . = ALIGN(4);
  99. /* section information for initial. */
  100. . = ALIGN(4);
  101. __rt_init_start = .;
  102. KEEP(*(SORT(.rti_fn*)))
  103. __rt_init_end = .;
  104. } > m_text
  105. .ARM.extab :
  106. {
  107. *(.ARM.extab* .gnu.linkonce.armextab.*)
  108. } > m_text
  109. .ARM :
  110. {
  111. __exidx_start = .;
  112. *(.ARM.exidx*)
  113. __exidx_end = .;
  114. } > m_text
  115. .ctors :
  116. {
  117. PROVIDE(__ctors_start__ = .);
  118. /* __CTOR_LIST__ = .; */
  119. /* gcc uses crtbegin.o to find the start of
  120. the constructors, so we make sure it is
  121. first. Because this is a wildcard, it
  122. doesn't matter if the user does not
  123. actually link against crtbegin.o; the
  124. linker won't look for a file to match a
  125. wildcard. The wildcard also means that it
  126. doesn't matter which directory crtbegin.o
  127. is in. */
  128. KEEP (*crtbegin.o(.ctors))
  129. KEEP (*crtbegin?.o(.ctors))
  130. /* We don't want to include the .ctor section from
  131. from the crtend.o file until after the sorted ctors.
  132. The .ctor section from the crtend file contains the
  133. end of ctors marker and it must be last */
  134. KEEP (*(EXCLUDE_FILE(*crtend?.o *crtend.o) .ctors))
  135. KEEP (*(SORT(.ctors.*)))
  136. KEEP (*(.ctors))
  137. /* __CTOR_END__ = .; */
  138. PROVIDE(__ctors_end__ = .);
  139. } > m_text
  140. .dtors :
  141. {
  142. PROVIDE(__dtors_start__ = .);
  143. /* __DTOR_LIST__ = .; */
  144. KEEP (*crtbegin.o(.dtors))
  145. KEEP (*crtbegin?.o(.dtors))
  146. KEEP (*(EXCLUDE_FILE(*crtend?.o *crtend.o) .dtors))
  147. KEEP (*(SORT(.dtors.*)))
  148. KEEP (*(.dtors))
  149. /* __DTOR_END__ = .; */
  150. PROVIDE(__dtors_end__ = .);
  151. } > m_text
  152. .preinit_array :
  153. {
  154. PROVIDE_HIDDEN (__preinit_array_start = .);
  155. KEEP (*(.preinit_array*))
  156. PROVIDE_HIDDEN (__preinit_array_end = .);
  157. } > m_text
  158. .init_array :
  159. {
  160. PROVIDE_HIDDEN (__init_array_start = .);
  161. KEEP (*(SORT(.init_array.*)))
  162. KEEP (*(.init_array*))
  163. PROVIDE_HIDDEN (__init_array_end = .);
  164. } > m_text
  165. .fini_array :
  166. {
  167. PROVIDE_HIDDEN (__fini_array_start = .);
  168. KEEP (*(SORT(.fini_array.*)))
  169. KEEP (*(.fini_array*))
  170. PROVIDE_HIDDEN (__fini_array_end = .);
  171. } > m_text
  172. __etext = .; /* define a global symbol at end of code */
  173. __DATA_ROM = .; /* Symbol is used by startup for data initialization */
  174. .interrupts_ram :
  175. {
  176. . = ALIGN(4);
  177. __VECTOR_RAM__ = .;
  178. __interrupts_ram_start__ = .; /* Create a global symbol at data start */
  179. *(.m_interrupts_ram) /* This is a user defined section */
  180. . += VECTOR_RAM_SIZE;
  181. . = ALIGN(4);
  182. __interrupts_ram_end__ = .; /* Define a global symbol at data end */
  183. } > m_data
  184. __VECTOR_RAM = DEFINED(__ram_vector_table__) ? __VECTOR_RAM__ : ORIGIN(m_interrupts);
  185. __RAM_VECTOR_TABLE_SIZE_BYTES = DEFINED(__ram_vector_table__) ? (__interrupts_ram_end__ - __interrupts_ram_start__) : 0x0;
  186. .data : AT(__DATA_ROM)
  187. {
  188. . = ALIGN(4);
  189. __DATA_RAM = .;
  190. __data_start__ = .; /* create a global symbol at data start */
  191. *(m_usb_dma_init_data)
  192. *(.data) /* .data sections */
  193. *(.data*) /* .data* sections */
  194. *(DataQuickAccess) /* quick access data section */
  195. KEEP(*(.jcr*))
  196. . = ALIGN(4);
  197. __data_end__ = .; /* define a global symbol at data end */
  198. } > m_data
  199. __ram_function_flash_start = __DATA_ROM + (__data_end__ - __data_start__); /* Symbol is used by startup for TCM data initialization */
  200. .ram_function : AT(__ram_function_flash_start)
  201. {
  202. . = ALIGN(32);
  203. __ram_function_start__ = .;
  204. *(CodeQuickAccess)
  205. . = ALIGN(128);
  206. __ram_function_end__ = .;
  207. } > m_qacode
  208. __NDATA_ROM = __ram_function_flash_start + (__ram_function_end__ - __ram_function_start__);
  209. .ncache.init : AT(__NDATA_ROM)
  210. {
  211. __noncachedata_start__ = .; /* create a global symbol at ncache data start */
  212. *(NonCacheable.init)
  213. . = ALIGN(4);
  214. __noncachedata_init_end__ = .; /* create a global symbol at initialized ncache data end */
  215. } > m_data
  216. . = __noncachedata_init_end__;
  217. .ncache :
  218. {
  219. *(NonCacheable)
  220. . = ALIGN(4);
  221. __noncachedata_end__ = .; /* define a global symbol at ncache data end */
  222. } > m_data
  223. __DATA_END = __NDATA_ROM + (__noncachedata_init_end__ - __noncachedata_start__);
  224. text_end = ORIGIN(m_text) + LENGTH(m_text);
  225. ASSERT(__DATA_END <= text_end, "region m_text overflowed with text and data")
  226. /* Uninitialized data section */
  227. .bss :
  228. {
  229. /* This is used by the startup in order to initialize the .bss section */
  230. . = ALIGN(4);
  231. __START_BSS = .;
  232. __bss_start__ = .;
  233. *(m_usb_dma_noninit_data)
  234. *(.bss)
  235. *(.bss*)
  236. *(COMMON)
  237. . = ALIGN(4);
  238. __bss_end__ = .;
  239. __END_BSS = .;
  240. } > m_data
  241. .stack :
  242. {
  243. . = ALIGN(8);
  244. stack_start = .;
  245. . += STACK_SIZE;
  246. stack_end = .;
  247. __StackTop = .;
  248. } > m_data
  249. .RTT_HEAP :
  250. {
  251. heap_start = .;
  252. . = ALIGN(8);
  253. } > m_data
  254. PROVIDE(heap_end = ORIGIN(m_data2) + LENGTH(m_data2));
  255. .ARM.attributes 0 : { *(.ARM.attributes) }
  256. }