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