1/*
2** ###################################################################
3**     Processors:          MIMX8UX5AVLFZ
4**                          MIMX8UX5AVOFZ
5**                          MIMX8UX5CVLDZ
6**
7**     Compiler:            GNU C Compiler
8**     Reference manual:    IMX8DQXPRM, Rev. E, 6/2019
9**     Version:             rev. 4.0, 2020-06-19
10**     Build:               b201113
11**
12**     Abstract:
13**         Linker file for the GNU C Compiler
14**
15**     Copyright 2016 Freescale Semiconductor, Inc.
16**     Copyright 2016-2020 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 = 0x1FFE0000, LENGTH = 0x00000A00
37  m_text                (RX)  : ORIGIN = 0x1FFE0A00, LENGTH = 0x0001F600
38  m_data                (RW)  : ORIGIN = 0x20000000, LENGTH = 0x00020000
39  m_data2               (RW)  : ORIGIN = 0x88000000, LENGTH = 0x08000000
40}
41
42/* Define output sections */
43SECTIONS
44{
45  /* The startup code goes first into internal RAM */
46  .interrupts :
47  {
48    . = ALIGN(8);
49    KEEP(*(.isr_vector))     /* Startup code */
50    . = ALIGN(8);
51  } > m_interrupts
52
53  .resource_table :
54  {
55    . = ALIGN(8);
56    KEEP(*(.resource_table)) /* Resource table */
57    . = ALIGN(8);
58  } > m_text
59
60  /* The program code and other data goes into internal RAM */
61  .text :
62  {
63    . = ALIGN(8);
64    *(.text)                 /* .text sections (code) */
65    *(.text*)                /* .text* sections (code) */
66    *(.rodata)               /* .rodata sections (constants, strings, etc.) */
67    *(.rodata*)              /* .rodata* sections (constants, strings, etc.) */
68    *(.glue_7)               /* glue arm to thumb code */
69    *(.glue_7t)              /* glue thumb to arm code */
70    *(.eh_frame)
71    KEEP (*(.init))
72    KEEP (*(.fini))
73    . = ALIGN(8);
74  } > m_text
75
76  .ARM.extab :
77  {
78    *(.ARM.extab* .gnu.linkonce.armextab.*)
79  } > m_text
80
81  .ARM :
82  {
83    __exidx_start = .;
84    *(.ARM.exidx*)
85    __exidx_end = .;
86  } > m_text
87
88 .ctors :
89  {
90    __CTOR_LIST__ = .;
91    /* gcc uses crtbegin.o to find the start of
92       the constructors, so we make sure it is
93       first.  Because this is a wildcard, it
94       doesn't matter if the user does not
95       actually link against crtbegin.o; the
96       linker won't look for a file to match a
97       wildcard.  The wildcard also means that it
98       doesn't matter which directory crtbegin.o
99       is in.  */
100    KEEP (*crtbegin.o(.ctors))
101    KEEP (*crtbegin?.o(.ctors))
102    /* We don't want to include the .ctor section from
103       from the crtend.o file until after the sorted ctors.
104       The .ctor section from the crtend file contains the
105       end of ctors marker and it must be last */
106    KEEP (*(EXCLUDE_FILE(*crtend?.o *crtend.o) .ctors))
107    KEEP (*(SORT(.ctors.*)))
108    KEEP (*(.ctors))
109    __CTOR_END__ = .;
110  } > m_text
111
112  .dtors :
113  {
114    __DTOR_LIST__ = .;
115    KEEP (*crtbegin.o(.dtors))
116    KEEP (*crtbegin?.o(.dtors))
117    KEEP (*(EXCLUDE_FILE(*crtend?.o *crtend.o) .dtors))
118    KEEP (*(SORT(.dtors.*)))
119    KEEP (*(.dtors))
120    __DTOR_END__ = .;
121  } > m_text
122
123  .preinit_array :
124  {
125    PROVIDE_HIDDEN (__preinit_array_start = .);
126    KEEP (*(.preinit_array*))
127    PROVIDE_HIDDEN (__preinit_array_end = .);
128  } > m_text
129
130  .init_array :
131  {
132    PROVIDE_HIDDEN (__init_array_start = .);
133    KEEP (*(SORT(.init_array.*)))
134    KEEP (*(.init_array*))
135    PROVIDE_HIDDEN (__init_array_end = .);
136  } > m_text
137
138  .fini_array :
139  {
140    PROVIDE_HIDDEN (__fini_array_start = .);
141    KEEP (*(SORT(.fini_array.*)))
142    KEEP (*(.fini_array*))
143    PROVIDE_HIDDEN (__fini_array_end = .);
144  } > m_text
145
146  __etext = .;    /* define a global symbol at end of code */
147  __DATA_ROM = .; /* Symbol is used by startup for data initialization */
148
149  .data : AT(__DATA_ROM)
150  {
151    . = ALIGN(8);
152    __DATA_RAM = .;
153    __data_start__ = .;      /* create a global symbol at data start */
154    *(.data)                 /* .data sections */
155    *(.data*)                /* .data* sections */
156    KEEP(*(.jcr*))
157    . = ALIGN(8);
158    __data_end__ = .;        /* define a global symbol at data end */
159  } > m_data
160
161  __CACHE_REGION_START = ORIGIN(m_interrupts);
162  __CACHE_REGION_SIZE  = 0;
163  __NDATA_ROM = __DATA_ROM + SIZEOF(.data); /* Symbol is used by startup for ncache data initialization */
164
165  .ncache.init : AT(__NDATA_ROM)
166  {
167    __noncachedata_start__ = .;   /* create a global symbol at ncache data start */
168    *(NonCacheable.init)
169    . = ALIGN(4);
170    __noncachedata_init_end__ = .;   /* create a global symbol at initialized ncache data end */
171  } > m_data2
172
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_data2
180
181  __DATA_END = __NDATA_ROM + SIZEOF(.ncache.init);
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(8);
190    __START_BSS = .;
191    __bss_start__ = .;
192    *(.bss)
193    *(.bss*)
194    *(COMMON)
195    . = ALIGN(8);
196    __bss_end__ = .;
197    __END_BSS = .;
198  } > m_data
199
200  .heap :
201  {
202    . = ALIGN(8);
203    __end__ = .;
204    PROVIDE(end = .);
205    __HeapBase = .;
206    . += HEAP_SIZE;
207    __HeapLimit = .;
208    __heap_limit = .; /* Add for _sbrk */
209  } > m_data
210
211  .stack :
212  {
213    . = ALIGN(8);
214    . += STACK_SIZE;
215  } > m_data
216
217  /* Initializes stack on the end of block */
218  __StackTop   = ORIGIN(m_data) + LENGTH(m_data);
219  __StackLimit = __StackTop - STACK_SIZE;
220  PROVIDE(__stack = __StackTop);
221
222  .ARM.attributes 0 : { *(.ARM.attributes) }
223
224  ASSERT(__StackLimit >= __HeapLimit, "region m_data overflowed with stack and heap")
225}
226
227