Skip to content

Commit b268aa6

Browse files
committed
Add GCC_ARM support for the target AN382 of MPS2.
Add files MPS2.ld and startup_MPS2.S to support GCC_ARM of the target AN382(ARM_MPS2_M0). Add "GCC_ARM" to supported_toolchains list. Change-Id: I7046b698834c82e94015e51eef9a0f5e1315ddaa Signed-off-by: Shawn Shan <[email protected]>
1 parent db57e58 commit b268aa6

File tree

3 files changed

+409
-3
lines changed

3 files changed

+409
-3
lines changed
Lines changed: 204 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,204 @@
1+
/*
2+
* Copyright (c) 2009-2019 Arm Limited. All rights reserved.
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*
6+
* Licensed under the Apache License, Version 2.0 (the License); you may
7+
* not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing, software
13+
* distributed under the License is distributed on an AS IS BASIS, WITHOUT
14+
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
* See the License for the specific language governing permissions and
16+
* limitations under the License.
17+
*/
18+
19+
/*
20+
* This file is derivative of mbed-os V5.10.4 CM3DS MPS2.ld for GCC_ARM
21+
*
22+
* Linker script for AN382
23+
*/
24+
25+
26+
MEMORY
27+
{
28+
FLASH (rx) : ORIGIN = 0x00000000, LENGTH = 0x00400000 /* 4MB ZBTSRAM1 */
29+
RAM (rwx) : ORIGIN = 0x20000000, LENGTH = 0x00400000 /* 4MB ZBTSRAM2 & ZBTSRAM3 */
30+
}
31+
32+
/* Linker script to place sections and symbol values. Should be used together
33+
* with other linker script that defines memory regions FLASH and RAM.
34+
* It references following symbols, which must be defined in code:
35+
* Reset_Handler : Entry of reset handler
36+
*
37+
* It defines following symbols, which code can use without definition:
38+
* __exidx_start
39+
* __exidx_end
40+
* __etext
41+
* __data_start__
42+
* __preinit_array_start
43+
* __preinit_array_end
44+
* __init_array_start
45+
* __init_array_end
46+
* __fini_array_start
47+
* __fini_array_end
48+
* __data_end__
49+
* __bss_start__
50+
* __bss_end__
51+
* __end__
52+
* end
53+
* __HeapLimit
54+
* __StackLimit
55+
* __StackTop
56+
* __stack
57+
*/
58+
ENTRY(Reset_Handler)
59+
60+
HEAP_SIZE = 0x1000;
61+
STACK_SIZE = 0x400;
62+
63+
/* Size of the vector table in SRAM */
64+
NVIC_NUM_VECTORS = (16 + 48);
65+
M_VECTOR_RAM_SIZE = NVIC_NUM_VECTORS * 4;
66+
67+
SECTIONS
68+
{
69+
.isr_vector :
70+
{
71+
__vector_table = .;
72+
KEEP(*(.vector_table))
73+
. = ALIGN(4);
74+
} > FLASH
75+
76+
.text :
77+
{
78+
. = ALIGN(4);
79+
*(.text*)
80+
81+
KEEP(*(.init))
82+
KEEP(*(.fini))
83+
84+
/* .ctors */
85+
*crtbegin.o(.ctors)
86+
*crtbegin?.o(.ctors)
87+
*(EXCLUDE_FILE(*crtend?.o *crtend.o) .ctors)
88+
*(SORT(.ctors.*))
89+
*(.ctors)
90+
91+
/* .dtors */
92+
*crtbegin.o(.dtors)
93+
*crtbegin?.o(.dtors)
94+
*(EXCLUDE_FILE(*crtend?.o *crtend.o) .dtors)
95+
*(SORT(.dtors.*))
96+
*(.dtors)
97+
98+
*(.rodata*)
99+
100+
KEEP(*(.eh_frame*))
101+
} > FLASH
102+
103+
.ARM.extab :
104+
{
105+
*(.ARM.extab* .gnu.linkonce.armextab.*)
106+
} > FLASH
107+
108+
__exidx_start = .;
109+
.ARM.exidx :
110+
{
111+
*(.ARM.exidx* .gnu.linkonce.armexidx.*)
112+
} > FLASH
113+
__exidx_end = .;
114+
115+
.interrupts_ram :
116+
{
117+
. = ALIGN(4);
118+
__VECTOR_RAM__ = .;
119+
__interrupts_ram_start__ = .; /* Create a global symbol at data start */
120+
. += M_VECTOR_RAM_SIZE;
121+
. = ALIGN(4);
122+
__interrupts_ram_end__ = .; /* Define a global symbol at data end */
123+
} > RAM
124+
125+
.data :
126+
{
127+
PROVIDE(__etext = LOADADDR(.data));
128+
. = ALIGN(4);
129+
__data_start__ = .;
130+
*(.data*)
131+
132+
. = ALIGN(4);
133+
/* preinit data */
134+
PROVIDE (__preinit_array_start = .);
135+
KEEP(*(.preinit_array))
136+
PROVIDE (__preinit_array_end = .);
137+
138+
. = ALIGN(4);
139+
/* init data */
140+
PROVIDE (__init_array_start = .);
141+
KEEP(*(SORT(.init_array.*)))
142+
KEEP(*(.init_array))
143+
PROVIDE (__init_array_end = .);
144+
145+
146+
. = ALIGN(4);
147+
/* finit data */
148+
PROVIDE (__fini_array_start = .);
149+
KEEP(*(SORT(.fini_array.*)))
150+
KEEP(*(.fini_array))
151+
PROVIDE (__fini_array_end = .);
152+
153+
. = ALIGN(4);
154+
/* All data end */
155+
__data_end__ = .;
156+
157+
} > RAM AT > FLASH
158+
159+
.uninitialized (NOLOAD):
160+
{
161+
. = ALIGN(32);
162+
__uninitialized_start = .;
163+
*(.uninitialized)
164+
KEEP(*(.keep.uninitialized))
165+
. = ALIGN(32);
166+
__uninitialized_end = .;
167+
} > RAM
168+
169+
.bss :
170+
{
171+
. = ALIGN(4);
172+
__START_BSS = .;
173+
__bss_start__ = .;
174+
*(.bss*)
175+
*(COMMON)
176+
. = ALIGN(4);
177+
__bss_end__ = .;
178+
__END_BSS = .;
179+
180+
} > RAM
181+
182+
bss_size = __bss_end__ - __bss_start__;
183+
184+
.heap :
185+
{
186+
. = ALIGN(8);
187+
__end__ = .;
188+
PROVIDE(end = .);
189+
__HeapBase = .;
190+
. += HEAP_SIZE;
191+
__HeapLimit = .;
192+
__heap_limit = .; /* Add for _sbrk */
193+
} > RAM
194+
195+
/* Set stack top to end of RAM, and stack limit move down by
196+
* size of stack_dummy section */
197+
__StackTop = ORIGIN(RAM) + LENGTH(RAM);
198+
__StackLimit = __StackTop - STACK_SIZE;
199+
PROVIDE(__stack = __StackTop);
200+
201+
/* Check if data + heap + stack exceeds RAM limit */
202+
ASSERT(__StackLimit >= __HeapLimit, "region RAM overflowed with stack")
203+
204+
} /* End of sections */

0 commit comments

Comments
 (0)