From 3e09f233a48d42c4a95803b552cc22af5329f74e Mon Sep 17 00:00:00 2001 From: Marc Herbert Date: Wed, 6 Dec 2023 01:24:26 +0000 Subject: [PATCH] set_xtensa_params.sh: add ZEPHYR_TOOLCHAIN_VARIANT This helps with Zephyr and does not hurt anyone else. Adjust rebuild-testbench.sh accordingly. Signed-off-by: Marc Herbert --- scripts/rebuild-testbench.sh | 10 +++++++++- scripts/set_xtensa_params.sh | 17 +++++++++++++---- 2 files changed, 22 insertions(+), 5 deletions(-) diff --git a/scripts/rebuild-testbench.sh b/scripts/rebuild-testbench.sh index 65fadbf8e..3be6b69d9 100755 --- a/scripts/rebuild-testbench.sh +++ b/scripts/rebuild-testbench.sh @@ -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" @@ -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" diff --git a/scripts/set_xtensa_params.sh b/scripts/set_xtensa_params.sh index e1eeec75a..cbc2db588 100644 --- a/scripts/set_xtensa_params.sh +++ b/scripts/set_xtensa_params.sh @@ -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 @@ -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 @@ -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