1/*
2** ###################################################################
3**     Processors:          LPC55S06JBD64
4**                          LPC55S06JHI48
5**
6**     Compiler:            GNU C Compiler
7**     Reference manual:    LPC55S0x/LPC550x User manual Rev.0.3  14 August 2020
8**     Version:             rev. 1.0, 2020-04-09
9**     Build:               b220622
10**
11**     Abstract:
12**         Linker file for the GNU C Compiler
13**
14**     Copyright 2016 Freescale Semiconductor, Inc.
15**     Copyright 2016-2022 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
27
28/* Entry Point */
29ENTRY(Reset_Handler)
30
31HEAP_SIZE  = DEFINED(__heap_size__)  ? __heap_size__  : 0x0400;
32STACK_SIZE = DEFINED(__stack_size__) ? __stack_size__ : 0x0800;
33
34/* Specify the memory areas */
35MEMORY
36{
37  m_interrupts          (RX)  : ORIGIN = 0x00000000, LENGTH = 0x00000200
38  m_text                (RX)  : ORIGIN = 0x00000200, LENGTH = 0x0003CE00
39  m_data                (RW)  : ORIGIN = 0x20000000, LENGTH = 0x00010000
40  m_sramx               (RW)  : ORIGIN = 0x04000000, LENGTH = 0x00004000
41  m_sram3               (RW)  : ORIGIN = 0x20010000, LENGTH = 0x00004000
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  /* The program code and other data goes into internal flash */
56  .text :
57  {
58    . = ALIGN(4);
59    *(.text)                 /* .text sections (code) */
60    *(.text*)                /* .text* sections (code) */
61    *(.rodata)               /* .rodata sections (constants, strings, etc.) */
62    *(.rodata*)              /* .rodata* sections (constants, strings, etc.) */
63    *(.glue_7)               /* glue arm to thumb code */
64    *(.glue_7t)              /* glue thumb to arm code */
65    *(.eh_frame)
66    KEEP (*(.init))
67    KEEP (*(.fini))
68    . = ALIGN(4);
69  } > m_text
70
71  .rtt_const_tables :
72  {
73     /* section information for finsh shell */
74     . = ALIGN(4);
75     __fsymtab_start = .;
76     KEEP(*(FSymTab))
77     __fsymtab_end = .;
78
79     . = ALIGN(4);
80     __vsymtab_start = .;
81     KEEP(*(VSymTab))
82     __vsymtab_end = .;
83
84    /* section information for initial. */
85    . = ALIGN(4);
86    __rt_init_start = .;
87    KEEP(*(SORT(.rti_fn*)))
88    __rt_init_end = .;
89  } > m_text
90
91  .ARM.extab :
92  {
93    *(.ARM.extab* .gnu.linkonce.armextab.*)
94  } > m_text
95
96  .ARM :
97  {
98    __exidx_start = .;
99    *(.ARM.exidx*)
100    __exidx_end = .;
101  } > m_text
102
103 .ctors :
104  {
105    __CTOR_LIST__ = .;
106    /* gcc uses crtbegin.o to find the start of
107       the constructors, so we make sure it is
108       first.  Because this is a wildcard, it
109       doesn't matter if the user does not
110       actually link against crtbegin.o; the
111       linker won't look for a file to match a
112       wildcard.  The wildcard also means that it
113       doesn't matter which directory crtbegin.o
114       is in.  */
115    KEEP (*crtbegin.o(.ctors))
116    KEEP (*crtbegin?.o(.ctors))
117    /* We don't want to include the .ctor section from
118       from the crtend.o file until after the sorted ctors.
119       The .ctor section from the crtend file contains the
120       end of ctors marker and it must be last */
121    KEEP (*(EXCLUDE_FILE(*crtend?.o *crtend.o) .ctors))
122    KEEP (*(SORT(.ctors.*)))
123    KEEP (*(.ctors))
124    __CTOR_END__ = .;
125  } > m_text
126
127  .dtors :
128  {
129    __DTOR_LIST__ = .;
130    KEEP (*crtbegin.o(.dtors))
131    KEEP (*crtbegin?.o(.dtors))
132    KEEP (*(EXCLUDE_FILE(*crtend?.o *crtend.o) .dtors))
133    KEEP (*(SORT(.dtors.*)))
134    KEEP (*(.dtors))
135    __DTOR_END__ = .;
136  } > m_text
137
138  .preinit_array :
139  {
140    PROVIDE_HIDDEN (__preinit_array_start = .);
141    KEEP (*(.preinit_array*))
142    PROVIDE_HIDDEN (__preinit_array_end = .);
143  } > m_text
144
145  .init_array :
146  {
147    PROVIDE_HIDDEN (__init_array_start = .);
148    KEEP (*(SORT(.init_array.*)))
149    KEEP (*(.init_array*))
150    PROVIDE_HIDDEN (__init_array_end = .);
151  } > m_text
152
153  .fini_array :
154  {
155    PROVIDE_HIDDEN (__fini_array_start = .);
156    KEEP (*(SORT(.fini_array.*)))
157    KEEP (*(.fini_array*))
158    PROVIDE_HIDDEN (__fini_array_end = .);
159  } > m_text
160
161  __etext = .;    /* define a global symbol at end of code */
162  __DATA_ROM = .; /* Symbol is used by startup for data initialization */
163
164  .data : AT(__DATA_ROM)
165  {
166    . = ALIGN(4);
167    __DATA_RAM = .;
168    __data_start__ = .;      /* create a global symbol at data start */
169    *(.ramfunc*)             /* for functions in ram */
170    *(.data)                 /* .data sections */
171    *(.data*)                /* .data* sections */
172    KEEP(*(.jcr*))
173    . = ALIGN(4);
174    __data_end__ = .;        /* define a global symbol at data end */
175  } > m_data
176
177  __DATA_END = __DATA_ROM + (__data_end__ - __data_start__);
178  text_end = ORIGIN(m_text) + LENGTH(m_text);
179  ASSERT(__DATA_END <= text_end, "region m_text overflowed with text and data")
180
181  /* Uninitialized data section */
182  .bss :
183  {
184    /* This is used by the startup in order to initialize the .bss section */
185    . = ALIGN(4);
186    __START_BSS = .;
187    __bss_start__ = .;
188    *(.bss)
189    *(.bss*)
190    *(COMMON)
191    . = ALIGN(4);
192    __bss_end__ = .;
193    __END_BSS = .;
194  } > m_data
195
196  .heap :
197  {
198    . = ALIGN(8);
199    __end__ = .;
200    PROVIDE(end = .);
201    __HeapBase = .;
202    . += HEAP_SIZE;
203    __HeapLimit = .;
204    __heap_limit = .; /* Add for _sbrk */
205  } > m_data
206
207  .stack :
208  {
209    . = ALIGN(8);
210    . += STACK_SIZE;
211  } > m_data
212
213
214  /* Initializes stack on the end of block */
215  __StackTop   = ORIGIN(m_data) + LENGTH(m_data);
216  __StackLimit = __StackTop - STACK_SIZE;
217  PROVIDE(__stack = __StackTop);
218
219  .ARM.attributes 0 : { *(.ARM.attributes) }
220
221  ASSERT(__StackLimit >= __HeapLimit, "region m_data overflowed with stack and heap")
222}
223
224