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