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