link.lds 8.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298
  1. /*
  2. ** ###################################################################
  3. ** Processors: MIMXRT1052CVJ5B
  4. ** MIMXRT1052CVL5B
  5. ** MIMXRT1052DVJ6B
  6. ** MIMXRT1052DVL6B
  7. **
  8. ** Compiler: GNU C Compiler
  9. ** Reference manual: IMXRT1050RM Rev.1, 03/2018
  10. ** Version: rev. 0.1, 2017-01-10
  11. ** Build: b180509
  12. **
  13. ** Abstract:
  14. ** Linker file for the GNU C Compiler
  15. **
  16. ** The Clear BSD License
  17. ** Copyright 2016 Freescale Semiconductor, Inc.
  18. ** Copyright 2016-2018 NXP
  19. ** All rights reserved.
  20. **
  21. ** Redistribution and use in source and binary forms, with or without
  22. ** modification, are permitted (subject to the limitations in the
  23. ** disclaimer below) provided that the following conditions are met:
  24. **
  25. ** * Redistributions of source code must retain the above copyright
  26. ** notice, this list of conditions and the following disclaimer.
  27. **
  28. ** * Redistributions in binary form must reproduce the above copyright
  29. ** notice, this list of conditions and the following disclaimer in the
  30. ** documentation and/or other materials provided with the distribution.
  31. **
  32. ** * Neither the name of the copyright holder nor the names of its
  33. ** contributors may be used to endorse or promote products derived from
  34. ** this software without specific prior written permission.
  35. **
  36. ** NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE
  37. ** GRANTED BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT
  38. ** HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
  39. ** WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
  40. ** MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  41. ** DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
  42. ** LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
  43. ** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
  44. ** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
  45. ** BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
  46. ** WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
  47. ** OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
  48. ** IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  49. **
  50. ** http: www.nxp.com
  51. ** mail: support@nxp.com
  52. **
  53. ** ###################################################################
  54. */
  55. /* Entry Point */
  56. ENTRY(Reset_Handler)
  57. HEAP_SIZE = DEFINED(__heap_size__) ? __heap_size__ : 0x0400;
  58. STACK_SIZE = DEFINED(__stack_size__) ? __stack_size__ : 0x0400;
  59. /* Specify the memory areas */
  60. MEMORY
  61. {
  62. m_flash_config (RX) : ORIGIN = 0x60000000, LENGTH = 0x00001000
  63. m_ivt (RX) : ORIGIN = 0x60001000, LENGTH = 0x00001000
  64. m_interrupts (RX) : ORIGIN = 0x60002000, LENGTH = 0x00000400
  65. m_text (RX) : ORIGIN = 0x60002400, LENGTH = 0x01FFDC00
  66. m_data (RW) : ORIGIN = 0x20000000, LENGTH = 0x00020000
  67. m_data2 (RW) : ORIGIN = 0x20200000, LENGTH = 0x00040000
  68. }
  69. /* Define output sections */
  70. SECTIONS
  71. {
  72. .flash_config :
  73. {
  74. . = ALIGN(4);
  75. __FLASH_BASE = .;
  76. KEEP(* (.boot_hdr.conf)) /* flash config section */
  77. . = ALIGN(4);
  78. } > m_flash_config
  79. ivt_begin= ORIGIN(m_flash_config) + LENGTH(m_flash_config);
  80. .ivt : AT(ivt_begin)
  81. {
  82. . = ALIGN(4);
  83. KEEP(* (.boot_hdr.ivt)) /* ivt section */
  84. KEEP(* (.boot_hdr.boot_data)) /* boot section */
  85. KEEP(* (.boot_hdr.dcd_data)) /* dcd section */
  86. . = ALIGN(4);
  87. } > m_ivt
  88. /* The startup code goes first into internal RAM */
  89. .interrupts :
  90. {
  91. __VECTOR_TABLE = .;
  92. . = ALIGN(4);
  93. KEEP(*(.isr_vector)) /* Startup code */
  94. . = ALIGN(4);
  95. } > m_interrupts
  96. __VECTOR_RAM = __VECTOR_TABLE;
  97. __RAM_VECTOR_TABLE_SIZE_BYTES = 0x0;
  98. /* The program code and other data goes into internal RAM */
  99. .text :
  100. {
  101. . = ALIGN(4);
  102. *(.text) /* .text sections (code) */
  103. *(.text*) /* .text* sections (code) */
  104. *(.rodata) /* .rodata sections (constants, strings, etc.) */
  105. *(.rodata*) /* .rodata* sections (constants, strings, etc.) */
  106. *(.glue_7) /* glue arm to thumb code */
  107. *(.glue_7t) /* glue thumb to arm code */
  108. *(.eh_frame)
  109. KEEP (*(.init))
  110. KEEP (*(.fini))
  111. . = ALIGN(4);
  112. /* section information for finsh shell */
  113. . = ALIGN(4);
  114. __fsymtab_start = .;
  115. KEEP(*(FSymTab))
  116. __fsymtab_end = .;
  117. . = ALIGN(4);
  118. __vsymtab_start = .;
  119. KEEP(*(VSymTab))
  120. __vsymtab_end = .;
  121. . = ALIGN(4);
  122. /* section information for initial. */
  123. . = ALIGN(4);
  124. __rt_init_start = .;
  125. KEEP(*(SORT(.rti_fn*)))
  126. __rt_init_end = .;
  127. } > m_text
  128. .ARM.extab :
  129. {
  130. *(.ARM.extab* .gnu.linkonce.armextab.*)
  131. } > m_text
  132. .ARM :
  133. {
  134. __exidx_start = .;
  135. *(.ARM.exidx*)
  136. __exidx_end = .;
  137. } > m_text
  138. .ctors :
  139. {
  140. __CTOR_LIST__ = .;
  141. /* gcc uses crtbegin.o to find the start of
  142. the constructors, so we make sure it is
  143. first. Because this is a wildcard, it
  144. doesn't matter if the user does not
  145. actually link against crtbegin.o; the
  146. linker won't look for a file to match a
  147. wildcard. The wildcard also means that it
  148. doesn't matter which directory crtbegin.o
  149. is in. */
  150. KEEP (*crtbegin.o(.ctors))
  151. KEEP (*crtbegin?.o(.ctors))
  152. /* We don't want to include the .ctor section from
  153. from the crtend.o file until after the sorted ctors.
  154. The .ctor section from the crtend file contains the
  155. end of ctors marker and it must be last */
  156. KEEP (*(EXCLUDE_FILE(*crtend?.o *crtend.o) .ctors))
  157. KEEP (*(SORT(.ctors.*)))
  158. KEEP (*(.ctors))
  159. __CTOR_END__ = .;
  160. } > m_text
  161. .dtors :
  162. {
  163. __DTOR_LIST__ = .;
  164. KEEP (*crtbegin.o(.dtors))
  165. KEEP (*crtbegin?.o(.dtors))
  166. KEEP (*(EXCLUDE_FILE(*crtend?.o *crtend.o) .dtors))
  167. KEEP (*(SORT(.dtors.*)))
  168. KEEP (*(.dtors))
  169. __DTOR_END__ = .;
  170. } > m_text
  171. .preinit_array :
  172. {
  173. PROVIDE_HIDDEN (__preinit_array_start = .);
  174. KEEP (*(.preinit_array*))
  175. PROVIDE_HIDDEN (__preinit_array_end = .);
  176. } > m_text
  177. .init_array :
  178. {
  179. PROVIDE_HIDDEN (__init_array_start = .);
  180. KEEP (*(SORT(.init_array.*)))
  181. KEEP (*(.init_array*))
  182. PROVIDE_HIDDEN (__init_array_end = .);
  183. } > m_text
  184. .fini_array :
  185. {
  186. PROVIDE_HIDDEN (__fini_array_start = .);
  187. KEEP (*(SORT(.fini_array.*)))
  188. KEEP (*(.fini_array*))
  189. PROVIDE_HIDDEN (__fini_array_end = .);
  190. } > m_text
  191. __etext = .; /* define a global symbol at end of code */
  192. __DATA_ROM = .; /* Symbol is used by startup for data initialization */
  193. .data : AT(__DATA_ROM)
  194. {
  195. . = ALIGN(4);
  196. __DATA_RAM = .;
  197. __data_start__ = .; /* create a global symbol at data start */
  198. *(m_usb_dma_init_data)
  199. *(.data) /* .data sections */
  200. *(.data*) /* .data* sections */
  201. KEEP(*(.jcr*))
  202. . = ALIGN(4);
  203. __data_end__ = .; /* define a global symbol at data end */
  204. } > m_data
  205. __NDATA_ROM = __DATA_ROM + (__data_end__ - __data_start__);
  206. .ncache.init : AT(__NDATA_ROM)
  207. {
  208. __noncachedata_start__ = .; /* create a global symbol at ncache data start */
  209. *(NonCacheable.init)
  210. . = ALIGN(4);
  211. __noncachedata_init_end__ = .; /* create a global symbol at initialized ncache data end */
  212. } > m_data
  213. . = __noncachedata_init_end__;
  214. .ncache :
  215. {
  216. *(NonCacheable)
  217. . = ALIGN(4);
  218. __noncachedata_end__ = .; /* define a global symbol at ncache data end */
  219. } > m_data
  220. __DATA_END = __NDATA_ROM + (__noncachedata_init_end__ - __noncachedata_start__);
  221. text_end = ORIGIN(m_text) + LENGTH(m_text);
  222. ASSERT(__DATA_END <= text_end, "region m_text overflowed with text and data")
  223. /* Uninitialized data section */
  224. .bss :
  225. {
  226. /* This is used by the startup in order to initialize the .bss section */
  227. . = ALIGN(4);
  228. __START_BSS = .;
  229. __bss_start__ = .;
  230. *(m_usb_dma_noninit_data)
  231. *(.bss)
  232. *(.bss*)
  233. *(COMMON)
  234. . = ALIGN(4);
  235. __bss_end__ = .;
  236. __END_BSS = .;
  237. } > m_data
  238. .heap :
  239. {
  240. . = ALIGN(8);
  241. __end__ = .;
  242. PROVIDE(end = .);
  243. __HeapBase = .;
  244. . += HEAP_SIZE;
  245. __HeapLimit = .;
  246. __heap_limit = .; /* Add for _sbrk */
  247. } > m_data
  248. .stack :
  249. {
  250. . = ALIGN(8);
  251. stack_start = .;
  252. . += STACK_SIZE;
  253. stack_end = .;
  254. __StackTop = .;
  255. } > m_data
  256. .RTT_HEAP :
  257. {
  258. heap_start = .;
  259. . = ALIGN(8);
  260. } > m_data
  261. PROVIDE(heap_end = ORIGIN(m_data) + LENGTH(m_data));
  262. /* Initializes stack on the end of block */
  263. __StackLimit = __StackTop - STACK_SIZE;
  264. PROVIDE(__stack = __StackTop);
  265. .ARM.attributes 0 : { *(.ARM.attributes) }
  266. ASSERT(__StackLimit >= __HeapLimit, "region m_data overflowed with stack and heap")
  267. }