1/*
2** ###################################################################
3**     Processors:          MIMXRT1062CVJ5A
4**                          MIMXRT1062CVL5A
5**                          MIMXRT1062DVJ6A
6**                          MIMXRT1062DVL6A
7**                          MIMXRT1062DVN6B
8**                          MIMXRT1062XVN5B
9**
10**     Compiler:            GNU C Compiler
11**     Reference manual:    IMXRT1060RM Rev.3, 07/2021 | IMXRT106XSRM Rev.0
12**     Version:             rev. 0.2, 2022-03-25
13**     Build:               b220401
14**
15**     Abstract:
16**         Linker file for the GNU C Compiler
17**
18**     Copyright 2016 Freescale Semiconductor, Inc.
19**     Copyright 2016-2022 NXP
20**     All rights reserved.
21**
22**     SPDX-License-Identifier: BSD-3-Clause
23**
24**     http:                 www.nxp.com
25**     mail:                 support@nxp.com
26**
27** ###################################################################
28*/
29
30/* Entry Point */
31ENTRY(Reset_Handler)
32
33HEAP_SIZE  = DEFINED(__heap_size__)  ? __heap_size__  : 0x2000;
34STACK_SIZE = DEFINED(__stack_size__) ? __stack_size__ : 0x2000;
35VECTOR_RAM_SIZE = DEFINED(__ram_vector_table__) ? 0x00000400 : 0;
36
37/* Specify the memory areas */
38MEMORY
39{
40  m_flash_config        (RX)  : ORIGIN = 0x60000000, LENGTH = 0x00001000
41  m_ivt                 (RX)  : ORIGIN = 0x60001000, LENGTH = 0x00001000
42  m_interrupts          (RX)  : ORIGIN = 0x60002000, LENGTH = 0x00000400
43  m_text                (RX)  : ORIGIN = 0x60002400, LENGTH = 0x007FDC00
44  m_qacode              (RX)  : ORIGIN = 0x00000000, LENGTH = 0x00020000
45  m_data                (RW)  : ORIGIN = 0x20000000, LENGTH = 0x00020000
46  m_data2               (RW)  : ORIGIN = 0x20200000, LENGTH = 0x000C0000
47}
48
49/* Define output sections */
50SECTIONS
51{
52  __NCACHE_REGION_START = ORIGIN(m_data2);
53  __NCACHE_REGION_SIZE  = 0;
54
55  .flash_config :
56  {
57    . = ALIGN(4);
58    __FLASH_BASE = .;
59    KEEP(* (.boot_hdr.conf))     /* flash config section */
60    . = ALIGN(4);
61  } > m_flash_config
62
63  ivt_begin = ORIGIN(m_flash_config) + LENGTH(m_flash_config);
64
65  .ivt : AT(ivt_begin)
66  {
67    . = ALIGN(4);
68    KEEP(* (.boot_hdr.ivt))           /* ivt section */
69    KEEP(* (.boot_hdr.boot_data))     /* boot section */
70    KEEP(* (.boot_hdr.dcd_data))      /* dcd section */
71    . = ALIGN(4);
72  } > m_ivt
73
74  /* The startup code goes first into internal RAM */
75  .interrupts :
76  {
77    __VECTOR_TABLE = .;
78    __Vectors = .;
79    . = ALIGN(4);
80    KEEP(*(.isr_vector))     /* Startup code */
81    . = ALIGN(4);
82  } > m_interrupts
83
84  /* The program code and other data goes into internal RAM */
85  .text :
86  {
87    . = ALIGN(4);
88    *(.text)                 /* .text sections (code) */
89    *(.text*)                /* .text* sections (code) */
90    *(.rodata)               /* .rodata sections (constants, strings, etc.) */
91    *(.rodata*)              /* .rodata* sections (constants, strings, etc.) */
92    *(.glue_7)               /* glue arm to thumb code */
93    *(.glue_7t)              /* glue thumb to arm code */
94    *(.eh_frame)
95    KEEP (*(.init))
96    KEEP (*(.fini))
97    . = ALIGN(4);
98
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
110    /* section information for initial. */
111    . = ALIGN(4);
112    __rt_init_start = .;
113    KEEP(*(SORT(.rti_fn*)))
114    __rt_init_end = .;
115  } > m_text
116
117  .ARM.extab :
118  {
119    *(.ARM.extab* .gnu.linkonce.armextab.*)
120  } > m_text
121
122  .ARM :
123  {
124    __exidx_start = .;
125    *(.ARM.exidx*)
126    __exidx_end = .;
127  } > m_text
128
129 .ctors :
130  {
131    PROVIDE(__ctors_start__ = .);
132    /* __CTOR_LIST__ = .; */
133    /* gcc uses crtbegin.o to find the start of
134       the constructors, so we make sure it is
135       first.  Because this is a wildcard, it
136       doesn't matter if the user does not
137       actually link against crtbegin.o; the
138       linker won't look for a file to match a
139       wildcard.  The wildcard also means that it
140       doesn't matter which directory crtbegin.o
141       is in.  */
142    KEEP (*crtbegin.o(.ctors))
143    KEEP (*crtbegin?.o(.ctors))
144    /* We don't want to include the .ctor section from
145       from the crtend.o file until after the sorted ctors.
146       The .ctor section from the crtend file contains the
147       end of ctors marker and it must be last */
148    KEEP (*(EXCLUDE_FILE(*crtend?.o *crtend.o) .ctors))
149    KEEP (*(SORT(.ctors.*)))
150    KEEP (*(.ctors))
151    /* __CTOR_END__ = .; */
152    PROVIDE(__ctors_end__ = .);
153  } > m_text
154
155  .dtors :
156  {
157    PROVIDE(__dtors_start__ = .);
158    /* __DTOR_LIST__ = .; */
159    KEEP (*crtbegin.o(.dtors))
160    KEEP (*crtbegin?.o(.dtors))
161    KEEP (*(EXCLUDE_FILE(*crtend?.o *crtend.o) .dtors))
162    KEEP (*(SORT(.dtors.*)))
163    KEEP (*(.dtors))
164    /* __DTOR_END__ = .; */
165    PROVIDE(__dtors_end__ = .);
166  } > m_text
167
168  .preinit_array :
169  {
170    PROVIDE_HIDDEN (__preinit_array_start = .);
171    KEEP (*(.preinit_array*))
172    PROVIDE_HIDDEN (__preinit_array_end = .);
173  } > m_text
174
175  .init_array :
176  {
177    PROVIDE_HIDDEN (__init_array_start = .);
178    KEEP (*(SORT(.init_array.*)))
179    KEEP (*(.init_array*))
180    PROVIDE_HIDDEN (__init_array_end = .);
181  } > m_text
182
183  .fini_array :
184  {
185    PROVIDE_HIDDEN (__fini_array_start = .);
186    KEEP (*(SORT(.fini_array.*)))
187    KEEP (*(.fini_array*))
188    PROVIDE_HIDDEN (__fini_array_end = .);
189  } > m_text
190
191  __etext = .;    /* define a global symbol at end of code */
192  __DATA_ROM = .; /* Symbol is used by startup for data initialization */
193
194  .interrupts_ram :
195  {
196    . = ALIGN(4);
197    __VECTOR_RAM__ = .;
198    __interrupts_ram_start__ = .; /* Create a global symbol at data start */
199    *(.m_interrupts_ram)     /* This is a user defined section */
200    . += VECTOR_RAM_SIZE;
201    . = ALIGN(4);
202    __interrupts_ram_end__ = .; /* Define a global symbol at data end */
203  } > m_data
204
205  __VECTOR_RAM = DEFINED(__ram_vector_table__) ? __VECTOR_RAM__ : ORIGIN(m_interrupts);
206  __RAM_VECTOR_TABLE_SIZE_BYTES = DEFINED(__ram_vector_table__) ? (__interrupts_ram_end__ - __interrupts_ram_start__) : 0x0;
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    *(DataQuickAccess)       /* quick access data section */
217    KEEP(*(.jcr*))
218    . = ALIGN(4);
219    __data_end__ = .;        /* define a global symbol at data end */
220  } > m_data
221
222  __ram_function_flash_start = __DATA_ROM + (__data_end__ - __data_start__); /* Symbol is used by startup for TCM data initialization */
223
224  .ram_function : AT(__ram_function_flash_start)
225  {
226    . = ALIGN(32);
227    __ram_function_start__ = .;
228    *(CodeQuickAccess)
229    . = ALIGN(128);
230    __ram_function_end__ = .;
231  } > m_qacode
232
233  __NDATA_ROM = __ram_function_flash_start + (__ram_function_end__ - __ram_function_start__);
234  .ncache.init : AT(__NDATA_ROM)
235  {
236    __noncachedata_start__ = .;   /* create a global symbol at ncache data start */
237    *(NonCacheable.init)
238    . = ALIGN(4);
239    __noncachedata_init_end__ = .;   /* create a global symbol at initialized ncache data end */
240  } > m_data
241  . = __noncachedata_init_end__;
242  .ncache :
243  {
244    *(NonCacheable)
245    . = ALIGN(4);
246    __noncachedata_end__ = .;     /* define a global symbol at ncache data end */
247  } > m_data
248
249  __DATA_END = __NDATA_ROM + (__noncachedata_init_end__ - __noncachedata_start__);
250  text_end = ORIGIN(m_text) + LENGTH(m_text);
251  ASSERT(__DATA_END <= text_end, "region m_text overflowed with text and data")
252
253  /* Uninitialized data section */
254  .bss :
255  {
256    /* This is used by the startup in order to initialize the .bss section */
257    . = ALIGN(4);
258    __START_BSS = .;
259    __bss_start__ = .;
260    *(m_usb_dma_noninit_data)
261    *(.bss)
262    *(.bss*)
263    *(COMMON)
264    . = ALIGN(4);
265    __bss_end__ = .;
266    __END_BSS = .;
267  } > m_data
268
269    .stack :
270  {
271    . = ALIGN(8);
272    stack_start = .;
273    . += STACK_SIZE;
274    stack_end = .;
275    __StackTop = .;
276  } > m_data
277
278  .RTT_HEAP :
279  {
280    heap_start = .;
281    . = ALIGN(8);
282  } > m_data
283
284  PROVIDE(heap_end = ORIGIN(m_data2) + LENGTH(m_data2));
285
286  .ARM.attributes 0 : { *(.ARM.attributes) }
287
288}
289