MIMXRT1021xxxxx_flexspi_nor.ld 7.8 KB

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