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