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