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>
diff --git a/Kconfig.zephyr b/Kconfig.zephyr
index 9a67bba..e142f6b 100644
--- a/Kconfig.zephyr
+++ b/Kconfig.zephyr
@@ -176,14 +176,6 @@
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
bool "Build as a native host application"
help
diff --git a/cmake/toolchain.cmake b/cmake/toolchain.cmake
index 109ba44..b6282d3 100644
--- a/cmake/toolchain.cmake
+++ b/cmake/toolchain.cmake
@@ -38,7 +38,7 @@
if(NOT ZEPHYR_TOOLCHAIN_VARIANT)
if(DEFINED 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)
endif()
endif()
diff --git a/cmake/toolchain/cross-compile.cmake b/cmake/toolchain/cross-compile.cmake
index 5d3fb68..c35d8be 100644
--- a/cmake/toolchain/cross-compile.cmake
+++ b/cmake/toolchain/cross-compile.cmake
@@ -10,27 +10,12 @@
# prefix. This interface is consisent with the other non-"Zephyr SDK"
# toolchains.
#
-# It can be set from three sources, the KConfig option
-# CONFIG_CROSS_COMPILE, the CMake var CROSS_COMPILE, or the env var
-# CROSS_COMPILE.
+# It can be set from either the environment or from a CMake variable
+# of the same name.
#
# 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 (${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})
+if((NOT (DEFINED CROSS_COMPILE)) AND (DEFINED ENV{CROSS_COMPILE}))
set(CROSS_COMPILE $ENV{CROSS_COMPILE})
endif()
diff --git a/doc/getting_started/toolchain_other_x_compilers.rst b/doc/getting_started/toolchain_other_x_compilers.rst
index d5f2cb9..6e5756b 100644
--- a/doc/getting_started/toolchain_other_x_compilers.rst
+++ b/doc/getting_started/toolchain_other_x_compilers.rst
@@ -44,8 +44,7 @@
export ZEPHYR_TOOLCHAIN_VARIANT=cross-compile
export CROSS_COMPILE=/usr/bin/arm-none-eabi-
- You can also set ``CROSS_COMPILE`` as a CMake variable, or using the Kconfig
- symbol :option:`CONFIG_CROSS_COMPILE`.
+ You can also set ``CROSS_COMPILE`` as a CMake variable.
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