2019-04-06 21:08:09 +08:00
|
|
|
# SPDX-License-Identifier: Apache-2.0
|
|
|
|
|
2019-02-23 11:41:31 +08:00
|
|
|
set_ifndef(XTENSA_TOOLCHAIN_PATH "$ENV{XTENSA_TOOLCHAIN_PATH}")
|
|
|
|
set( XTENSA_TOOLCHAIN_PATH ${XTENSA_TOOLCHAIN_PATH} CACHE PATH "xtensa tools install directory")
|
|
|
|
assert( XTENSA_TOOLCHAIN_PATH "XTENSA_TOOLCHAIN_PATH is not set")
|
|
|
|
|
|
|
|
if(NOT EXISTS ${XTENSA_TOOLCHAIN_PATH})
|
|
|
|
message(FATAL_ERROR "Nothing found at XTENSA_TOOLCHAIN_PATH: '${XTENSA_TOOLCHAIN_PATH}'")
|
|
|
|
endif()
|
|
|
|
|
|
|
|
set(TOOLCHAIN_HOME ${XTENSA_TOOLCHAIN_PATH}/XtDevTools/install/tools/$ENV{TOOLCHAIN_VER}/XtensaTools)
|
2017-12-13 01:59:37 +08:00
|
|
|
|
2019-02-22 06:01:20 +08:00
|
|
|
set(COMPILER xcc)
|
2017-12-13 01:59:37 +08:00
|
|
|
|
|
|
|
set(CROSS_COMPILE_TARGET xt)
|
|
|
|
set(SYSROOT_TARGET xtensa-elf)
|
|
|
|
|
|
|
|
set(CROSS_COMPILE ${TOOLCHAIN_HOME}/bin/${CROSS_COMPILE_TARGET}-)
|
|
|
|
set(SYSROOT_DIR ${TOOLCHAIN_HOME}/${SYSROOT_TARGET})
|
|
|
|
|
|
|
|
# xt-xcc does not support -Og, so make it -O0
|
|
|
|
set(OPTIMIZE_FOR_DEBUG_FLAG "-O0")
|
|
|
|
|
|
|
|
set(CC xcc)
|
|
|
|
set(C++ xc++)
|
|
|
|
|
2018-11-02 00:46:00 +08:00
|
|
|
set(NOSYSDEF_CFLAG "")
|
|
|
|
|
2017-12-13 01:59:37 +08:00
|
|
|
list(APPEND TOOLCHAIN_C_FLAGS -fms-extensions)
|
2018-11-02 00:46:00 +08:00
|
|
|
|
|
|
|
# xcc doesn't have this, so we need to define it here.
|
|
|
|
# This is the same as in the xcc toolchain spec files.
|
|
|
|
list(APPEND TOOLCHAIN_C_FLAGS
|
|
|
|
-D__SIZEOF_LONG__=4
|
|
|
|
)
|
2019-01-09 21:47:25 +08:00
|
|
|
|
|
|
|
set(TOOLCHAIN_HAS_NEWLIB OFF CACHE BOOL "True if toolchain supports newlib")
|