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