Skip to content

Commit 04fbe10

Browse files
nashifgalak
authored andcommitted
xtensa: fix toolchain and add overlays/hal
Installs hal library as part of the toolchain. Currently only supports newlib 2.2. Signed-off-by: Anas Nashif <[email protected]> Signed-off-by: Kumar Gala <[email protected]> Signed-off-by: Anas Nashif <[email protected]>
1 parent 7446cff commit 04fbe10

File tree

6 files changed

+65
-6
lines changed

6 files changed

+65
-6
lines changed

.shippable.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ env:
1313
- TARGET=riscv32
1414
- TARGET=mips
1515
- TARGET=arc
16+
- TARGET=xtensa
1617

1718
build:
1819
cache: true

configs/xtensa.config

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,12 @@ CT_LOCAL_PATCH_DIR="${CT_TOP_DIR}/../../patches"
88
CT_ARCH_XTENSA=y
99
CT_XTENSA_CUSTOM=y
1010
CT_ARCH_LE_BE=y
11+
CT_OVERLAY_NAME="sample_controller"
12+
CT_OVERLAY_LOCATION="./overlays"
1113
CT_TARGET_VENDOR="zephyr"
12-
CT_NEWLIB_V_2_5_0=y
14+
CT_NEWLIB_SRC_DEVEL=y
15+
CT_NEWLIB_DEVEL_URL="https://github.com/jcmvbkbc/newlib-xtensa.git"
16+
CT_NEWLIB_DEVEL_BRANCH="xtensa"
1317
CT_LIBC_NEWLIB_IO_FLOAT=y
1418
# CT_LIBC_NEWLIB_FSEEK_OPTIMIZATION is not set
1519
CT_LIBC_NEWLIB_DISABLE_SUPPLIED_SYSCALLS=y

go.sh

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -74,12 +74,30 @@ for t in ${TARGETS}; do
7474
mkdir -p build_${t}
7575
pushd build_${t}
7676

77-
${CT_NG} clean
78-
${CT_NG} defconfig DEFCONFIG=${GITDIR}/configs/${t}.config
79-
${CT_NG} savedefconfig DEFCONFIG=${t}.config
80-
${CT_NG} build -j ${JOBS}
81-
rm -rf build_${t}
77+
build_toolchain=1
78+
if [ -n "${build_toolchain}" ]; then
79+
cp -a ${SDK_NG_HOME}/overlays .
80+
81+
${CT_NG} clean
82+
${CT_NG} defconfig DEFCONFIG=${GITDIR}/configs/${t}.config
83+
${CT_NG} savedefconfig DEFCONFIG=${t}.config
84+
${CT_NG} build -j ${JOBS}
85+
fi
86+
87+
if [ "${t}" = "xtensa" ]; then
88+
wget https://github.com/foss-xtensa/xtensa-hal/archive/RF-2015.2.tar.gz
89+
tar xf RF-2015.2.tar.gz
90+
cd xtensa-hal-RF-2015.2
91+
wget https://github.com/foss-xtensa/xtensa-config/releases/download/201702/sample_controller_linux.tgz
92+
./import-core.sh sample_controller_linux.tgz
93+
export CC=${CT_PREFIX}/xtensa-zephyr-elf/bin/xtensa-zephyr-elf-gcc
94+
./configure --host xtensa-zephyr-elf --prefix ${CT_PREFIX}/xtensa-zephyr-elf
95+
make
96+
make install
97+
unset CC
98+
fi
8299

83100
popd
101+
rm -rf build_${t}
84102

85103
done

overlays/README

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
2+
xtensa_sample_controller.tar.gz
3+
-------------------------------
4+
5+
Generated using the following sequence of commands:
6+
7+
$ git clone git://github.com/foss-xtensa/xtensa-config.git
8+
$ cd xtensa-config
9+
$ wget https://github.com/foss-xtensa/xtensa-config/releases/download/201702/sample_controller_linux.tgz
10+
$ tar -xf sample_controller_linux.tgz `tar -tf sample_controller_linux.tgz | grep xtensa-config-overlay.tar.gz` -O > xtensa-config-overlay.tar.gz
11+
$ ./make-overlay.sh sample_controller xtensa-config-overlay.tar.gz .
12+
13+
83.8 KB
Binary file not shown.
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
2+
Fix unresolved external "fiprintf".
3+
When newlib is configured with:
4+
5+
--enable-newlib-nano-formatted-io
6+
7+
"fiprintf" should be an alias of "fprintf". However the alias does
8+
not seem to work properly, as we encounter unresolved external
9+
error if we uses "assert" in code. So we patch the code directly.
10+
11+
Signed-off-by: Juro Bystricky <[email protected]>
12+
13+
--- a/newlib/libc/stdlib/assert.c 2016-11-08 08:04:45.669248139 -0800
14+
+++ b/newlib/libc/stdlib/assert.c 2016-11-08 08:05:47.357554034 -0800
15+
@@ -56,7 +56,7 @@
16+
const char *func _AND
17+
const char *failedexpr)
18+
{
19+
- fiprintf(stderr,
20+
+ fprintf(stderr,
21+
"assertion \"%s\" failed: file \"%s\", line %d%s%s\n",
22+
failedexpr, file, line,
23+
func ? ", function: " : "", func ? func : "");

0 commit comments

Comments
 (0)