Skip to content

Commit 0d0f14b

Browse files
committed
Add GCC_ARM support for the target AN385 of MPS2.
Add files MPS2.ld and startup_MPS2.S to support GCC_ARM of the target AN385(ARM_MPS2_M3). Add "GCC_ARM" to supported_toolchains list. Change-Id: I3110d4ab37a3294488a80a8dc1c929bfd87ce989 Signed-off-by: Shawn Shan <[email protected]>
1 parent 6a9c0e9 commit 0d0f14b

File tree

3 files changed

+409
-1
lines changed

3 files changed

+409
-1
lines changed
Lines changed: 205 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,205 @@
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 AN385
23+
*/
24+
25+
#include "../cmsis_nvic.h"
26+
27+
MEMORY
28+
{
29+
FLASH (rx) : ORIGIN = 0x00000000, LENGTH = 0x00400000 /* 4MB ZBTSRAM1 */
30+
RAM (rwx) : ORIGIN = 0x20000000, LENGTH = 0x00400000 /* 4MB ZBTSRAM2 & ZBTSRAM3 */
31+
}
32+
33+
/* Linker script to place sections and symbol values. Should be used together
34+
* with other linker script that defines memory regions FLASH and RAM.
35+
* It references following symbols, which must be defined in code:
36+
* Reset_Handler : Entry of reset handler
37+
*
38+
* It defines following symbols, which code can use without definition:
39+
* __exidx_start
40+
* __exidx_end
41+
* __etext
42+
* __data_start__
43+
* __preinit_array_start
44+
* __preinit_array_end
45+
* __init_array_start
46+
* __init_array_end
47+
* __fini_array_start
48+
* __fini_array_end
49+
* __data_end__
50+
* __bss_start__
51+
* __bss_end__
52+
* __end__
53+
* end
54+
* __HeapLimit
55+
* __StackLimit
56+
* __StackTop
57+
* __stack
58+
*/
59+
ENTRY(Reset_Handler)
60+
61+
HEAP_SIZE = 0x1000;
62+
STACK_SIZE = 0x400;
63+
64+
/* Size of the vector table in SRAM */
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+
*(vtable)
131+
*(.data*)
132+
133+
. = ALIGN(4);
134+
/* preinit data */
135+
PROVIDE (__preinit_array_start = .);
136+
KEEP(*(.preinit_array))
137+
PROVIDE (__preinit_array_end = .);
138+
139+
. = ALIGN(4);
140+
/* init data */
141+
PROVIDE (__init_array_start = .);
142+
KEEP(*(SORT(.init_array.*)))
143+
KEEP(*(.init_array))
144+
PROVIDE (__init_array_end = .);
145+
146+
147+
. = ALIGN(4);
148+
/* finit data */
149+
PROVIDE (__fini_array_start = .);
150+
KEEP(*(SORT(.fini_array.*)))
151+
KEEP(*(.fini_array))
152+
PROVIDE (__fini_array_end = .);
153+
154+
. = ALIGN(4);
155+
/* All data end */
156+
__data_end__ = .;
157+
158+
} > RAM AT > FLASH
159+
160+
.uninitialized (NOLOAD):
161+
{
162+
. = ALIGN(32);
163+
__uninitialized_start = .;
164+
*(.uninitialized)
165+
KEEP(*(.keep.uninitialized))
166+
. = ALIGN(32);
167+
__uninitialized_end = .;
168+
} > RAM
169+
170+
.bss :
171+
{
172+
. = ALIGN(4);
173+
__START_BSS = .;
174+
__bss_start__ = .;
175+
*(.bss*)
176+
*(COMMON)
177+
. = ALIGN(4);
178+
__bss_end__ = .;
179+
__END_BSS = .;
180+
181+
} > RAM
182+
183+
bss_size = __bss_end__ - __bss_start__;
184+
185+
.heap :
186+
{
187+
. = ALIGN(8);
188+
__end__ = .;
189+
PROVIDE(end = .);
190+
__HeapBase = .;
191+
. += HEAP_SIZE;
192+
__HeapLimit = .;
193+
__heap_limit = .; /* Add for _sbrk */
194+
} > RAM
195+
196+
/* Set stack top to end of RAM, and stack limit move down by
197+
* size of stack_dummy section */
198+
__StackTop = ORIGIN(RAM) + LENGTH(RAM);
199+
__StackLimit = __StackTop - STACK_SIZE;
200+
PROVIDE(__stack = __StackTop);
201+
202+
/* Check if data + heap + stack exceeds RAM limit */
203+
ASSERT(__StackLimit >= __HeapLimit, "region RAM overflowed with stack")
204+
205+
} /* End of sections */

0 commit comments

Comments
 (0)