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