Skip to content

Commit 09cf4ef

Browse files
committed
Support for exporting to GCC_ARM
1 parent 83d4fac commit 09cf4ef

File tree

3 files changed

+449
-0
lines changed

3 files changed

+449
-0
lines changed
Lines changed: 172 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,172 @@
1+
/* Linker script for mbed LPC1768 */
2+
3+
/* Linker script to configure memory regions. */
4+
MEMORY
5+
{
6+
FLASH (rx) : ORIGIN = 0x00000000, LENGTH = 512K
7+
RAM (rwx) : ORIGIN = 0x100000E8, LENGTH = (32K - 0xE8)
8+
9+
USB_RAM(rwx) : ORIGIN = 0x20000000, LENGTH = 16K
10+
ETH_RAM(rwx) : ORIGIN = 0x20004000, LENGTH = 16K
11+
}
12+
13+
/* Linker script to place sections and symbol values. Should be used together
14+
* with other linker script that defines memory regions FLASH and RAM.
15+
* It references following symbols, which must be defined in code:
16+
* Reset_Handler : Entry of reset handler
17+
*
18+
* It defines following symbols, which code can use without definition:
19+
* __exidx_start
20+
* __exidx_end
21+
* __etext
22+
* __data_start__
23+
* __preinit_array_start
24+
* __preinit_array_end
25+
* __init_array_start
26+
* __init_array_end
27+
* __fini_array_start
28+
* __fini_array_end
29+
* __data_end__
30+
* __bss_start__
31+
* __bss_end__
32+
* __end__
33+
* end
34+
* __HeapLimit
35+
* __StackLimit
36+
* __StackTop
37+
* __stack
38+
*/
39+
ENTRY(Reset_Handler)
40+
41+
SECTIONS
42+
{
43+
.text :
44+
{
45+
KEEP(*(.isr_vector))
46+
*(.text*)
47+
48+
KEEP(*(.init))
49+
KEEP(*(.fini))
50+
51+
/* .ctors */
52+
*crtbegin.o(.ctors)
53+
*crtbegin?.o(.ctors)
54+
*(EXCLUDE_FILE(*crtend?.o *crtend.o) .ctors)
55+
*(SORT(.ctors.*))
56+
*(.ctors)
57+
58+
/* .dtors */
59+
*crtbegin.o(.dtors)
60+
*crtbegin?.o(.dtors)
61+
*(EXCLUDE_FILE(*crtend?.o *crtend.o) .dtors)
62+
*(SORT(.dtors.*))
63+
*(.dtors)
64+
65+
*(.rodata*)
66+
67+
KEEP(*(.eh_frame*))
68+
} > FLASH
69+
70+
.ARM.extab :
71+
{
72+
*(.ARM.extab* .gnu.linkonce.armextab.*)
73+
} > FLASH
74+
75+
__exidx_start = .;
76+
.ARM.exidx :
77+
{
78+
*(.ARM.exidx* .gnu.linkonce.armexidx.*)
79+
} > FLASH
80+
__exidx_end = .;
81+
82+
__etext = .;
83+
84+
.data : AT (__etext)
85+
{
86+
__data_start__ = .;
87+
Image$$RW_IRAM1$$Base = .;
88+
*(vtable)
89+
*(.data*)
90+
91+
. = ALIGN(4);
92+
/* preinit data */
93+
PROVIDE (__preinit_array_start = .);
94+
KEEP(*(.preinit_array))
95+
PROVIDE (__preinit_array_end = .);
96+
97+
. = ALIGN(4);
98+
/* init data */
99+
PROVIDE (__init_array_start = .);
100+
KEEP(*(SORT(.init_array.*)))
101+
KEEP(*(.init_array))
102+
PROVIDE (__init_array_end = .);
103+
104+
105+
. = ALIGN(4);
106+
/* finit data */
107+
PROVIDE (__fini_array_start = .);
108+
KEEP(*(SORT(.fini_array.*)))
109+
KEEP(*(.fini_array))
110+
PROVIDE (__fini_array_end = .);
111+
112+
. = ALIGN(4);
113+
/* All data end */
114+
__data_end__ = .;
115+
116+
} > RAM
117+
118+
119+
.bss :
120+
{
121+
__bss_start__ = .;
122+
*(.bss*)
123+
*(COMMON)
124+
__bss_end__ = .;
125+
Image$$RW_IRAM1$$ZI$$Limit = . ;
126+
} > RAM
127+
128+
129+
.heap :
130+
{
131+
__end__ = .;
132+
end = __end__;
133+
*(.heap*)
134+
__HeapLimit = .;
135+
} > RAM
136+
137+
/* .stack_dummy section doesn't contains any symbols. It is only
138+
* used for linker to calculate size of stack sections, and assign
139+
* values to stack symbols later */
140+
.stack_dummy :
141+
{
142+
*(.stack)
143+
} > RAM
144+
145+
/* Set stack top to end of RAM, and stack limit move down by
146+
* size of stack_dummy section */
147+
__StackTop = ORIGIN(RAM) + LENGTH(RAM);
148+
__StackLimit = __StackTop - SIZEOF(.stack_dummy);
149+
PROVIDE(__stack = __StackTop);
150+
151+
/* Check if data + heap + stack exceeds RAM limit */
152+
ASSERT(__StackLimit >= __HeapLimit, "region RAM overflowed with stack")
153+
154+
155+
/* Code can explicitly ask for data to be
156+
placed in these higher RAM banks where
157+
they will be left uninitialized.
158+
*/
159+
.AHBSRAM0 (NOLOAD):
160+
{
161+
Image$$RW_IRAM2$$Base = . ;
162+
*(AHBSRAM0)
163+
Image$$RW_IRAM2$$ZI$$Limit = .;
164+
} > USB_RAM
165+
166+
.AHBSRAM1 (NOLOAD):
167+
{
168+
Image$$RW_IRAM3$$Base = . ;
169+
*(AHBSRAM1)
170+
Image$$RW_IRAM3$$ZI$$Limit = .;
171+
} > ETH_RAM
172+
}

0 commit comments

Comments
 (0)