Skip to content

Commit

Permalink
scripts: add new SOF_CC_BASE={xcc,clang} variable
Browse files Browse the repository at this point in the history
This is required to allow building XTOS with newer, clang-based, Cadence
toolchains as just submitted for ACP_7_0 in thesofproject#9351

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
  • Loading branch information
marc-hb committed Aug 9, 2024
1 parent 7826d43 commit 2d4ee87
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 3 deletions.
5 changes: 2 additions & 3 deletions scripts/cmake/xtensa-toolchain.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,9 @@ set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY)
# xt toolchain only partially follows gcc convention
if(TOOLCHAIN STREQUAL "xt")
set(XCC 1)
set(CMAKE_C_COMPILER ${CROSS_COMPILE}xcc)
else()
set(CMAKE_C_COMPILER ${CROSS_COMPILE}gcc)
endif()
# e.g.: "xt-" + "xcc"
set(CMAKE_C_COMPILER ${CROSS_COMPILE}${SOF_CC_BASE})

find_program(CMAKE_LD NAMES "${CROSS_COMPILE}ld" PATHS ENV PATH NO_DEFAULT_PATH)
find_program(CMAKE_AR NAMES "${CROSS_COMPILE}ar" PATHS ENV PATH NO_DEFAULT_PATH)
Expand Down
9 changes: 9 additions & 0 deletions scripts/set_xtensa_params.sh
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,15 @@ case "$platform" in
;;
esac

# Pre-zephyr "XTOS" build
case "$platform" in
none_yet)
SOF_CC_BASE='clang';;
*)
SOF_CC_BASE='xcc';;
esac

# For Zephyr unit tests, testbench,...
case "$platform" in
imx8*|mtl|lnl)
ZEPHYR_TOOLCHAIN_VARIANT='xt-clang';;
Expand Down
3 changes: 3 additions & 0 deletions scripts/xtensa-build-all.sh
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,8 @@ do
PATH=$XTENSA_TOOLS_DIR/XtensaTools/bin:$OLDPATH
build_dir_suffix='xcc'
else
# Override SOF_CC_BASE from set_xtensa_params.sh
SOF_CC_BASE='gcc'
TOOLCHAIN=$HOST
PATH=$SOF_TOP/../$HOST/bin:$OLDPATH
build_dir_suffix='gcc'
Expand All @@ -248,6 +250,7 @@ do
printf 'PATH=%s\n' "$PATH"
( set -x # log the main commands and their parameters
cmake -DTOOLCHAIN="$TOOLCHAIN" \
-DSOF_CC_BASE="$SOF_CC_BASE" \
-DROOT_DIR="$ROOT" \
-DMEU_OPENSSL="${MEU_OPENSSL}" \
"${MEU_PATH_OPTION}" \
Expand Down

0 comments on commit 2d4ee87

Please sign in to comment.