Skip to content

Commit

Permalink
set_xtensa_params.sh: add ZEPHYR_TOOLCHAIN_VARIANT
Browse files Browse the repository at this point in the history
This helps with Zephyr and does not hurt anyone else.

Adjust rebuild-testbench.sh accordingly.

Signed-off-by: Marc Herbert <[email protected]>
  • Loading branch information
marc-hb authored and kv2019i committed Dec 13, 2023
1 parent 7b80689 commit 3e09f23
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 5 deletions.
10 changes: 9 additions & 1 deletion scripts/rebuild-testbench.sh
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ setup_xtensa_tools_build()
BUILD_TYPE=xt
BUILD_TARGET=
BUILD_DIR_NAME=build_xt_testbench
COMPILER="xt-xcc"

# check needed environment variables
test -n "${XTENSA_TOOLS_ROOT}" || die "XTENSA_TOOLS_ROOT need to be set.\n"
Expand All @@ -73,6 +72,15 @@ setup_xtensa_tools_build()
test -n "${XTENSA_CORE}" ||
die "Illegal platform $BUILD_PLATFORM, no XTENSA_CORE found.\n"

# Zephyr is not part of the testbench at all but let's play nice and
# align with that naming convention to keep things simple.
case "${ZEPHYR_TOOLCHAIN_VARIANT}" in
xcc) COMPILER=xt-xcc;;
xt-clang) COMPILER=xt-clang;;
*) die 'Unknown or undefined ZEPHYR_TOOLCHAIN_VARIANT=%s\n' \
"${ZEPHYR_TOOLCHAIN_VARIANT}";;
esac

install_bin=install/tools/$TOOLCHAIN_VER/XtensaTools/bin
tools_bin=$XTENSA_TOOLS_ROOT/$install_bin
testbench_sections="-Wl,--sections-placement $BUILD_TESTBENCH_DIR/testbench_xcc_sections.txt"
Expand Down
17 changes: 13 additions & 4 deletions scripts/set_xtensa_params.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@
}
platform=$1

# If adding a new variable is required, avoid adding it to the mass
# duplication in this first, very verbose `case` statement. Prefer
# adding a new, smarter, per-variable `case` statement like the one for
# ZEPHYR_TOOLCHAIN_VARIANT below
case "$platform" in

# Intel
Expand All @@ -51,10 +55,6 @@ case "$platform" in
PLATFORM="$platform"
XTENSA_CORE="ace10_LX7HiFi4_2022_10"
TOOLCHAIN_VER="RI-2022.10-linux"
# TODO: to reduce duplication, make rebuild-testbench "smarter"
# and able to decode ZEPHYR_TOOLCHAIN_VARIANT (even when it does
# not care about Zephyr)
COMPILER="xt-clang"
;;

# NXP
Expand Down Expand Up @@ -137,3 +137,12 @@ case "$platform" in
return 1
;;
esac

case "$platform" in
imx8*|mtl|lnl)
ZEPHYR_TOOLCHAIN_VARIANT='xt-clang';;
*) # The previous, main case/esac already caught invalid input.
# This won't hurt platforms that don't use Zephyr (it's not even
# exported).
ZEPHYR_TOOLCHAIN_VARIANT='xcc';;
esac

0 comments on commit 3e09f23

Please sign in to comment.