1/*
2** ###################################################################
3**     Processors:          MIMXRT1052CVJ5B
4**                          MIMXRT1052CVL5B
5**                          MIMXRT1052DVJ6B
6**                          MIMXRT1052DVL6B
7**
8**     Compiler:            GNU C Compiler
9**     Reference manual:    IMXRT1050RM Rev.2.1, 12/2018 | IMXRT1050SRM Rev.2
10**     Version:             rev. 1.0, 2018-09-21
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 : 0x81E00000 - HEAP_SIZE;
34NCACHE_HEAP_SIZE  = DEFINED(__heap_noncacheable__) ? HEAP_SIZE : 0x0000;
35
36/* Specify the memory areas */
37MEMORY
38{
39  m_interrupts          (RX)  : ORIGIN = 0x00000000, LENGTH = 0x00000400
40  m_text                (RX)  : ORIGIN = 0x00000400, LENGTH = 0x0001FC00
41  m_data                (RW)  : ORIGIN = 0x80000000, LENGTH = DEFINED(__heap_noncacheable__) ? 0x01E00000 : 0x01E00000 - HEAP_SIZE
42  m_ncache              (RW)  : ORIGIN = 0x81E00000, LENGTH = DEFINED(__heap_noncacheable__) ? 0x00200000 - HEAP_SIZE : 0x00200000
43  m_data2               (RW)  : ORIGIN = 0x20000000, LENGTH = 0x00020000
44  m_data3               (RW)  : ORIGIN = 0x20200000, LENGTH = 0x00040000
45  m_heap                (RW)  : ORIGIN = NCACHE_HEAP_START, LENGTH = HEAP_SIZE
46}
47
48/* Define output sections */
49SECTIONS
50{
51  __NCACHE_REGION_START = ORIGIN(m_ncache);
52  __NCACHE_REGION_SIZE  = LENGTH(m_ncache) + NCACHE_HEAP_SIZE;
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    KEEP(*(.jcr*))
166    . = ALIGN(4);
167    __data_end__ = .;        /* define a global symbol at data end */
168  } > m_data
169
170  __NDATA_ROM = __DATA_ROM + (__data_end__ - __data_start__);
171  .ncache.init : AT(__NDATA_ROM)
172  {
173    __noncachedata_start__ = .;   /* create a global symbol at ncache data start */
174    *(NonCacheable.init)
175    . = ALIGN(4);
176    __noncachedata_init_end__ = .;   /* create a global symbol at initialized ncache data end */
177  } > m_ncache
178  . = __noncachedata_init_end__;
179  .ncache :
180  {
181    *(NonCacheable)
182    . = ALIGN(4);
183    __noncachedata_end__ = .;     /* define a global symbol at ncache data end */
184  } > m_ncache
185
186  __DATA_END = __NDATA_ROM + (__noncachedata_init_end__ - __noncachedata_start__);
187  text_end = ORIGIN(m_text) + LENGTH(m_text);
188  ASSERT(__DATA_END <= text_end, "region m_text overflowed with text and data")
189
190  .qadata :
191  {
192    . = ALIGN(4);
193    *(DataQuickAccess)       /* quick access data section */
194    . = ALIGN(4);
195  } > m_data2
196
197  /* Uninitialized data section */
198  .bss :
199  {
200    /* This is used by the startup in order to initialize the .bss section */
201    . = ALIGN(4);
202    __START_BSS = .;
203    __bss_start__ = .;
204    *(m_usb_dma_noninit_data)
205    *(.bss)
206    *(.bss*)
207    *(COMMON)
208    . = ALIGN(4);
209    __bss_end__ = .;
210    __END_BSS = .;
211  } > m_data
212
213  .heap :
214  {
215    . = ALIGN(8);
216    __end__ = .;
217    PROVIDE(end = .);
218    __HeapBase = .;
219    . += HEAP_SIZE;
220    __HeapLimit = .;
221    __heap_limit = .; /* Add for _sbrk */
222  } > m_heap
223
224  .stack :
225  {
226    . = ALIGN(8);
227    . += STACK_SIZE;
228  } > m_data
229
230  /* Initializes stack on the end of block */
231  __StackTop   = ORIGIN(m_data) + LENGTH(m_data);
232  __StackLimit = __StackTop - STACK_SIZE;
233  PROVIDE(__stack = __StackTop);
234
235  .ARM.attributes 0 : { *(.ARM.attributes) }
236}
237