Skip to content

Commit d3c2423

Browse files
committed
scripts: Add sample SuperH configuration
This requires a patched GCC to resolve some FPU related issues. Signed-off-by: Keith Packard <[email protected]>
1 parent 9b7763b commit d3c2423

File tree

3 files changed

+132
-0
lines changed

3 files changed

+132
-0
lines changed

scripts/cross-sh-unknown-elf.txt

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
[binaries]
2+
# Meson 0.53.2 doesn't use any cflags when doing basic compiler tests,
3+
# so we have to add -nostdlib to the compiler configuration itself or
4+
# early compiler tests will fail. This can be removed when picolibc
5+
# requires at least version 0.54.2 of meson.
6+
c = ['ccache', 'sh-unknown-elf-gcc', '-nostdlib']
7+
ar = 'sh-unknown-elf-ar'
8+
as = 'sh-unknown-elf-as'
9+
nm = 'sh-unknown-elf-nm'
10+
strip = 'sh-unknown-elf-strip'
11+
exe_wrapper = ['sh', '-c', 'test -z "$PICOLIBC_TEST" || run-sh "$@"', 'run-sh']
12+
13+
[host_machine]
14+
system = 'none'
15+
cpu_family = 'sh'
16+
cpu = 'sh'
17+
endian = 'little'
18+
19+
[properties]
20+
skip_sanity_check = true
21+
default_flash_addr = '0x00000000'
22+
default_flash_size = '0x00400000'
23+
default_ram_addr = '0x0c000000'
24+
default_ram_size = '0x00200000'
25+
skip_math_test = ['m4_single_only', 'mb_m4_single_only', 'ml_m4_single_only']

scripts/do-sh-unknown-elf-configure

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
#!/bin/sh
2+
#
3+
# SPDX-License-Identifier: BSD-3-Clause
4+
#
5+
# Copyright © 2019 Keith Packard
6+
#
7+
# Redistribution and use in source and binary forms, with or without
8+
# modification, are permitted provided that the following conditions
9+
# are met:
10+
#
11+
# 1. Redistributions of source code must retain the above copyright
12+
# notice, this list of conditions and the following disclaimer.
13+
#
14+
# 2. Redistributions in binary form must reproduce the above
15+
# copyright notice, this list of conditions and the following
16+
# disclaimer in the documentation and/or other materials provided
17+
# with the distribution.
18+
#
19+
# 3. Neither the name of the copyright holder nor the names of its
20+
# contributors may be used to endorse or promote products derived
21+
# from this software without specific prior written permission.
22+
#
23+
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
24+
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
25+
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
26+
# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
27+
# COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
28+
# INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
29+
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
30+
# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
31+
# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
32+
# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
33+
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
34+
# OF THE POSSIBILITY OF SUCH DAMAGE.
35+
#
36+
exec "$(dirname "$0")"/do-configure sh-unknown-elf -Dtests=true -Dtests-enable-posix-io=false "$@"

scripts/run-sh

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
#!/bin/sh
2+
#
3+
# SPDX-License-Identifier: BSD-3-Clause
4+
#
5+
# Copyright © 2020 Keith Packard
6+
#
7+
# Redistribution and use in source and binary forms, with or without
8+
# modification, are permitted provided that the following conditions
9+
# are met:
10+
#
11+
# 1. Redistributions of source code must retain the above copyright
12+
# notice, this list of conditions and the following disclaimer.
13+
#
14+
# 2. Redistributions in binary form must reproduce the above
15+
# copyright notice, this list of conditions and the following
16+
# disclaimer in the documentation and/or other materials provided
17+
# with the distribution.
18+
#
19+
# 3. Neither the name of the copyright holder nor the names of its
20+
# contributors may be used to endorse or promote products derived
21+
# from this software without specific prior written permission.
22+
#
23+
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
24+
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
25+
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
26+
# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
27+
# COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
28+
# INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
29+
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
30+
# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
31+
# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
32+
# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
33+
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
34+
# OF THE POSSIBILITY OF SUCH DAMAGE.
35+
#
36+
37+
dir="$(dirname "$0")"
38+
39+
# select the program
40+
elf="$1"
41+
shift
42+
43+
qemu="qemu-system-sh4"
44+
cpu=sh7750r
45+
46+
case "$elf" in
47+
*_m2a*)
48+
echo 'Unsupported target'
49+
exit 77
50+
;;
51+
*_mb*)
52+
qemu="qemu-system-sh4eb"
53+
;;
54+
*_ml_*)
55+
qemu="qemu-system-sh4"
56+
;;
57+
*)
58+
;;
59+
esac
60+
61+
"$dir"/monitor-e9 $qemu \
62+
-chardev stdio,id=con,mux=on \
63+
-machine r2d \
64+
-cpu $cpu \
65+
-serial chardev:con \
66+
-mon chardev=con,mode=readline \
67+
-net none \
68+
-nographic \
69+
-device loader,file="$elf",cpu-num=0 "$@" < /dev/null
70+
71+
#gxemul -E testsh "$elf"

0 commit comments

Comments
 (0)