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)
|
cmake: Toolchain abstraction: Abstraction of binary tools, foundation.
This forms the foundation for the abstraction of the binary tools,
where the following steps are taken:
- Move binary tool resolving, such as objcopy, objdump, readelf and
so forth, out of compiler definitions and place in a dedicated binary
tools folder with the binary tools supplier as subfolder, similar to
the compiler and linker directories.
- Create binary tool sets, gnu, host-gnu and llvm.
- Each toolchain selects the required set of binary tools by setting
BINTOOLS via its generic.cmake as it also does for compiler and linker.
The intent here is to abstract Zephyr's dependence on toolchains,
thus allowing for easier porting to other, perhaps commercial,
toolchains and/or usecases.
No functional change expected.
Signed-off-by: Danny Oerndrup <daor@demant.com>
2019-07-18 21:06:51 +08:00
|
|
|
set(BINTOOLS gnu)
|
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
|
2019-06-19 02:45:40 +08:00
|
|
|
# should use. Note that we can't use ARCH to distinguish between
|
2018-12-13 23:32:07 +08:00
|
|
|
# toolchains because choosing between iamcu and non-iamcu is dependent
|
|
|
|
# on Kconfig, not ARCH.
|
2019-10-08 02:34:29 +08:00
|
|
|
if("${ARCH}" STREQUAL "xtensa")
|
|
|
|
file(GLOB toolchain_paths ${TOOLCHAIN_HOME}/xtensa/*/*)
|
|
|
|
else()
|
|
|
|
file(GLOB toolchain_paths ${TOOLCHAIN_HOME}/*)
|
|
|
|
endif()
|
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)
|
2019-10-08 02:34:29 +08:00
|
|
|
|
|
|
|
get_filename_component(some_toolchain_root "${some_toolchain_path}" DIRECTORY)
|
2018-12-13 23:32:07 +08:00
|
|
|
get_filename_component(some_toolchain "${some_toolchain_path}" NAME)
|
|
|
|
|
|
|
|
set(CROSS_COMPILE_TARGET ${some_toolchain})
|
|
|
|
|
|
|
|
set(SYSROOT_TARGET ${CROSS_COMPILE_TARGET})
|
|
|
|
|
2019-10-08 02:34:29 +08:00
|
|
|
set(CROSS_COMPILE ${some_toolchain_root}/${CROSS_COMPILE_TARGET}/bin/${CROSS_COMPILE_TARGET}-)
|
|
|
|
set(SYSROOT_DIR ${some_toolchain_root}/${SYSROOT_TARGET}/${SYSROOT_TARGET})
|
2019-01-09 21:47:25 +08:00
|
|
|
set(TOOLCHAIN_HAS_NEWLIB ON CACHE BOOL "True if toolchain supports newlib")
|
2019-10-08 02:34:29 +08:00
|
|
|
|
|
|
|
unset(some_toolchain_root)
|
|
|
|
unset(some_toolchain)
|
2020-03-06 06:20:59 +08:00
|
|
|
|
|
|
|
message(STATUS "Found toolchain: xtools (${XTOOLS_TOOLCHAIN_PATH})")
|