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 : 0x81E00000 - HEAP_SIZE;
40NCACHE_HEAP_SIZE  = DEFINED(__heap_noncacheable__) ? HEAP_SIZE : 0x0000;
41
42/* Specify the memory areas */
43MEMORY
44{
45  m_interrupts          (RX)  : ORIGIN = 0x00000000, LENGTH = 0x00000400
46  m_text                (RX)  : ORIGIN = 0x00000400, LENGTH = 0x0001FC00
47  m_data                (RW)  : ORIGIN = 0x80000000, LENGTH = DEFINED(__heap_noncacheable__) ? 0x01E00000 : 0x01E00000 - HEAP_SIZE
48  m_ncache              (RW)  : ORIGIN = 0x81E00000, LENGTH = DEFINED(__heap_noncacheable__) ? 0x00200000 - HEAP_SIZE : 0x00200000
49  m_data2               (RW)  : ORIGIN = 0x20000000, LENGTH = 0x00020000
50  m_data3               (RW)  : ORIGIN = 0x20200000, LENGTH = 0x000C0000
51  m_heap                (RW)  : ORIGIN = NCACHE_HEAP_START, LENGTH = HEAP_SIZE
52}
53
54/* Define output sections */
55SECTIONS
56{
57  __NCACHE_REGION_START = ORIGIN(m_ncache);
58  __NCACHE_REGION_SIZE  = LENGTH(m_ncache) + NCACHE_HEAP_SIZE;
59
60  /* The startup code goes first into internal RAM */
61  .interrupts :
62  {
63    __VECTOR_TABLE = .;
64    __Vectors = .;
65    . = ALIGN(4);
66    KEEP(*(.isr_vector))     /* Startup code */
67    . = ALIGN(4);
68  } > m_interrupts
69
70  /* The program code and other data goes into internal RAM */
71  .text :
72  {
73    . = ALIGN(4);
74    *(.text)                 /* .text sections (code) */
75    *(.text*)                /* .text* sections (code) */
76    *(.rodata)               /* .rodata sections (constants, strings, etc.) */
77    *(.rodata*)              /* .rodata* sections (constants, strings, etc.) */
78    *(CodeQuickAccess)       /* quick access code section */
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  __NDATA_ROM = __DATA_ROM + (__data_end__ - __data_start__);
177  .ncache.init : AT(__NDATA_ROM)
178  {
179    __noncachedata_start__ = .;   /* create a global symbol at ncache data start */
180    *(NonCacheable.init)
181    . = ALIGN(4);
182    __noncachedata_init_end__ = .;   /* create a global symbol at initialized ncache data end */
183  } > m_ncache
184  . = __noncachedata_init_end__;
185  .ncache :
186  {
187    *(NonCacheable)
188    . = ALIGN(4);
189    __noncachedata_end__ = .;     /* define a global symbol at ncache data end */
190  } > m_ncache
191
192  __DATA_END = __NDATA_ROM + (__noncachedata_init_end__ - __noncachedata_start__);
193  text_end = ORIGIN(m_text) + LENGTH(m_text);
194  ASSERT(__DATA_END <= text_end, "region m_text overflowed with text and data")
195
196  .qadata :
197  {
198    . = ALIGN(4);
199    *(DataQuickAccess)       /* quick access data section */
200    . = ALIGN(4);
201  } > m_data2
202
203  /* Uninitialized data section */
204  .bss :
205  {
206    /* This is used by the startup in order to initialize the .bss section */
207    . = ALIGN(4);
208    __START_BSS = .;
209    __bss_start__ = .;
210    *(m_usb_dma_noninit_data)
211    *(.bss)
212    *(.bss*)
213    *(COMMON)
214    . = ALIGN(4);
215    __bss_end__ = .;
216    __END_BSS = .;
217  } > m_data
218
219  .heap :
220  {
221    . = ALIGN(8);
222    __end__ = .;
223    PROVIDE(end = .);
224    __HeapBase = .;
225    . += HEAP_SIZE;
226    __HeapLimit = .;
227    __heap_limit = .; /* Add for _sbrk */
228  } > m_heap
229
230  .stack :
231  {
232    . = ALIGN(8);
233    . += STACK_SIZE;
234  } > m_data
235
236  /* Initializes stack on the end of block */
237  __StackTop   = ORIGIN(m_data) + LENGTH(m_data);
238  __StackLimit = __StackTop - STACK_SIZE;
239  PROVIDE(__stack = __StackTop);
240
241  .ARM.attributes 0 : { *(.ARM.attributes) }
242}
243