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