Skip to content

Commit c43c918

Browse files
yanghuataoxiaoxiang781216
authored andcommitted
toolchain/ghs: add ghs link script for mps2-an500 platform
Signed-off-by: yanghuatao <[email protected]>
1 parent 2a8c023 commit c43c918

File tree

3 files changed

+126
-1
lines changed

3 files changed

+126
-1
lines changed

arch/arm/src/armv7-m/Toolchain.defs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,21 @@ else ifeq ($(CONFIG_ARM_TOOLCHAIN_ARMCLANG),y)
133133
LDFLAGS += --cpu=Cortex-M3
134134
endif
135135

136+
else ifeq ($(CONFIG_ARM_TOOLCHAIN_GHS),y)
137+
MKDEP = $(TOPDIR)$(DELIM)tools$(DELIM)mknulldeps.sh
138+
139+
undefine PREPROCESS
140+
define PREPROCESS
141+
$(ECHO_BEGIN)"CPP: $1->$2 "
142+
$(Q) $(CPP) $(CPPFLAGS) $($(strip $1)_CPPFLAGS) -filetype.cpp $1 -o $2
143+
$(ECHO_END)
144+
endef
145+
146+
undefine ARCHIVE
147+
define ARCHIVE
148+
$(AR) $2 -archive -o $1
149+
endef
150+
136151
endif
137152

138153
ifeq ($(CONFIG_ARMV7M_STACKCHECK),y)

boards/arm/mps/mps2-an500/scripts/Make.defs

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,19 @@ include $(TOPDIR)/.config
2222
include $(TOPDIR)/tools/Config.mk
2323
include $(TOPDIR)/arch/arm/src/armv7-m/Toolchain.defs
2424

25-
LDSCRIPT = flash.ld
25+
ifeq ($(CONFIG_ARM_TOOLCHAIN_GHS),y)
26+
define POSTBUILD
27+
$(GMEMFILE) nuttx -o nuttx.bin
28+
endef
29+
30+
LDSCRIPT = ghs-flash.ld
31+
else
32+
define POSTBUILD
33+
$(OBJCOPY) -O binary nuttx nuttx.bin
34+
endef
35+
36+
LDSCRIPT = flash.ld
37+
endif
2638

2739
ARCHSCRIPT += $(BOARD_DIR)$(DELIM)scripts$(DELIM)$(LDSCRIPT)
2840

Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
/****************************************************************************
2+
* boards/arm/mps/mps2-an500/scripts/ghs-flash.ld
3+
*
4+
* Licensed to the Apache Software Foundation (ASF) under one or more
5+
* contributor license agreements. See the NOTICE file distributed with
6+
* this work for additional information regarding copyright ownership. The
7+
* ASF licenses this file to you under the Apache License, Version 2.0 (the
8+
* "License"); you may not use this file except in compliance with the
9+
* License. You may obtain a copy of the License at
10+
*
11+
* http://www.apache.org/licenses/LICENSE-2.0
12+
*
13+
* Unless required by applicable law or agreed to in writing, software
14+
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
15+
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
16+
* License for the specific language governing permissions and limitations
17+
* under the License.
18+
*
19+
****************************************************************************/
20+
21+
MEMORY
22+
{
23+
flash (rwx) : ORIGIN = 0x00000000, LENGTH = 4M
24+
}
25+
26+
SECTIONS
27+
{
28+
.text ALIGN(4) : {
29+
_stext = ABSOLUTE(.);
30+
*(.vectors)
31+
*(.text)
32+
"*(.text.*)"
33+
*(.fixup)
34+
*(.gnu.warning)
35+
*(.rodata)
36+
*(.glue_7)
37+
*(.glue_7t)
38+
*(.got)
39+
*(.gcc_except_table)
40+
_etext = ABSOLUTE(.);
41+
} > flash
42+
43+
.syscall : > .
44+
45+
.init_section ALIGN(4) : {
46+
_sinit = ABSOLUTE(.);
47+
*(.init_array)
48+
*(.ctors)
49+
_einit = ABSOLUTE(.);
50+
} > flash
51+
52+
.ARM.extab ALIGN(4) : {
53+
"*(.ARM.extab*)"
54+
} > flash
55+
56+
.ARM.exidx ALIGN(4) : {
57+
__exidx_start = ABSOLUTE(.);
58+
"*(.ARM.exidx*)"
59+
__exidx_end = ABSOLUTE(.);
60+
} > flash
61+
62+
.tdata ALIGN(4) : {
63+
_stdata = ABSOLUTE(.);
64+
*(.tdata)
65+
"*(.tdata.*)"
66+
_etdata = ABSOLUTE(.);
67+
} > flash
68+
69+
.tbss : {
70+
_stbss = ABSOLUTE(.);
71+
*(.tbss)
72+
*(.tcommon)
73+
_etbss = ABSOLUTE(.);
74+
} > flash
75+
76+
_eronly = ENDADDR(.tbss);
77+
78+
.ram_vectors : {
79+
*(.ram_vectors)
80+
} > flash
81+
82+
.data ALIGN(4) : {
83+
_sdata = ABSOLUTE(.);
84+
*(.data)
85+
"*(.data.*)"
86+
. = ALIGN(4);
87+
_edata = ABSOLUTE(.);
88+
} > flash
89+
90+
.bss ALIGN(4) : {
91+
_sbss = ABSOLUTE(.);
92+
*(.bss)
93+
"*(.bss.*)"
94+
*(COMMON)
95+
. = ALIGN(4);
96+
_ebss = ABSOLUTE(.);
97+
} > flash
98+
}

0 commit comments

Comments
 (0)