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