Skip to content

Commit cbb08a7

Browse files
marc-hbkv2019i
authored andcommitted
scripts: add new SOF_CC_BASE={xcc,clang,gcc} variable
This is required to allow building XTOS with newer, clang-based, Cadence toolchains as just submitted for ACP_7_0 in #9351 Signed-off-by: Marc Herbert <marc.herbert@intel.com>
1 parent 1ce1b28 commit cbb08a7

File tree

3 files changed

+18
-3
lines changed

3 files changed

+18
-3
lines changed

scripts/cmake/xtensa-toolchain.cmake

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,11 +49,14 @@ set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY)
4949
# xt toolchain only partially follows gcc convention
5050
if(TOOLCHAIN STREQUAL "xt")
5151
set(XCC 1)
52-
set(CMAKE_C_COMPILER ${CROSS_COMPILE}xcc)
53-
else()
54-
set(CMAKE_C_COMPILER ${CROSS_COMPILE}gcc)
5552
endif()
5653

54+
if(NOT DEFINED SOF_CC_BASE)
55+
set(SOF_CC_BASE "gcc")
56+
endif()
57+
# e.g.: "xt-" + "xcc"
58+
set(CMAKE_C_COMPILER ${CROSS_COMPILE}${SOF_CC_BASE})
59+
5760
find_program(CMAKE_LD NAMES "${CROSS_COMPILE}ld" PATHS ENV PATH NO_DEFAULT_PATH)
5861
find_program(CMAKE_AR NAMES "${CROSS_COMPILE}ar" PATHS ENV PATH NO_DEFAULT_PATH)
5962
find_program(CMAKE_RANLIB NAMES "${CROSS_COMPILE}ranlib" PATHS ENV PATH NO_DEFAULT_PATH)

scripts/set_xtensa_params.sh

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,15 @@ case "$platform" in
145145
;;
146146
esac
147147

148+
# Pre-zephyr "XTOS" build
149+
case "$platform" in
150+
none_yet)
151+
SOF_CC_BASE='clang';;
152+
*)
153+
SOF_CC_BASE='xcc';;
154+
esac
155+
156+
# For Zephyr unit tests, testbench,...
148157
case "$platform" in
149158
imx8*|mtl|lnl)
150159
ZEPHYR_TOOLCHAIN_VARIANT='xt-clang';;

scripts/xtensa-build-all.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,8 @@ do
231231
PATH=$XTENSA_TOOLS_DIR/XtensaTools/bin:$OLDPATH
232232
build_dir_suffix='xcc'
233233
else
234+
# Override SOF_CC_BASE from set_xtensa_params.sh
235+
SOF_CC_BASE='gcc'
234236
TOOLCHAIN=$HOST
235237
PATH=$SOF_TOP/../$HOST/bin:$OLDPATH
236238
build_dir_suffix='gcc'
@@ -248,6 +250,7 @@ do
248250
printf 'PATH=%s\n' "$PATH"
249251
( set -x # log the main commands and their parameters
250252
cmake -DTOOLCHAIN="$TOOLCHAIN" \
253+
-DSOF_CC_BASE="$SOF_CC_BASE" \
251254
-DROOT_DIR="$ROOT" \
252255
-DMEU_OPENSSL="${MEU_OPENSSL}" \
253256
"${MEU_PATH_OPTION}" \

0 commit comments

Comments
 (0)