1/*
2** ###################################################################
3**     Processors:          MCIMX7U3CVP06
4**                          MCIMX7U3DVK07
5**
6**     Compiler:            GNU C Compiler
7**     Reference manual:    IMX7ULPRM, Rev. 0, Nov. 2018
8**     Version:             rev. 7.0, 2018-11-05
9**     Build:               b200331
10**
11**     Abstract:
12**         Linker file for the GNU C Compiler
13**
14**     Copyright 2016 Freescale Semiconductor, Inc.
15**     Copyright 2016-2020 NXP
16**     All rights reserved.
17**
18**     SPDX-License-Identifier: BSD-3-Clause
19**
20**     http:                 www.nxp.com
21**     mail:                 support@nxp.com
22**
23** ###################################################################
24*/
25
26/* Entry Point */
27ENTRY(Reset_Handler)
28
29HEAP_SIZE  = DEFINED(__heap_size__)  ? __heap_size__  : 0x0400;
30STACK_SIZE = DEFINED(__stack_size__) ? __stack_size__ : 0x0400;
31M_VECTOR_RAM_SIZE = DEFINED(__ram_vector_table__) ? 0x0240 : 0x0;
32
33/* Memory region from [0x1FFD0000-0x1FFD1FFF] is reserved for ROM header */
34
35/* Specify the memory areas */
36MEMORY
37{
38  m_interrupts          (RX)  : ORIGIN = 0x1FFD2000, LENGTH = 0x00000240
39  m_text                (RX)  : ORIGIN = 0x1FFD2240, LENGTH = 0x00025DC0
40  m_data                (RW)  : ORIGIN = 0x20000000, LENGTH = 0x00010000
41  m_m4_suspend_ram      (RW)  : ORIGIN = 0x1FFF8000, LENGTH = 0x00004000
42  m_a7_suspend_ram      (RW)  : ORIGIN = 0x1FFFC000, LENGTH = 0x00004000
43}
44
45/* Define output sections */
46SECTIONS
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  .resource_table :
59  {
60    . = ALIGN(8);
61    KEEP(*(.resource_table)) /* Resource table */
62    . = ALIGN(8);
63  } > m_text
64
65  /* The program code and other data goes into internal RAM */
66  .text :
67  {
68    . = ALIGN(4);
69    *(.text)                 /* .text sections (code) */
70    *(.text*)                /* .text* sections (code) */
71    *(.rodata)               /* .rodata sections (constants, strings, etc.) */
72    *(.rodata*)              /* .rodata* sections (constants, strings, etc.) */
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  .interrupts_ram :
155  {
156    . = ALIGN(4);
157    __VECTOR_RAM__ = .;
158    __interrupts_ram_start__ = .; /* Create a global symbol at data start */
159    *(.m_interrupts_ram)     /* This is a user defined section */
160    . += M_VECTOR_RAM_SIZE;
161    . = ALIGN(4);
162    __interrupts_ram_end__ = .; /* Define a global symbol at data end */
163  } > m_data
164
165  __VECTOR_RAM = DEFINED(__ram_vector_table__) ? __VECTOR_RAM__ : ORIGIN(m_interrupts);
166  __RAM_VECTOR_TABLE_SIZE_BYTES = DEFINED(__ram_vector_table__) ? (__interrupts_ram_end__ - __interrupts_ram_start__) : 0x0;
167
168  .data : AT(__DATA_ROM)
169  {
170    . = ALIGN(4);
171    __DATA_RAM = .;
172    __data_start__ = .;      /* create a global symbol at data start */
173    *(.data)                 /* .data sections */
174    *(.data*)                /* .data* sections */
175    KEEP(*(.jcr*))
176    . = ALIGN(4);
177    __data_end__ = .;        /* define a global symbol at data end */
178  } > m_data
179
180  __DATA_END = __DATA_ROM + (__data_end__ - __data_start__);
181  text_end = ORIGIN(m_text) + LENGTH(m_text);
182  ASSERT(__DATA_END <= text_end, "region m_text overflowed with text and data")
183
184  /* Uninitialized data section */
185  .bss :
186  {
187    /* This is used by the startup in order to initialize the .bss section */
188    . = ALIGN(4);
189    __START_BSS = .;
190    __bss_start__ = .;
191    *(.bss)
192    *(.bss*)
193    *(COMMON)
194    . = ALIGN(4);
195    __bss_end__ = .;
196    __END_BSS = .;
197  } > m_data
198
199  .m4_suspend :
200  {
201    *(M4SuspendRam)
202    . = ALIGN(4);
203  } > m_m4_suspend_ram
204
205  .heap :
206  {
207    . = ALIGN(8);
208    __end__ = .;
209    PROVIDE(end = .);
210    __HeapBase = .;
211    . += HEAP_SIZE;
212    __HeapLimit = .;
213    __heap_limit = .; /* Add for _sbrk */
214  } > m_data
215
216  .stack :
217  {
218    . = ALIGN(8);
219    . += STACK_SIZE;
220  } > m_data
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