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;
39
40/* Specify the memory areas */
41MEMORY
42{
43  m_interrupts          (RX)  : ORIGIN = 0x00000000, LENGTH = 0x00000400
44  m_text                (RX)  : ORIGIN = 0x00000400, LENGTH = 0x0001FC00
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  /* The startup code goes first into internal RAM */
56  .interrupts :
57  {
58    __VECTOR_TABLE = .;
59    __Vectors = .;
60    . = ALIGN(4);
61    KEEP(*(.isr_vector))     /* Startup code */
62    . = ALIGN(4);
63  } > m_interrupts
64
65  /* The program code and other data goes into internal RAM */
66  .text :
67  {
68    . = ALIGN(4);
69    *(.text)                 /* .text sections (code) */
70    *(.text*)                /* .text* sections (code) */
71    *(.rodata)               /* .rodata sections (constants, strings, etc.) */
72    *(.rodata*)              /* .rodata* sections (constants, strings, etc.) */
73    *(CodeQuickAccess)       /* quick access code section */
74    *(.glue_7)               /* glue arm to thumb code */
75    *(.glue_7t)              /* glue thumb to arm code */
76    *(.eh_frame)
77    KEEP (*(.init))
78    KEEP (*(.fini))
79    . = ALIGN(4);
80  } > m_text
81
82  .ARM.extab :
83  {
84    *(.ARM.extab* .gnu.linkonce.armextab.*)
85  } > m_text
86
87  .ARM :
88  {
89    __exidx_start = .;
90    *(.ARM.exidx*)
91    __exidx_end = .;
92  } > m_text
93
94 .ctors :
95  {
96    __CTOR_LIST__ = .;
97    /* gcc uses crtbegin.o to find the start of
98       the constructors, so we make sure it is
99       first.  Because this is a wildcard, it
100       doesn't matter if the user does not
101       actually link against crtbegin.o; the
102       linker won't look for a file to match a
103       wildcard.  The wildcard also means that it
104       doesn't matter which directory crtbegin.o
105       is in.  */
106    KEEP (*crtbegin.o(.ctors))
107    KEEP (*crtbegin?.o(.ctors))
108    /* We don't want to include the .ctor section from
109       from the crtend.o file until after the sorted ctors.
110       The .ctor section from the crtend file contains the
111       end of ctors marker and it must be last */
112    KEEP (*(EXCLUDE_FILE(*crtend?.o *crtend.o) .ctors))
113    KEEP (*(SORT(.ctors.*)))
114    KEEP (*(.ctors))
115    __CTOR_END__ = .;
116  } > m_text
117
118  .dtors :
119  {
120    __DTOR_LIST__ = .;
121    KEEP (*crtbegin.o(.dtors))
122    KEEP (*crtbegin?.o(.dtors))
123    KEEP (*(EXCLUDE_FILE(*crtend?.o *crtend.o) .dtors))
124    KEEP (*(SORT(.dtors.*)))
125    KEEP (*(.dtors))
126    __DTOR_END__ = .;
127  } > m_text
128
129  .preinit_array :
130  {
131    PROVIDE_HIDDEN (__preinit_array_start = .);
132    KEEP (*(.preinit_array*))
133    PROVIDE_HIDDEN (__preinit_array_end = .);
134  } > m_text
135
136  .init_array :
137  {
138    PROVIDE_HIDDEN (__init_array_start = .);
139    KEEP (*(SORT(.init_array.*)))
140    KEEP (*(.init_array*))
141    PROVIDE_HIDDEN (__init_array_end = .);
142  } > m_text
143
144  .fini_array :
145  {
146    PROVIDE_HIDDEN (__fini_array_start = .);
147    KEEP (*(SORT(.fini_array.*)))
148    KEEP (*(.fini_array*))
149    PROVIDE_HIDDEN (__fini_array_end = .);
150  } > m_text
151
152  __etext = .;    /* define a global symbol at end of code */
153  __DATA_ROM = .; /* Symbol is used by startup for data initialization */
154
155  __VECTOR_RAM = ORIGIN(m_interrupts);
156  __RAM_VECTOR_TABLE_SIZE_BYTES = 0x0;
157
158  .data : AT(__DATA_ROM)
159  {
160    . = ALIGN(4);
161    __DATA_RAM = .;
162    __data_start__ = .;      /* create a global symbol at data start */
163    *(m_usb_dma_init_data)
164    *(.data)                 /* .data sections */
165    *(.data*)                /* .data* sections */
166    *(DataQuickAccess)       /* quick access data section */
167    KEEP(*(.jcr*))
168    . = ALIGN(4);
169    __data_end__ = .;        /* define a global symbol at data end */
170  } > m_data
171
172  __NDATA_ROM = __DATA_ROM + (__data_end__ - __data_start__);
173  .ncache.init : AT(__NDATA_ROM)
174  {
175    __noncachedata_start__ = .;   /* create a global symbol at ncache data start */
176    *(NonCacheable.init)
177    . = ALIGN(4);
178    __noncachedata_init_end__ = .;   /* create a global symbol at initialized ncache data end */
179  } > m_data
180  . = __noncachedata_init_end__;
181  .ncache :
182  {
183    *(NonCacheable)
184    . = ALIGN(4);
185    __noncachedata_end__ = .;     /* define a global symbol at ncache data end */
186  } > m_data
187
188  __DATA_END = __NDATA_ROM + (__noncachedata_init_end__ - __noncachedata_start__);
189  text_end = ORIGIN(m_text) + LENGTH(m_text);
190  ASSERT(__DATA_END <= text_end, "region m_text overflowed with text and data")
191
192  /* Uninitialized data section */
193  .bss :
194  {
195    /* This is used by the startup in order to initialize the .bss section */
196    . = ALIGN(4);
197    __START_BSS = .;
198    __bss_start__ = .;
199    *(m_usb_dma_noninit_data)
200    *(.bss)
201    *(.bss*)
202    *(COMMON)
203    . = ALIGN(4);
204    __bss_end__ = .;
205    __END_BSS = .;
206  } > m_data
207
208  .heap :
209  {
210    . = ALIGN(8);
211    __end__ = .;
212    PROVIDE(end = .);
213    __HeapBase = .;
214    . += HEAP_SIZE;
215    __HeapLimit = .;
216    __heap_limit = .; /* Add for _sbrk */
217  } > m_data
218
219  .stack :
220  {
221    . = ALIGN(8);
222    . += STACK_SIZE;
223  } > m_data
224
225  /* Initializes stack on the end of block */
226  __StackTop   = ORIGIN(m_data) + LENGTH(m_data);
227  __StackLimit = __StackTop - STACK_SIZE;
228  PROVIDE(__stack = __StackTop);
229
230  .ARM.attributes 0 : { *(.ARM.attributes) }
231
232  ASSERT(__StackLimit >= __HeapLimit, "region m_data overflowed with stack and heap")
233}
234