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