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 [0x04000000-0x04001FFF] is reserved for ROM header */
34
35/* Specify the memory areas */
36MEMORY
37{
38  m_interrupts          (RX)  : ORIGIN = 0x04002000, LENGTH = 0x00000240
39  m_text                (RX)  : ORIGIN = 0x04002240, LENGTH = 0x003FDDC0
40  m_data                (RW)  : ORIGIN = 0x1FFD0000, LENGTH = 0x00028000
41  m_data_2              (RW)  : ORIGIN = 0x20000000, LENGTH = 0x00010000
42  m_m4_suspend_ram      (RW)  : ORIGIN = 0x1FFF8000, LENGTH = 0x00004000
43  m_a7_suspend_ram      (RW)  : ORIGIN = 0x1FFFC000, LENGTH = 0x00004000
44}
45
46/* Define output sections */
47SECTIONS
48{
49  /* The startup code goes first into internal flash */
50  .interrupts :
51  {
52    __VECTOR_TABLE = .;
53    __Vectors = .;
54    . = ALIGN(4);
55    KEEP(*(.isr_vector))     /* Startup code */
56    . = ALIGN(4);
57  } > m_interrupts
58
59  .resource_table :
60  {
61    . = ALIGN(8);
62    KEEP(*(.resource_table)) /* Resource table */
63    . = ALIGN(8);
64  } > m_text
65
66  /* The program code and other data goes into internal flash */
67  .text :
68  {
69    . = ALIGN(4);
70    *(.text)                 /* .text sections (code) */
71    *(.text*)                /* .text* sections (code) */
72    *(.rodata)               /* .rodata sections (constants, strings, etc.) */
73    *(.rodata*)              /* .rodata* sections (constants, strings, etc.) */
74    *(.glue_7)               /* glue arm to thumb code */
75    *(.glue_7t)              /* glue thumb to arm code */
76    *(.eh_frame)
77    KEEP (*(.init))
78    KEEP (*(.fini))
79    . = ALIGN(4);
80  } > m_text
81
82  .ARM.extab :
83  {
84    *(.ARM.extab* .gnu.linkonce.armextab.*)
85  } > m_text
86
87  .ARM :
88  {
89    __exidx_start = .;
90    *(.ARM.exidx*)
91    __exidx_end = .;
92  } > m_text
93
94 .ctors :
95  {
96    __CTOR_LIST__ = .;
97    /* gcc uses crtbegin.o to find the start of
98       the constructors, so we make sure it is
99       first.  Because this is a wildcard, it
100       doesn't matter if the user does not
101       actually link against crtbegin.o; the
102       linker won't look for a file to match a
103       wildcard.  The wildcard also means that it
104       doesn't matter which directory crtbegin.o
105       is in.  */
106    KEEP (*crtbegin.o(.ctors))
107    KEEP (*crtbegin?.o(.ctors))
108    /* We don't want to include the .ctor section from
109       from the crtend.o file until after the sorted ctors.
110       The .ctor section from the crtend file contains the
111       end of ctors marker and it must be last */
112    KEEP (*(EXCLUDE_FILE(*crtend?.o *crtend.o) .ctors))
113    KEEP (*(SORT(.ctors.*)))
114    KEEP (*(.ctors))
115    __CTOR_END__ = .;
116  } > m_text
117
118  .dtors :
119  {
120    __DTOR_LIST__ = .;
121    KEEP (*crtbegin.o(.dtors))
122    KEEP (*crtbegin?.o(.dtors))
123    KEEP (*(EXCLUDE_FILE(*crtend?.o *crtend.o) .dtors))
124    KEEP (*(SORT(.dtors.*)))
125    KEEP (*(.dtors))
126    __DTOR_END__ = .;
127  } > m_text
128
129  .preinit_array :
130  {
131    PROVIDE_HIDDEN (__preinit_array_start = .);
132    KEEP (*(.preinit_array*))
133    PROVIDE_HIDDEN (__preinit_array_end = .);
134  } > m_text
135
136  .init_array :
137  {
138    PROVIDE_HIDDEN (__init_array_start = .);
139    KEEP (*(SORT(.init_array.*)))
140    KEEP (*(.init_array*))
141    PROVIDE_HIDDEN (__init_array_end = .);
142  } > m_text
143
144  .fini_array :
145  {
146    PROVIDE_HIDDEN (__fini_array_start = .);
147    KEEP (*(SORT(.fini_array.*)))
148    KEEP (*(.fini_array*))
149    PROVIDE_HIDDEN (__fini_array_end = .);
150  } > m_text
151
152  __etext = .;    /* define a global symbol at end of code */
153  __DATA_ROM = .; /* Symbol is used by startup for data initialization */
154
155  .interrupts_ram :
156  {
157    . = ALIGN(4);
158    __VECTOR_RAM__ = .;
159    __interrupts_ram_start__ = .; /* Create a global symbol at data start */
160    *(.m_interrupts_ram)     /* This is a user defined section */
161    . += M_VECTOR_RAM_SIZE;
162    . = ALIGN(4);
163    __interrupts_ram_end__ = .; /* Define a global symbol at data end */
164  } > m_data
165
166  __VECTOR_RAM = DEFINED(__ram_vector_table__) ? __VECTOR_RAM__ : ORIGIN(m_interrupts);
167  __RAM_VECTOR_TABLE_SIZE_BYTES = DEFINED(__ram_vector_table__) ? (__interrupts_ram_end__ - __interrupts_ram_start__) : 0x0;
168
169  .data : AT(__DATA_ROM)
170  {
171    __data_start__ = .;      /* create a global symbol at data start */
172    __quickaccess_start__ = .;
173    . = ALIGN(32);
174    *(CodeQuickAccess)
175    *(DataQuickAccess)
176    . = ALIGN(128);
177    __quickaccess_end__ = .;
178    __DATA_RAM = .;
179    *(.data)                 /* .data sections */
180    *(.data*)                /* .data* sections */
181    KEEP(*(.jcr*))
182    . = ALIGN(4);
183    __data_end__ = .;        /* define a global symbol at data end */
184  } > m_data
185
186  __DATA_END = __DATA_ROM + (__data_end__ - __data_start__);
187  text_end = ORIGIN(m_text) + LENGTH(m_text);
188  ASSERT(__DATA_END <= text_end, "region m_text overflowed with text and data")
189
190  /* Uninitialized data section */
191  .bss :
192  {
193    /* This is used by the startup in order to initialize the .bss section */
194    . = ALIGN(4);
195    __START_BSS = .;
196    __bss_start__ = .;
197    *(.bss)
198    *(.bss*)
199    *(COMMON)
200    . = ALIGN(4);
201    __bss_end__ = .;
202    __END_BSS = .;
203  } > m_data
204
205  .m4_suspend :
206  {
207    *(M4SuspendRam)
208    . = ALIGN(4);
209  } > m_m4_suspend_ram
210
211  .heap :
212  {
213    . = ALIGN(8);
214    __end__ = .;
215    PROVIDE(end = .);
216    __HeapBase = .;
217    . += HEAP_SIZE;
218    __HeapLimit = .;
219    __heap_limit = .; /* Add for _sbrk */
220  } > m_data_2
221
222  .stack :
223  {
224    . = ALIGN(8);
225    . += STACK_SIZE;
226  } > m_data_2
227
228  /* Initializes stack on the end of block */
229  __StackTop   = ORIGIN(m_data_2) + LENGTH(m_data_2);
230  __StackLimit = __StackTop - STACK_SIZE;
231  PROVIDE(__stack = __StackTop);
232
233  .ARM.attributes 0 : { *(.ARM.attributes) }
234
235  ASSERT(__StackLimit >= __HeapLimit, "region m_data_2 overflowed with stack and heap")
236}
237
238