1/*
2** ###################################################################
3**     Processors:          MK28FN2M0ACAU15R
4**                          MK28FN2M0AVMI15
5**
6**     Compiler:            GNU C Compiler
7**     Reference manual:    K28P210M150SF5RM, Rev. 4, Aug 2017
8**     Version:             rev. 1.3, 2018-01-09
9**     Build:               b190916
10**
11**     Abstract:
12**         Linker file for the GNU C Compiler
13**
14**     Copyright 2016 Freescale Semiconductor, Inc.
15**     Copyright 2016-2019 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;
31
32/* Specify the memory areas */
33MEMORY
34{
35  m_interrupts          (RX)  : ORIGIN = 0x00000000, LENGTH = 0x000003C0
36  m_bootloader_config   (RX)  : ORIGIN = 0x000003C0, LENGTH = 0x00000040
37  m_flash_config        (RX)  : ORIGIN = 0x00000400, LENGTH = 0x00000010
38  m_text                (RX)  : ORIGIN = 0x00000410, LENGTH = 0x001FFBF0
39  m_data                (RW)  : ORIGIN = 0x1FFC0000, LENGTH = 0x00040000
40  m_data_2              (RW)  : ORIGIN = 0x20000000, LENGTH = 0x00040000
41  m_data_3              (RW)  : ORIGIN = 0x34000000, LENGTH = 0x00080000
42}
43
44/* Define output sections */
45SECTIONS
46{
47  /* The startup code goes first into internal flash */
48  .interrupts :
49  {
50    . = ALIGN(4);
51    KEEP(*(.isr_vector))     /* Startup code */
52    . = ALIGN(4);
53  } > m_interrupts
54
55  .bootloader_config :
56  {
57    . = ALIGN(4);
58    KEEP(*(.BootloaderConfig)) /* Bootloader Configuration Area (BCA) */
59    . = ALIGN(4);
60  } > m_bootloader_config
61
62  .flash_config :
63  {
64    . = ALIGN(4);
65    KEEP(*(.FlashConfig))    /* Flash Configuration Field (FCF) */
66    . = ALIGN(4);
67  } > m_flash_config
68
69  /* The program code and other data goes into internal flash */
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
84
85  .ARM.extab :
86  {
87    *(.ARM.extab* .gnu.linkonce.armextab.*)
88  } > m_text
89
90  .ARM :
91  {
92    __exidx_start = .;
93    *(.ARM.exidx*)
94    __exidx_end = .;
95  } > m_text
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
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
131
132  .preinit_array :
133  {
134    PROVIDE_HIDDEN (__preinit_array_start = .);
135    KEEP (*(.preinit_array*))
136    PROVIDE_HIDDEN (__preinit_array_end = .);
137  } > m_text
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
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
154
155  __etext = .;    /* define a global symbol at end of code */
156  __DATA_ROM = .; /* Symbol is used by startup for data initialization */
157
158  .data : AT(__DATA_ROM)
159  {
160    . = ALIGN(4);
161    __DATA_RAM = .;
162    __data_start__ = .;      /* create a global symbol at data start */
163    *(.data)                 /* .data sections */
164    *(.data*)                /* .data* sections */
165    KEEP(*(.jcr*))
166    . = ALIGN(4);
167    __data_end__ = .;        /* define a global symbol at data end */
168  } > m_data
169
170  __NDATA_ROM = __DATA_ROM + (__data_end__ - __data_start__);
171  .ncache.init : AT(__NDATA_ROM)
172  {
173    __noncachedata_start__ = .;   /* create a global symbol at ncache data start */
174    *(NonCacheable.init)
175    . = ALIGN(4);
176    __noncachedata_init_end__ = .;   /* create a global symbol at initialized ncache data end */
177  } > m_data
178
179  . = __noncachedata_init_end__;
180  .ncache :
181  {
182    *(NonCacheable)
183    . = ALIGN(4);
184    __noncachedata_end__ = .;     /* define a global symbol at ncache data end */
185  } > m_data
186
187  __DATA_END = __NDATA_ROM + (__noncachedata_init_end__ - __noncachedata_start__);
188  text_end = ORIGIN(m_text) + LENGTH(m_text);
189  ASSERT(__DATA_END <= text_end, "region m_text overflowed with text and data")
190
191  /* Uninitialized data section */
192  .bss :
193  {
194    /* This is used by the startup in order to initialize the .bss section */
195    . = ALIGN(4);
196    __START_BSS = .;
197    __bss_start__ = .;
198    *(.bss)
199    *(.bss*)
200    *(COMMON)
201    . = ALIGN(4);
202    __bss_end__ = .;
203    __END_BSS = .;
204  } > m_data
205
206  .heap :
207  {
208    . = ALIGN(8);
209    __end__ = .;
210    PROVIDE(end = .);
211    __HeapBase = .;
212    . += HEAP_SIZE;
213    __HeapLimit = .;
214    __heap_limit = .; /* Add for _sbrk */
215  } > m_data_2
216
217  .stack :
218  {
219    . = ALIGN(8);
220    . += STACK_SIZE;
221  } > m_data_2
222
223  /* Initializes stack on the end of block */
224  __StackTop   = ORIGIN(m_data_2) + LENGTH(m_data_2);
225  __StackLimit = __StackTop - STACK_SIZE;
226  PROVIDE(__stack = __StackTop);
227
228  .ARM.attributes 0 : { *(.ARM.attributes) }
229
230  ASSERT(__StackLimit >= __HeapLimit, "region m_data_2 overflowed with stack and heap")
231}
232
233