link.lds 8.2 KB

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