1/*
2** ###################################################################
3**     Processors:          MIMXRT1064CVJ5A
4**                          MIMXRT1064CVL5A
5**                          MIMXRT1064DVJ6A
6**                          MIMXRT1064DVL6A
7**
8**     Compiler:            GNU C Compiler
9**     Reference manual:    IMXRT1064RM Rev.0.1, 12/2018 | IMXRT1064SRM Rev.3
10**     Version:             rev. 0.1, 2018-06-22
11**     Build:               b210709
12**
13**     Abstract:
14**         Linker file for the GNU C Compiler
15**
16**     Copyright 2016 Freescale Semiconductor, Inc.
17**     Copyright 2016-2021 NXP
18**     All rights reserved.
19**
20**     SPDX-License-Identifier: BSD-3-Clause
21**
22**     http:                 www.nxp.com
23**     mail:                 support@nxp.com
24**
25** ###################################################################
26*/
27
28/* Entry Point */
29ENTRY(Reset_Handler)
30
31HEAP_SIZE  = DEFINED(__heap_size__)  ? __heap_size__  : 0x0400;
32STACK_SIZE = DEFINED(__stack_size__) ? __stack_size__ : 0x0400;
33NCACHE_HEAP_START = DEFINED(__heap_noncacheable__) ? 0x82000000 - HEAP_SIZE : 0x202C0000 - HEAP_SIZE;
34NCACHE_HEAP_SIZE  = DEFINED(__heap_noncacheable__) ? HEAP_SIZE : 0x0000;
35
36/* Specify the memory areas */
37MEMORY
38{
39  m_interrupts          (RX)  : ORIGIN = 0x80000000, LENGTH = 0x00000400
40  m_text                (RX)  : ORIGIN = 0x80000400, LENGTH = 0x001FFC00
41  m_qacode              (RX)  : ORIGIN = 0x00000000, LENGTH = 0x00020000
42  m_data                (RW)  : ORIGIN = 0x20200000, LENGTH = DEFINED(__heap_noncacheable__) ? 0x000C0000 : 0x000C0000 - HEAP_SIZE
43  m_data2               (RW)  : ORIGIN = 0x20000000, LENGTH = 0x00020000
44  m_data3               (RW)  : ORIGIN = 0x80200000, LENGTH = 0x01C00000
45  m_ncache              (RW)  : ORIGIN = 0x81E00000, LENGTH = DEFINED(__heap_noncacheable__) ? 0x00200000 - HEAP_SIZE : 0x00200000
46  m_heap                (RW)  : ORIGIN = NCACHE_HEAP_START, LENGTH = HEAP_SIZE
47}
48
49/* Define output sections */
50SECTIONS
51{
52  __NCACHE_REGION_START = ORIGIN(m_ncache);
53  __NCACHE_REGION_SIZE  = LENGTH(m_ncache) + NCACHE_HEAP_SIZE;
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    *(.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    KEEP(*(.jcr*))
166    . = ALIGN(4);
167    __data_end__ = .;        /* define a global symbol at data end */
168  } > m_data
169
170  __ram_function_flash_start = __DATA_ROM + (__data_end__ - __data_start__); /* Symbol is used by startup for TCM data initialization */
171
172  .ram_function : AT(__ram_function_flash_start)
173  {
174    . = ALIGN(32);
175    __ram_function_start__ = .;
176    *(CodeQuickAccess)
177    . = ALIGN(128);
178    __ram_function_end__ = .;
179  } > m_qacode
180
181  __NDATA_ROM = __ram_function_flash_start + (__ram_function_end__ - __ram_function_start__);
182  .ncache.init : AT(__NDATA_ROM)
183  {
184    __noncachedata_start__ = .;   /* create a global symbol at ncache data start */
185    *(NonCacheable.init)
186    . = ALIGN(4);
187    __noncachedata_init_end__ = .;   /* create a global symbol at initialized ncache data end */
188  } > m_ncache
189  . = __noncachedata_init_end__;
190  .ncache :
191  {
192    *(NonCacheable)
193    . = ALIGN(4);
194    __noncachedata_end__ = .;     /* define a global symbol at ncache data end */
195  } > m_ncache
196
197  __DATA_END = __NDATA_ROM + (__noncachedata_init_end__ - __noncachedata_start__);
198  text_end = ORIGIN(m_text) + LENGTH(m_text);
199  ASSERT(__DATA_END <= text_end, "region m_text overflowed with text and data")
200
201  .qadata :
202  {
203    . = ALIGN(4);
204    *(DataQuickAccess)       /* quick access data section */
205    . = ALIGN(4);
206  } > m_data2
207
208  /* Uninitialized data section */
209  .bss :
210  {
211    /* This is used by the startup in order to initialize the .bss section */
212    . = ALIGN(4);
213    __START_BSS = .;
214    __bss_start__ = .;
215    *(m_usb_dma_noninit_data)
216    *(.bss)
217    *(.bss*)
218    *(COMMON)
219    . = ALIGN(4);
220    __bss_end__ = .;
221    __END_BSS = .;
222  } > m_data
223
224  .heap :
225  {
226    . = ALIGN(8);
227    __end__ = .;
228    PROVIDE(end = .);
229    __HeapBase = .;
230    . += HEAP_SIZE;
231    __HeapLimit = .;
232    __heap_limit = .; /* Add for _sbrk */
233  } > m_heap
234
235  .stack :
236  {
237    . = ALIGN(8);
238    . += STACK_SIZE;
239  } > m_data
240
241  /* Initializes stack on the end of block */
242  __StackTop   = ORIGIN(m_data) + LENGTH(m_data);
243  __StackLimit = __StackTop - STACK_SIZE;
244  PROVIDE(__stack = __StackTop);
245
246  .ARM.attributes 0 : { *(.ARM.attributes) }
247}
248