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