Skip to content

Commit 9d85bfd

Browse files
committed
Implementation of nrf52 target (draft).
1 parent 9d66dca commit 9d85bfd

32 files changed

+22088
-0
lines changed
Lines changed: 186 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,186 @@
1+
/*
2+
* Copyright (c) 2015 ARM Limited
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
/* Linker script to configure memory regions. */
18+
19+
MEMORY
20+
{
21+
FLASH (rx) : ORIGIN = 0x1C000, LENGTH = 0x64000
22+
RAM (rwx) : ORIGIN = 0x20002ef8, LENGTH = 0xd108
23+
}
24+
25+
26+
OUTPUT_FORMAT ("elf32-littlearm", "elf32-bigarm", "elf32-littlearm")
27+
28+
/* Linker script to place sections and symbol values. Should be used together
29+
* with the other linker script that defines memory regions FLASH and RAM.
30+
* It references the following symbols that must be defined in code:
31+
* Reset_Handler : Entry of reset handler
32+
*
33+
* It defines the following symbols that the code can use without definition:
34+
* __exidx_start
35+
* __exidx_end
36+
* __etext
37+
* __data_start__
38+
* __preinit_array_start
39+
* __preinit_array_end
40+
* __init_array_start
41+
* __init_array_end
42+
* __fini_array_start
43+
* __fini_array_end
44+
* __data_end__
45+
* __bss_start__
46+
* __bss_end__
47+
* __end__
48+
* end
49+
* __HeapLimit
50+
* __StackLimit
51+
* __StackTop
52+
* __stack
53+
*/
54+
ENTRY(Reset_Handler)
55+
56+
57+
SECTIONS
58+
{
59+
.text :
60+
{
61+
KEEP(*(.Vectors))
62+
*(.text*)
63+
64+
KEEP(*(.init))
65+
KEEP(*(.fini))
66+
67+
/* .ctors */
68+
*crtbegin.o(.ctors)
69+
*crtbegin?.o(.ctors)
70+
*(EXCLUDE_FILE(*crtend?.o *crtend.o) .ctors)
71+
*(SORT(.ctors.*))
72+
*(.ctors)
73+
74+
/* .dtors */
75+
*crtbegin.o(.dtors)
76+
*crtbegin?.o(.dtors)
77+
*(EXCLUDE_FILE(*crtend?.o *crtend.o) .dtors)
78+
*(SORT(.dtors.*))
79+
*(.dtors)
80+
81+
*(.rodata*)
82+
83+
KEEP(*(.eh_frame*))
84+
} > FLASH
85+
86+
87+
.ARM.extab :
88+
{
89+
*(.ARM.extab* .gnu.linkonce.armextab.*)
90+
. = ALIGN(4);
91+
} > FLASH
92+
93+
__exidx_start = .;
94+
.ARM.exidx :
95+
{
96+
*(.ARM.exidx* .gnu.linkonce.armexidx.*)
97+
. = ALIGN(4);
98+
} > FLASH
99+
__exidx_end = .;
100+
101+
__etext = .;
102+
103+
.data : AT (__etext)
104+
{
105+
__data_start__ = .;
106+
*(vtable)
107+
*(.data*)
108+
109+
. = ALIGN(4);
110+
/* preinit data */
111+
PROVIDE_HIDDEN (__preinit_array_start = .);
112+
KEEP(*(.preinit_array))
113+
PROVIDE_HIDDEN (__preinit_array_end = .);
114+
115+
. = ALIGN(4);
116+
/* init data */
117+
PROVIDE_HIDDEN (__init_array_start = .);
118+
KEEP(*(SORT(.init_array.*)))
119+
KEEP(*(.init_array))
120+
PROVIDE_HIDDEN (__init_array_end = .);
121+
122+
123+
. = ALIGN(4);
124+
/* finit data */
125+
PROVIDE_HIDDEN (__fini_array_start = .);
126+
KEEP(*(SORT(.fini_array.*)))
127+
KEEP(*(.fini_array))
128+
PROVIDE_HIDDEN (__fini_array_end = .);
129+
130+
*(.jcr)
131+
. = ALIGN(4);
132+
/* All data end */
133+
__data_end__ = .;
134+
135+
} > RAM
136+
137+
__edata = .;
138+
139+
.fs_data :
140+
{
141+
PROVIDE(__start_fs_data = .);
142+
KEEP(*(.fs_data))
143+
PROVIDE(__stop_fs_data = .);
144+
} > RAM
145+
146+
.bss :
147+
{
148+
. = ALIGN(4);
149+
__bss_start__ = .;
150+
*(.bss*)
151+
*(COMMON)
152+
. = ALIGN(4);
153+
__bss_end__ = .;
154+
} > RAM
155+
156+
.heap (NOLOAD):
157+
{
158+
__end__ = .;
159+
end = __end__;
160+
*(.heap*);
161+
162+
/* Expand the heap to reach the stack boundary. */
163+
ASSERT(. <= (ORIGIN(RAM) + LENGTH(RAM) - 0x800), "heap region overflowed into stack");
164+
. += (ORIGIN(RAM) + LENGTH(RAM) - 0x800) - .;
165+
} > RAM
166+
PROVIDE(__heap_start = ADDR(.heap));
167+
PROVIDE(__heap_size = SIZEOF(.heap));
168+
PROVIDE(__mbed_sbrk_start = ADDR(.heap));
169+
PROVIDE(__mbed_krbs_start = ADDR(.heap) + SIZEOF(.heap));
170+
171+
/* .stack_dummy section does not contain any symbols. It is only
172+
* used for the linker script to calculate the size of stack sections
173+
* and assign values to stack symbols later. */
174+
.stack (NOLOAD):
175+
{
176+
__StackLimit = .;
177+
*(.stack*)
178+
. += (ORIGIN(RAM) + LENGTH(RAM) - .);
179+
} > RAM
180+
181+
/* Set the stack top to the end of RAM and move down the stack limit by
182+
* the size of the stack_dummy section. */
183+
__StackTop = ORIGIN(RAM) + LENGTH(RAM);
184+
__StackLimit = __StackTop - SIZEOF(.stack);
185+
PROVIDE(__stack = __StackTop);
186+
}

0 commit comments

Comments
 (0)