1/*
2** ###################################################################
3**     Processors:          MIMXRT633SFAWBR_cm33
4**                          MIMXRT633SFFOB_cm33
5**                          MIMXRT633SFVKB_cm33
6**
7**     Compiler:            GNU C Compiler
8**     Reference manual:    MIMXRT685 User manual Rev. 0.95 11 November 2019
9**     Version:             rev. 1.0, 2018-06-19
10**     Build:               b210303
11**
12**     Abstract:
13**         Linker file for the GNU C Compiler
14**
15**     Copyright 2016 Freescale Semiconductor, Inc.
16**     Copyright 2016-2021 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
28
29/* Entry Point */
30ENTRY(Reset_Handler)
31
32HEAP_SIZE  = DEFINED(__heap_size__)  ? __heap_size__  : 0x0400;
33STACK_SIZE = DEFINED(__stack_size__) ? __stack_size__ : 0x0400;
34
35/* Specify the memory areas */
36/* The SRAM region [0x10000-0x1BFFF] is reserved for ROM code. */
37/* The SRAM region [0x0-0xFFFF], [0x1C000-0x7FFFF] is reserved for app-specific use cases. */
38MEMORY
39{
40  m_flash               (RX)  : ORIGIN = 0x08000000, LENGTH = 0x00200000
41  m_interrupts          (RX)  : ORIGIN = 0x00080000, LENGTH = 0x00000130
42  m_text                (RX)  : ORIGIN = 0x00080130, LENGTH = 0x000FFED0
43  m_data                (RW)  : ORIGIN = 0x20180000, LENGTH = 0x00080000
44  m_usb_sram            (RW)  : ORIGIN = 0x40140000, LENGTH = 0x00004000
45}
46
47/* Define output sections */
48SECTIONS
49{
50  .flash_config :
51  {
52    FILL(0x00)
53    __FLASH_BASE = .;
54    . = 0x400 ;
55    KEEP(* (.flash_conf))     /* flash config section */
56    . = 0x1000 ;
57  } > m_flash
58
59  /* The startup code goes first into internal ram */
60  .interrupts :
61  {
62    . = ALIGN(4);
63    __VECTOR_TABLE = .;
64    __Vectors = .;
65    KEEP(*(.isr_vector))     /* Startup code */
66    . = ALIGN(4);
67  } > m_interrupts AT> m_flash
68
69  /* The program code and other data goes into internal ram */
70  .text :
71  {
72    . = ALIGN(4);
73    *(.text)                 /* .text sections (code) */
74    *(.text*)                /* .text* sections (code) */
75    *(.rodata)               /* .rodata sections (constants, strings, etc.) */
76    *(.rodata*)              /* .rodata* sections (constants, strings, etc.) */
77    *(.glue_7)               /* glue arm to thumb code */
78    *(.glue_7t)              /* glue thumb to arm code */
79    *(.eh_frame)
80    KEEP (*(.init))
81    KEEP (*(.fini))
82    . = ALIGN(4);
83  } > m_text AT> m_flash
84
85  .ARM.extab :
86  {
87    *(.ARM.extab* .gnu.linkonce.armextab.*)
88  } > m_text AT> m_flash
89
90  .ARM :
91  {
92    __exidx_start = .;
93    *(.ARM.exidx*)
94    __exidx_end = .;
95  } > m_text AT> m_flash
96
97 .ctors :
98  {
99    __CTOR_LIST__ = .;
100    /* gcc uses crtbegin.o to find the start of
101       the constructors, so we make sure it is
102       first.  Because this is a wildcard, it
103       doesn't matter if the user does not
104       actually link against crtbegin.o; the
105       linker won't look for a file to match a
106       wildcard.  The wildcard also means that it
107       doesn't matter which directory crtbegin.o
108       is in.  */
109    KEEP (*crtbegin.o(.ctors))
110    KEEP (*crtbegin?.o(.ctors))
111    /* We don't want to include the .ctor section from
112       from the crtend.o file until after the sorted ctors.
113       The .ctor section from the crtend file contains the
114       end of ctors marker and it must be last */
115    KEEP (*(EXCLUDE_FILE(*crtend?.o *crtend.o) .ctors))
116    KEEP (*(SORT(.ctors.*)))
117    KEEP (*(.ctors))
118    __CTOR_END__ = .;
119  } > m_text AT> m_flash
120
121  .dtors :
122  {
123    __DTOR_LIST__ = .;
124    KEEP (*crtbegin.o(.dtors))
125    KEEP (*crtbegin?.o(.dtors))
126    KEEP (*(EXCLUDE_FILE(*crtend?.o *crtend.o) .dtors))
127    KEEP (*(SORT(.dtors.*)))
128    KEEP (*(.dtors))
129    __DTOR_END__ = .;
130  } > m_text AT> m_flash
131
132  .preinit_array :
133  {
134    PROVIDE_HIDDEN (__preinit_array_start = .);
135    KEEP (*(.preinit_array*))
136    PROVIDE_HIDDEN (__preinit_array_end = .);
137  } > m_text AT> m_flash
138
139  .init_array :
140  {
141    PROVIDE_HIDDEN (__init_array_start = .);
142    KEEP (*(SORT(.init_array.*)))
143    KEEP (*(.init_array*))
144    PROVIDE_HIDDEN (__init_array_end = .);
145  } > m_text AT> m_flash
146
147  .fini_array :
148  {
149    PROVIDE_HIDDEN (__fini_array_start = .);
150    KEEP (*(SORT(.fini_array.*)))
151    KEEP (*(.fini_array*))
152    PROVIDE_HIDDEN (__fini_array_end = .);
153  } > m_text AT> m_flash
154
155  __etext = .;    /* define a global symbol at end of code */
156  __DATA_ROM = .; /* Symbol is used by startup for data initialization */
157
158  __VECTOR_RAM = ORIGIN(m_interrupts);
159  __RAM_VECTOR_TABLE_SIZE_BYTES = 0x0;
160
161  .data :
162  {
163    . = ALIGN(4);
164    __DATA_RAM = .;
165    __data_start__ = .;      /* create a global symbol at data start */
166    *(CodeQuickAccess)       /* CodeQuickAccess sections */
167    *(DataQuickAccess)       /* DataQuickAccess sections */
168    *(.data)                 /* .data sections */
169    *(.data*)                /* .data* sections */
170    KEEP(*(.jcr*))
171    . = ALIGN(4);
172    __data_end__ = .;        /* define a global symbol at data end */
173  } > m_data AT> m_flash
174
175  __DATA_END = __DATA_ROM + (__data_end__ - __data_start__);
176  _image_size = __DATA_END - __VECTOR_TABLE;
177  ASSERT(_image_size <= LENGTH(m_flash), "region m_flash overflowed with text and data")
178
179  /* Uninitialized data section */
180  .bss :
181  {
182    /* This is used by the startup in order to initialize the .bss section */
183    . = ALIGN(4);
184    __START_BSS = .;
185    __bss_start__ = .;
186    *(.bss)
187    *(.bss*)
188    *(COMMON)
189    . = ALIGN(4);
190    __bss_end__ = .;
191    __END_BSS = .;
192  } > m_data
193
194  .heap :
195  {
196    . = ALIGN(8);
197    __end__ = .;
198    PROVIDE(end = .);
199    __HeapBase = .;
200    . += HEAP_SIZE;
201    __HeapLimit = .;
202    __heap_limit = .; /* Add for _sbrk */
203  } > m_data
204
205  .stack :
206  {
207    . = ALIGN(8);
208    . += STACK_SIZE;
209  } > m_data
210
211  m_usb_bdt (NOLOAD) :
212  {
213    . = ALIGN(512);
214    *(m_usb_bdt)
215  } > m_usb_sram
216
217  m_usb_global (NOLOAD) :
218  {
219    *(m_usb_global)
220  } > m_usb_sram
221
222  /* Initializes stack on the end of block */
223  __StackTop   = ORIGIN(m_data) + LENGTH(m_data);
224  __StackLimit = __StackTop - STACK_SIZE;
225  PROVIDE(__stack = __StackTop);
226
227  .ARM.attributes 0 : { *(.ARM.attributes) }
228
229  ASSERT(__StackLimit >= __HeapLimit, "region m_data overflowed with stack and heap")
230}
231
232