2019-04-06 21:08:09 +08:00
|
|
|
# SPDX-License-Identifier: Apache-2.0
|
|
|
|
|
2018-12-13 23:32:07 +08:00
|
|
|
set_ifndef(XTOOLS_TOOLCHAIN_PATH "$ENV{XTOOLS_TOOLCHAIN_PATH}")
|
|
|
|
set( XTOOLS_TOOLCHAIN_PATH ${XTOOLS_TOOLCHAIN_PATH} CACHE PATH "")
|
|
|
|
assert( XTOOLS_TOOLCHAIN_PATH "XTOOLS_TOOLCHAIN_PATH is not set")
|
|
|
|
|
|
|
|
set(TOOLCHAIN_HOME ${XTOOLS_TOOLCHAIN_PATH})
|
|
|
|
|
|
|
|
set(COMPILER gcc)
|
2019-04-25 20:22:00 +08:00
|
|
|
set(LINKER ld)
|
2018-12-13 23:32:07 +08:00
|
|
|
|
|
|
|
# Choose one of the toolchains in 'TOOLCHAIN_HOME' at random to use as
|
|
|
|
# a 'generic' toolchain until we know for sure which toolchain we
|
|
|
|
# should use. Note that we can't use ARCH to distingush between
|
|
|
|
# toolchains because choosing between iamcu and non-iamcu is dependent
|
|
|
|
# on Kconfig, not ARCH.
|
|
|
|
file(GLOB toolchain_paths ${TOOLCHAIN_HOME}/*)
|
2019-02-23 12:42:37 +08:00
|
|
|
list(REMOVE_ITEM toolchain_paths ${TOOLCHAIN_HOME}/sources)
|
2018-12-13 23:32:07 +08:00
|
|
|
list(GET toolchain_paths 0 some_toolchain_path)
|
|
|
|
get_filename_component(some_toolchain "${some_toolchain_path}" NAME)
|
|
|
|
|
|
|
|
set(CROSS_COMPILE_TARGET ${some_toolchain})
|
|
|
|
|
|
|
|
set(SYSROOT_TARGET ${CROSS_COMPILE_TARGET})
|
|
|
|
|
|
|
|
set(CROSS_COMPILE ${TOOLCHAIN_HOME}/${CROSS_COMPILE_TARGET}/bin/${CROSS_COMPILE_TARGET}-)
|
|
|
|
set(SYSROOT_DIR ${TOOLCHAIN_HOME}/${SYSROOT_TARGET}/${SYSROOT_TARGET})
|
2019-01-09 21:47:25 +08:00
|
|
|
set(TOOLCHAIN_HAS_NEWLIB ON CACHE BOOL "True if toolchain supports newlib")
|