Skip to content

Commit

Permalink
scripts: add new SOF_CC_BASE={xcc,clang,gcc} 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 10, 2024
1 parent 7826d43 commit 7a8c1b7
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 3 deletions.
9 changes: 6 additions & 3 deletions scripts/cmake/xtensa-toolchain.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,14 @@ 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()

if(NOT DEFINED SOF_CC_BASE)
set(SOF_CC_BASE "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)
find_program(CMAKE_RANLIB NAMES "${CROSS_COMPILE}ranlib" 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 7a8c1b7

Please sign in to comment.