link.lds 8.3 KB

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