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
47/* Entry Point */
48ENTRY(Reset_Handler)
49
50HEAP_SIZE  = DEFINED(__heap_size__)  ? __heap_size__  : 0x0400;
51STACK_SIZE = DEFINED(__stack_size__) ? __stack_size__ : 0x0400;
52
53/* Specify the memory areas */
54MEMORY
55{
56  m_boot_data           (RX)  : ORIGIN = 0x60000000, LENGTH = 0x00001000
57  m_image_vertor_table  (RX)  : ORIGIN = 0x60001000, LENGTH = 0x00001000
58
59  m_interrupts          (RX)  : ORIGIN = 0x60002000, LENGTH = 0x00000400
60  m_text                (RX)  : ORIGIN = 0x60002400, LENGTH = 0x1F7FDC00
61
62  m_itcm                (RW)  : ORIGIN = 0x00000000, LENGTH = 0x00020000
63  m_dtcm                (RW)  : ORIGIN = 0x20000000, LENGTH = 0x00020000
64  m_ocram               (RW)  : ORIGIN = 0x20200000, LENGTH = 0x00040000
65
66  m_sdram               (RW)  : ORIGIN = 0x80000000, LENGTH = 0x01E00000
67  m_nocache             (RW)  : ORIGIN = 0x81E00000, LENGTH = 0x00200000
68}
69
70/* Define output sections */
71SECTIONS
72{
73  .boot_data :
74  {
75    KEEP(*(.boot_hdr.conf))
76  } > m_boot_data
77
78  .image_vertor_table :
79  {
80    KEEP(*(.boot_hdr.ivt))
81    KEEP(*(.boot_hdr.boot_data))
82    KEEP(*(.boot_hdr.dcd_data))
83  } > m_image_vertor_table
84
85  /* The startup code goes first into internal RAM */
86  .interrupts :
87  {
88    __VECTOR_TABLE = .;
89    . = ALIGN(4);
90    KEEP(*(.isr_vector))     /* Startup code */
91    . = ALIGN(4);
92  } > m_interrupts
93
94  __VECTOR_RAM = __VECTOR_TABLE;
95  __RAM_VECTOR_TABLE_SIZE_BYTES = 0x0;
96
97  /* The program code and other data goes into internal RAM */
98  .text :
99  {
100    . = ALIGN(4);
101    *(.text)                 /* .text sections (code) */
102    *(.text*)                /* .text* sections (code) */
103    *(.rodata)               /* .rodata sections (constants, strings, etc.) */
104    *(.rodata*)              /* .rodata* sections (constants, strings, etc.) */
105    *(.glue_7)               /* glue arm to thumb code */
106    *(.glue_7t)              /* glue thumb to arm code */
107    *(.eh_frame)
108    KEEP (*(.init))
109    KEEP (*(.fini))
110    . = ALIGN(4);
111
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
123    /* section information for initial. */
124    . = ALIGN(4);
125    __rt_init_start = .;
126    KEEP(*(SORT(.rti_fn*)))
127    __rt_init_end = .;
128  } > m_text
129
130  .ARM.extab :
131  {
132    *(.ARM.extab* .gnu.linkonce.armextab.*)
133  } > m_text
134
135  .ARM :
136  {
137    __exidx_start = .;
138    *(.ARM.exidx*)
139    __exidx_end = .;
140  } > m_text
141
142 .ctors :
143  {
144    PROVIDE(__ctors_start__ = .);
145    /* __CTOR_LIST__ = .; */
146    /* gcc uses crtbegin.o to find the start of
147       the constructors, so we make sure it is
148       first.  Because this is a wildcard, it
149       doesn't matter if the user does not
150       actually link against crtbegin.o; the
151       linker won't look for a file to match a
152       wildcard.  The wildcard also means that it
153       doesn't matter which directory crtbegin.o
154       is in.  */
155    KEEP (*crtbegin.o(.ctors))
156    KEEP (*crtbegin?.o(.ctors))
157    /* We don't want to include the .ctor section from
158       from the crtend.o file until after the sorted ctors.
159       The .ctor section from the crtend file contains the
160       end of ctors marker and it must be last */
161    KEEP (*(EXCLUDE_FILE(*crtend?.o *crtend.o) .ctors))
162    KEEP (*(SORT(.ctors.*)))
163    KEEP (*(.ctors))
164    /* __CTOR_END__ = .; */
165    PROVIDE(__ctors_end__ = .);
166  } > m_text
167
168  .dtors :
169  {
170    PROVIDE(__dtors_start__ = .);
171    /* __DTOR_LIST__ = .; */
172    KEEP (*crtbegin.o(.dtors))
173    KEEP (*crtbegin?.o(.dtors))
174    KEEP (*(EXCLUDE_FILE(*crtend?.o *crtend.o) .dtors))
175    KEEP (*(SORT(.dtors.*)))
176    KEEP (*(.dtors))
177    /* __DTOR_END__ = .; */
178    PROVIDE(__dtors_end__ = .);
179  } > m_text
180
181  .preinit_array :
182  {
183    PROVIDE_HIDDEN (__preinit_array_start = .);
184    KEEP (*(.preinit_array*))
185    PROVIDE_HIDDEN (__preinit_array_end = .);
186  } > m_text
187
188  .init_array :
189  {
190    PROVIDE_HIDDEN (__init_array_start = .);
191    KEEP (*(SORT(.init_array.*)))
192    KEEP (*(.init_array*))
193    PROVIDE_HIDDEN (__init_array_end = .);
194  } > m_text
195
196  .fini_array :
197  {
198    PROVIDE_HIDDEN (__fini_array_start = .);
199    KEEP (*(SORT(.fini_array.*)))
200    KEEP (*(.fini_array*))
201    PROVIDE_HIDDEN (__fini_array_end = .);
202  } > m_text
203
204  __etext = .;    /* define a global symbol at end of code */
205  __DATA_ROM = .; /* Symbol is used by startup for data initialization */
206
207  .data : AT(__DATA_ROM)
208  {
209    . = ALIGN(4);
210    __DATA_RAM = .;
211    __data_start__ = .;      /* create a global symbol at data start */
212    *(m_usb_dma_init_data)
213    *(.data)                 /* .data sections */
214    *(.data*)                /* .data* sections */
215    KEEP(*(.jcr*))
216    . = ALIGN(4);
217    __data_end__ = .;        /* define a global symbol at data end */
218  } > m_dtcm
219
220  __NDATA_ROM = __DATA_ROM + (__data_end__ - __data_start__);
221  .ncache.init : AT(__NDATA_ROM)
222  {
223    __noncachedata_start__ = .;   /* create a global symbol at ncache data start */
224    *(NonCacheable.init)
225    . = ALIGN(4);
226    __noncachedata_init_end__ = .;   /* create a global symbol at initialized ncache data end */
227  } > m_nocache
228  . = __noncachedata_init_end__;
229  .ncache :
230  {
231    *(NonCacheable)
232    . = ALIGN(4);
233    __noncachedata_end__ = .;     /* define a global symbol at ncache data end */
234  } > m_nocache
235
236  __DATA_END = __NDATA_ROM + (__noncachedata_init_end__ - __noncachedata_start__);
237  text_end = ORIGIN(m_text) + LENGTH(m_text);
238  ASSERT(__DATA_END <= text_end, "region m_text overflowed with text and data")
239
240  /* Uninitialized data section */
241  .bss :
242  {
243    /* This is used by the startup in order to initialize the .bss section */
244    . = ALIGN(4);
245    __START_BSS = .;
246    __bss_start__ = .;
247    *(m_usb_dma_noninit_data)
248    *(.bss)
249    *(.bss*)
250    *(COMMON)
251    . = ALIGN(4);
252    __bss_end__ = .;
253    __END_BSS = .;
254  } > m_dtcm
255
256  .stack :
257  {
258    . = ALIGN(8);
259    stack_start = .;
260    . += STACK_SIZE;
261    stack_end = .;
262    __StackTop = .;
263  } > m_dtcm
264
265  .RTT_HEAP :
266  {
267    heap_start = .;
268    . = ALIGN(8);
269  } > m_dtcm
270
271  PROVIDE(heap_end = ORIGIN(m_dtcm) + LENGTH(m_dtcm));
272
273  .ARM.attributes 0 : { *(.ARM.attributes) }
274
275}
276
277