1/*
2** ###################################################################
3**     Processors:          MIMXRT1062CVJ5A
4**                          MIMXRT1062CVJ5B
5**                          MIMXRT1062CVL5A
6**                          MIMXRT1062CVL5B
7**                          MIMXRT1062DVJ6A
8**                          MIMXRT1062DVJ6B
9**                          MIMXRT1062DVL6A
10**                          MIMXRT1062DVL6B
11**                          MIMXRT1062DVN6B
12**                          MIMXRT1062XVN5B
13**
14**     Compiler:            GNU C Compiler
15**     Reference manual:    IMXRT1060RM Rev.3, 07/2021 | IMXRT106XSRM Rev.0
16**     Version:             rev. 0.2, 2022-03-25
17**     Build:               b221009
18**
19**     Abstract:
20**         Linker file for the GNU C Compiler
21**
22**     Copyright 2016 Freescale Semiconductor, Inc.
23**     Copyright 2016-2022 NXP
24**     All rights reserved.
25**
26**     SPDX-License-Identifier: BSD-3-Clause
27**
28**     http:                 www.nxp.com
29**     mail:                 support@nxp.com
30**
31** ###################################################################
32*/
33
34/* Entry Point */
35ENTRY(Reset_Handler)
36
37HEAP_SIZE  = DEFINED(__heap_size__)  ? __heap_size__  : 0x0400;
38STACK_SIZE = DEFINED(__stack_size__) ? __stack_size__ : 0x0400;
39NCACHE_HEAP_START = DEFINED(__heap_noncacheable__) ? 0x82000000 - HEAP_SIZE : 0x202C0000 - HEAP_SIZE;
40NCACHE_HEAP_SIZE  = DEFINED(__heap_noncacheable__) ? HEAP_SIZE : 0x0000;
41
42/* Specify the memory areas */
43MEMORY
44{
45  m_interrupts          (RX)  : ORIGIN = 0x80000000, LENGTH = 0x00000400
46  m_text                (RX)  : ORIGIN = 0x80000400, LENGTH = 0x001FFC00
47  m_qacode              (RX)  : ORIGIN = 0x00000000, LENGTH = 0x00020000
48  m_data                (RW)  : ORIGIN = 0x20200000, LENGTH = DEFINED(__heap_noncacheable__) ? 0x000C0000 : 0x000C0000 - HEAP_SIZE
49  m_data2               (RW)  : ORIGIN = 0x20000000, LENGTH = 0x00020000
50  m_data3               (RW)  : ORIGIN = 0x80200000, LENGTH = 0x01C00000
51  m_ncache              (RW)  : ORIGIN = 0x81E00000, LENGTH = DEFINED(__heap_noncacheable__) ? 0x00200000 - HEAP_SIZE : 0x00200000
52  m_heap                (RW)  : ORIGIN = NCACHE_HEAP_START, LENGTH = HEAP_SIZE
53}
54
55/* Define output sections */
56SECTIONS
57{
58  __NCACHE_REGION_START = ORIGIN(m_ncache);
59  __NCACHE_REGION_SIZE  = LENGTH(m_ncache) + NCACHE_HEAP_SIZE;
60
61  /* The startup code goes first into internal RAM */
62  .interrupts :
63  {
64    __VECTOR_TABLE = .;
65    __Vectors = .;
66    . = ALIGN(4);
67    KEEP(*(.isr_vector))     /* Startup code */
68    . = ALIGN(4);
69  } > m_interrupts
70
71  /* The program code and other data goes into internal RAM */
72  .text :
73  {
74    . = ALIGN(4);
75    *(.text)                 /* .text sections (code) */
76    *(.text*)                /* .text* sections (code) */
77    *(.rodata)               /* .rodata sections (constants, strings, etc.) */
78    *(.rodata*)              /* .rodata* sections (constants, strings, etc.) */
79    *(.glue_7)               /* glue arm to thumb code */
80    *(.glue_7t)              /* glue thumb to arm code */
81    *(.eh_frame)
82    KEEP (*(.init))
83    KEEP (*(.fini))
84    . = ALIGN(4);
85  } > m_text
86
87  .ARM.extab :
88  {
89    *(.ARM.extab* .gnu.linkonce.armextab.*)
90  } > m_text
91
92  .ARM :
93  {
94    __exidx_start = .;
95    *(.ARM.exidx*)
96    __exidx_end = .;
97  } > m_text
98
99 .ctors :
100  {
101    __CTOR_LIST__ = .;
102    /* gcc uses crtbegin.o to find the start of
103       the constructors, so we make sure it is
104       first.  Because this is a wildcard, it
105       doesn't matter if the user does not
106       actually link against crtbegin.o; the
107       linker won't look for a file to match a
108       wildcard.  The wildcard also means that it
109       doesn't matter which directory crtbegin.o
110       is in.  */
111    KEEP (*crtbegin.o(.ctors))
112    KEEP (*crtbegin?.o(.ctors))
113    /* We don't want to include the .ctor section from
114       from the crtend.o file until after the sorted ctors.
115       The .ctor section from the crtend file contains the
116       end of ctors marker and it must be last */
117    KEEP (*(EXCLUDE_FILE(*crtend?.o *crtend.o) .ctors))
118    KEEP (*(SORT(.ctors.*)))
119    KEEP (*(.ctors))
120    __CTOR_END__ = .;
121  } > m_text
122
123  .dtors :
124  {
125    __DTOR_LIST__ = .;
126    KEEP (*crtbegin.o(.dtors))
127    KEEP (*crtbegin?.o(.dtors))
128    KEEP (*(EXCLUDE_FILE(*crtend?.o *crtend.o) .dtors))
129    KEEP (*(SORT(.dtors.*)))
130    KEEP (*(.dtors))
131    __DTOR_END__ = .;
132  } > m_text
133
134  .preinit_array :
135  {
136    PROVIDE_HIDDEN (__preinit_array_start = .);
137    KEEP (*(.preinit_array*))
138    PROVIDE_HIDDEN (__preinit_array_end = .);
139  } > m_text
140
141  .init_array :
142  {
143    PROVIDE_HIDDEN (__init_array_start = .);
144    KEEP (*(SORT(.init_array.*)))
145    KEEP (*(.init_array*))
146    PROVIDE_HIDDEN (__init_array_end = .);
147  } > m_text
148
149  .fini_array :
150  {
151    PROVIDE_HIDDEN (__fini_array_start = .);
152    KEEP (*(SORT(.fini_array.*)))
153    KEEP (*(.fini_array*))
154    PROVIDE_HIDDEN (__fini_array_end = .);
155  } > m_text
156
157  __etext = .;    /* define a global symbol at end of code */
158  __DATA_ROM = .; /* Symbol is used by startup for data initialization */
159
160  __VECTOR_RAM = ORIGIN(m_interrupts);
161  __RAM_VECTOR_TABLE_SIZE_BYTES = 0x0;
162
163  .data : AT(__DATA_ROM)
164  {
165    . = ALIGN(4);
166    __DATA_RAM = .;
167    __data_start__ = .;      /* create a global symbol at data start */
168    *(m_usb_dma_init_data)
169    *(.data)                 /* .data sections */
170    *(.data*)                /* .data* sections */
171    KEEP(*(.jcr*))
172    . = ALIGN(4);
173    __data_end__ = .;        /* define a global symbol at data end */
174  } > m_data
175
176  __ram_function_flash_start = __DATA_ROM + (__data_end__ - __data_start__); /* Symbol is used by startup for TCM data initialization */
177
178  .ram_function : AT(__ram_function_flash_start)
179  {
180    . = ALIGN(32);
181    __ram_function_start__ = .;
182    *(CodeQuickAccess)
183    . = ALIGN(128);
184    __ram_function_end__ = .;
185  } > m_qacode
186
187  __NDATA_ROM = __ram_function_flash_start + (__ram_function_end__ - __ram_function_start__);
188  .ncache.init : AT(__NDATA_ROM)
189  {
190    __noncachedata_start__ = .;   /* create a global symbol at ncache data start */
191    *(NonCacheable.init)
192    . = ALIGN(4);
193    __noncachedata_init_end__ = .;   /* create a global symbol at initialized ncache data end */
194  } > m_ncache
195  . = __noncachedata_init_end__;
196  .ncache :
197  {
198    *(NonCacheable)
199    . = ALIGN(4);
200    __noncachedata_end__ = .;     /* define a global symbol at ncache data end */
201  } > m_ncache
202
203  __DATA_END = __NDATA_ROM + (__noncachedata_init_end__ - __noncachedata_start__);
204  text_end = ORIGIN(m_text) + LENGTH(m_text);
205  ASSERT(__DATA_END <= text_end, "region m_text overflowed with text and data")
206
207  .qadata :
208  {
209    . = ALIGN(4);
210    *(DataQuickAccess)       /* quick access data section */
211    . = ALIGN(4);
212  } > m_data2
213
214  /* Uninitialized data section */
215  .bss :
216  {
217    /* This is used by the startup in order to initialize the .bss section */
218    . = ALIGN(4);
219    __START_BSS = .;
220    __bss_start__ = .;
221    *(m_usb_dma_noninit_data)
222    *(.bss)
223    *(.bss*)
224    *(COMMON)
225    . = ALIGN(4);
226    __bss_end__ = .;
227    __END_BSS = .;
228  } > m_data
229
230  .heap :
231  {
232    . = ALIGN(8);
233    __end__ = .;
234    PROVIDE(end = .);
235    __HeapBase = .;
236    . += HEAP_SIZE;
237    __HeapLimit = .;
238    __heap_limit = .; /* Add for _sbrk */
239  } > m_heap
240
241  .stack :
242  {
243    . = ALIGN(8);
244    . += STACK_SIZE;
245  } > m_data
246
247  /* Initializes stack on the end of block */
248  __StackTop   = ORIGIN(m_data) + LENGTH(m_data);
249  __StackLimit = __StackTop - STACK_SIZE;
250  PROVIDE(__stack = __StackTop);
251
252  .ARM.attributes 0 : { *(.ARM.attributes) }
253}
254