2019-04-06 21:08:09 +08:00
|
|
|
# SPDX-License-Identifier: Apache-2.0
|
|
|
|
|
2018-01-09 00:06:42 +08:00
|
|
|
# CROSS_COMPILE is a KBuild mechanism for specifying an external
|
|
|
|
# toolchain with a single environment variable.
|
|
|
|
#
|
|
|
|
# It is a legacy mechanism that will in Zephyr translate to
|
2018-02-12 04:36:21 +08:00
|
|
|
# specififying ZEPHYR_TOOLCHAIN_VARIANT to 'cross-compile' with the location
|
2018-01-09 00:06:42 +08:00
|
|
|
# 'CROSS_COMPILE'.
|
|
|
|
#
|
2018-02-12 04:36:21 +08:00
|
|
|
# New users should set the env var 'ZEPHYR_TOOLCHAIN_VARIANT' to
|
2018-01-09 00:06:42 +08:00
|
|
|
# 'cross-compile' and the 'CROSS_COMPILE' env var to the toolchain
|
2019-06-19 02:45:40 +08:00
|
|
|
# prefix. This interface is consistent with the other non-"Zephyr SDK"
|
2018-01-09 00:06:42 +08:00
|
|
|
# toolchains.
|
|
|
|
#
|
2018-11-19 21:50:42 +08:00
|
|
|
# It can be set from either the environment or from a CMake variable
|
|
|
|
# of the same name.
|
2018-01-09 00:06:42 +08:00
|
|
|
#
|
|
|
|
# The env var has the lowest precedence.
|
|
|
|
|
2018-11-19 21:50:42 +08:00
|
|
|
if((NOT (DEFINED CROSS_COMPILE)) AND (DEFINED ENV{CROSS_COMPILE}))
|
2018-01-09 00:06:42 +08:00
|
|
|
set(CROSS_COMPILE $ENV{CROSS_COMPILE})
|
|
|
|
endif()
|
|
|
|
|
|
|
|
set( CROSS_COMPILE ${CROSS_COMPILE} CACHE PATH "")
|
|
|
|
assert(CROSS_COMPILE "CROSS_COMPILE is not set")
|
|
|
|
|
|
|
|
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)
|
2020-03-06 06:20:59 +08:00
|
|
|
|
|
|
|
message(STATUS "Found toolchain: cross-compile (${CROSS_COMPILE})")
|