kconfig: Drop support for specifying CROSS_COMPILE through Kconfig

When we move DT infront of Kconfig we are going to need access to a C
toolchain before Kconfig is evaluated. This means it will not be
possible to specify the toolchain used through Kconfig.

To deal with this we ...

Drop support for specifying CROSS_COMPILE through Kconfig. Still
available is the ability to specify CROSS_COMPILE through the
environment or through a CMake variable.

Signed-off-by: Sebastian Bøe <sebastian.boe@nordicsemi.no>
This commit is contained in:
Sebastian Bøe 2018-11-19 14:50:42 +01:00 committed by Anas Nashif
commit 8ba5aff8c0
4 changed files with 5 additions and 29 deletions

View file

@ -176,14 +176,6 @@ endmenu
menu "Compiler Options" menu "Compiler Options"
config CROSS_COMPILE
string "Cross-compiler tool prefix"
help
Same as running 'make CROSS_COMPILE=prefix-' but stored for
default make runs in this kernel build directory. You don't
need to set this unless you want the configured kernel build
directory to select the cross-compiler automatically.
config NATIVE_APPLICATION config NATIVE_APPLICATION
bool "Build as a native host application" bool "Build as a native host application"
help help

View file

@ -38,7 +38,7 @@ endif()
if(NOT ZEPHYR_TOOLCHAIN_VARIANT) if(NOT ZEPHYR_TOOLCHAIN_VARIANT)
if(DEFINED ENV{ZEPHYR_TOOLCHAIN_VARIANT}) if(DEFINED ENV{ZEPHYR_TOOLCHAIN_VARIANT})
set(ZEPHYR_TOOLCHAIN_VARIANT $ENV{ZEPHYR_TOOLCHAIN_VARIANT}) set(ZEPHYR_TOOLCHAIN_VARIANT $ENV{ZEPHYR_TOOLCHAIN_VARIANT})
elseif(CROSS_COMPILE OR CONFIG_CROSS_COMPILE OR (DEFINED ENV{CROSS_COMPILE})) elseif(CROSS_COMPILE OR (DEFINED ENV{CROSS_COMPILE}))
set(ZEPHYR_TOOLCHAIN_VARIANT cross-compile) set(ZEPHYR_TOOLCHAIN_VARIANT cross-compile)
endif() endif()
endif() endif()

View file

@ -10,27 +10,12 @@
# prefix. This interface is consisent with the other non-"Zephyr SDK" # prefix. This interface is consisent with the other non-"Zephyr SDK"
# toolchains. # toolchains.
# #
# It can be set from three sources, the KConfig option # It can be set from either the environment or from a CMake variable
# CONFIG_CROSS_COMPILE, the CMake var CROSS_COMPILE, or the env var # of the same name.
# CROSS_COMPILE.
# #
# The env var has the lowest precedence. # The env var has the lowest precedence.
#
# It is not clear what should have the highest precedence of a Kconfig
# option and a CMake var so an error is triggered if they are both
# defined, but are defined with different values.
if(CONFIG_CROSS_COMPILE AND CROSS_COMPILE) if((NOT (DEFINED CROSS_COMPILE)) AND (DEFINED ENV{CROSS_COMPILE}))
if(NOT (${CONFIG_CROSS_COMPILE} STREQUAL ${CROSS_COMPILE}))
message(FATAL_ERROR "The Kconfig and CMake var's must match when defined simultaneously:
CONFIG_CROSS_COMPILE: ${CONFIG_CROSS_COMPILE}
CROSS_COMPILE: ${CROSS_COMPILE}")
endif()
endif()
if(CONFIG_CROSS_COMPILE)
set(CROSS_COMPILE ${CONFIG_CROSS_COMPILE})
elseif(DEFINED ENV{CROSS_COMPILE})
set(CROSS_COMPILE $ENV{CROSS_COMPILE}) set(CROSS_COMPILE $ENV{CROSS_COMPILE})
endif() endif()

View file

@ -44,8 +44,7 @@ Follow these steps to use one of these toolchains.
export ZEPHYR_TOOLCHAIN_VARIANT=cross-compile export ZEPHYR_TOOLCHAIN_VARIANT=cross-compile
export CROSS_COMPILE=/usr/bin/arm-none-eabi- export CROSS_COMPILE=/usr/bin/arm-none-eabi-
You can also set ``CROSS_COMPILE`` as a CMake variable, or using the Kconfig You can also set ``CROSS_COMPILE`` as a CMake variable.
symbol :option:`CONFIG_CROSS_COMPILE`.
When using this option, all of your toolchain binaries must reside in the same When using this option, all of your toolchain binaries must reside in the same
directory and have a common file name prefix. The ``CROSS_COMPILE`` variable directory and have a common file name prefix. The ``CROSS_COMPILE`` variable