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