1/*
2** ###################################################################
3**     Processors:          LPC5526JBD100_cm33_core0
4**                          LPC5526JBD64_cm33_core0
5**                          LPC5526JEV98_cm33_core0
6**
7**     Compiler:            GNU C Compiler
8**     Reference manual:    LPC55S6x/LPC55S2x/LPC552x User manual(UM11126) Rev.1.3  16 May 2019
9**     Version:             rev. 1.1, 2019-05-16
10**     Build:               b200722
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
28
29/* Entry Point */
30ENTRY(Reset_Handler)
31
32HEAP_SIZE  = DEFINED(__heap_size__)  ? __heap_size__  : 0x0400;
33STACK_SIZE = DEFINED(__stack_size__) ? __stack_size__ : 0x0800;
34
35/* Specify the memory areas */
36MEMORY
37{
38  m_interrupts          (RX)  : ORIGIN = 0x04000000, LENGTH = 0x00000200
39  m_text                (RX)  : ORIGIN = 0x04000200, LENGTH = 0x00007E00
40  m_data                (RW)  : ORIGIN = 0x20000000, LENGTH = 0x00018000
41  m_usb_sram            (RW)  : ORIGIN = 0x40100000, 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  .ARM.extab :
72  {
73    *(.ARM.extab* .gnu.linkonce.armextab.*)
74  } > m_text
75
76  .ARM :
77  {
78    __exidx_start = .;
79    *(.ARM.exidx*)
80    __exidx_end = .;
81  } > m_text
82
83 .ctors :
84  {
85    __CTOR_LIST__ = .;
86    /* gcc uses crtbegin.o to find the start of
87       the constructors, so we make sure it is
88       first.  Because this is a wildcard, it
89       doesn't matter if the user does not
90       actually link against crtbegin.o; the
91       linker won't look for a file to match a
92       wildcard.  The wildcard also means that it
93       doesn't matter which directory crtbegin.o
94       is in.  */
95    KEEP (*crtbegin.o(.ctors))
96    KEEP (*crtbegin?.o(.ctors))
97    /* We don't want to include the .ctor section from
98       from the crtend.o file until after the sorted ctors.
99       The .ctor section from the crtend file contains the
100       end of ctors marker and it must be last */
101    KEEP (*(EXCLUDE_FILE(*crtend?.o *crtend.o) .ctors))
102    KEEP (*(SORT(.ctors.*)))
103    KEEP (*(.ctors))
104    __CTOR_END__ = .;
105  } > m_text
106
107  .dtors :
108  {
109    __DTOR_LIST__ = .;
110    KEEP (*crtbegin.o(.dtors))
111    KEEP (*crtbegin?.o(.dtors))
112    KEEP (*(EXCLUDE_FILE(*crtend?.o *crtend.o) .dtors))
113    KEEP (*(SORT(.dtors.*)))
114    KEEP (*(.dtors))
115    __DTOR_END__ = .;
116  } > m_text
117
118  .preinit_array :
119  {
120    PROVIDE_HIDDEN (__preinit_array_start = .);
121    KEEP (*(.preinit_array*))
122    PROVIDE_HIDDEN (__preinit_array_end = .);
123  } > m_text
124
125  .init_array :
126  {
127    PROVIDE_HIDDEN (__init_array_start = .);
128    KEEP (*(SORT(.init_array.*)))
129    KEEP (*(.init_array*))
130    PROVIDE_HIDDEN (__init_array_end = .);
131  } > m_text
132
133  .fini_array :
134  {
135    PROVIDE_HIDDEN (__fini_array_start = .);
136    KEEP (*(SORT(.fini_array.*)))
137    KEEP (*(.fini_array*))
138    PROVIDE_HIDDEN (__fini_array_end = .);
139  } > m_text
140
141  __etext = .;    /* define a global symbol at end of code */
142  __DATA_ROM = .; /* Symbol is used by startup for data initialization */
143
144  .data : AT(__DATA_ROM)
145  {
146    . = ALIGN(4);
147    __DATA_RAM = .;
148    __data_start__ = .;      /* create a global symbol at data start */
149    *(.ramfunc*)             /* for functions in ram */
150    *(.data)                 /* .data sections */
151    *(.data*)                /* .data* sections */
152    KEEP(*(.jcr*))
153    . = ALIGN(4);
154    __data_end__ = .;        /* define a global symbol at data end */
155  } > m_data
156
157  __DATA_END = __DATA_ROM + (__data_end__ - __data_start__);
158  text_end = ORIGIN(m_text) + LENGTH(m_text);
159  ASSERT(__DATA_END <= text_end, "region m_text overflowed with text and data")
160
161  /* Uninitialized data section */
162  .bss :
163  {
164    /* This is used by the startup in order to initialize the .bss section */
165    . = ALIGN(4);
166    __START_BSS = .;
167    __bss_start__ = .;
168    *(.bss)
169    *(.bss*)
170    *(COMMON)
171    . = ALIGN(4);
172    __bss_end__ = .;
173    __END_BSS = .;
174  } > m_data
175
176  .heap :
177  {
178    . = ALIGN(8);
179    __end__ = .;
180    PROVIDE(end = .);
181    __HeapBase = .;
182    . += HEAP_SIZE;
183    __HeapLimit = .;
184    __heap_limit = .; /* Add for _sbrk */
185  } > m_data
186
187  .stack :
188  {
189    . = ALIGN(8);
190    . += STACK_SIZE;
191  } > m_data
192
193  m_usb_bdt (NOLOAD) :
194  {
195    . = ALIGN(512);
196    *(m_usb_bdt)
197  } > m_usb_sram
198
199  m_usb_global (NOLOAD) :
200  {
201    *(m_usb_global)
202  } > m_usb_sram
203
204  /* Initializes stack on the end of block */
205  __StackTop   = ORIGIN(m_data) + LENGTH(m_data);
206  __StackLimit = __StackTop - STACK_SIZE;
207  PROVIDE(__stack = __StackTop);
208
209  .ARM.attributes 0 : { *(.ARM.attributes) }
210
211  ASSERT(__StackLimit >= __HeapLimit, "region m_data overflowed with stack and heap")
212}
213
214