cmake: Introduce optional Kconfig for toolchains
Allow a given toolchain to specify Kconfig options that might be relevant to a feature available in that toolchain. For example, the ARM embedded GNU toolchain supports two variants of newlib and you select the smaller one via a spec file. We can use a Kconfig option like HAS_NEWLIB_LIBC_NANO to convey that this feature is supported by that toolchain. We look for the toolchain Kconfig in ${TOOLCHAIN_KCONFIG_DIR}/Kconfig, and default TOOLCHAIN_KCONFIG_DIR to: ${TOOLCHAIN_ROOT}/cmake/toolchain/${ZEPHYR_TOOLCHAIN_VARIANT}) toolchain specific cmake files can override the default if needed. Additionally tweaked the zephyr/generic.cmake to use ${CMAKE_CURRENT_LIST_DIR} to reduce some duplication. Signed-off-by: Kumar Gala <kumar.gala@linaro.org> Signed-off-by: Sebastian Bøe <sebastian.boe@nordicsemi.no> Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
This commit is contained in:
parent
dcdc61cfdb
commit
2630fbaa75
6 changed files with 22 additions and 1 deletions
|
@ -45,6 +45,7 @@ source "subsys/Kconfig"
|
|||
|
||||
source "ext/Kconfig"
|
||||
|
||||
osource "$(TOOLCHAIN_KCONFIG_DIR)/Kconfig"
|
||||
|
||||
menu "Build and Link Features"
|
||||
|
||||
|
|
|
@ -63,6 +63,8 @@ endif()
|
|||
# Configure the toolchain based on what SDK/toolchain is in use.
|
||||
include(${TOOLCHAIN_ROOT}/cmake/toolchain/${ZEPHYR_TOOLCHAIN_VARIANT}/generic.cmake)
|
||||
|
||||
set_ifndef(TOOLCHAIN_KCONFIG_DIR ${TOOLCHAIN_ROOT}/cmake/toolchain/${ZEPHYR_TOOLCHAIN_VARIANT})
|
||||
|
||||
# Configure the toolchain based on what toolchain technology is used
|
||||
# (gcc, host-gcc etc.)
|
||||
include(${TOOLCHAIN_ROOT}/cmake/compiler/${COMPILER}/generic.cmake OPTIONAL)
|
||||
|
|
|
@ -48,6 +48,7 @@ set(ENV{ARCH_DIR} ${ARCH_DIR})
|
|||
set(ENV{DEVICETREE_CONF} ${DEVICETREE_CONF})
|
||||
set(ENV{DTS_POST_CPP} ${DTS_POST_CPP})
|
||||
set(ENV{DTS_ROOT_BINDINGS} "${DTS_ROOT_BINDINGS}")
|
||||
set(ENV{TOOLCHAIN_KCONFIG_DIR} "${TOOLCHAIN_KCONFIG_DIR}")
|
||||
|
||||
# Allow out-of-tree users to add their own Kconfig python frontend
|
||||
# targets by appending targets to the CMake list
|
||||
|
@ -90,6 +91,7 @@ foreach(kconfig_target
|
|||
SHIELD_AS_LIST=$ENV{SHIELD_AS_LIST}
|
||||
CMAKE_BINARY_DIR=$ENV{CMAKE_BINARY_DIR}
|
||||
ZEPHYR_TOOLCHAIN_VARIANT=${ZEPHYR_TOOLCHAIN_VARIANT}
|
||||
TOOLCHAIN_KCONFIG_DIR=${TOOLCHAIN_KCONFIG_DIR}
|
||||
ARCH_DIR=$ENV{ARCH_DIR}
|
||||
DEVICETREE_CONF=${DEVICETREE_CONF}
|
||||
DTS_POST_CPP=${DTS_POST_CPP}
|
||||
|
|
7
cmake/toolchain/gnuarmemb/Kconfig
Normal file
7
cmake/toolchain/gnuarmemb/Kconfig
Normal file
|
@ -0,0 +1,7 @@
|
|||
# GNU ARM Embedded Toolchain
|
||||
|
||||
# Copyright (c) 2020 Linaro Limited.
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
config TOOLCHAIN_GNUARMEMB
|
||||
def_bool y
|
7
cmake/toolchain/zephyr/0.11/Kconfig
Normal file
7
cmake/toolchain/zephyr/0.11/Kconfig
Normal file
|
@ -0,0 +1,7 @@
|
|||
# Zephyr 0.11 SDK Toolchain
|
||||
|
||||
# Copyright (c) 2020 Linaro Limited.
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
config TOOLCHAIN_ZEPHYR_0_11
|
||||
def_bool y
|
|
@ -4,4 +4,6 @@ if (NOT ZEPHYR_SDK_INSTALL_DIR)
|
|||
message(FATAL_ERROR "ZEPHYR_SDK_INSTALL_DIR must be set")
|
||||
endif()
|
||||
|
||||
include(${ZEPHYR_BASE}/cmake/toolchain/zephyr/${SDK_MAJOR_MINOR}/generic.cmake)
|
||||
include(${CMAKE_CURRENT_LIST_DIR}/${SDK_MAJOR_MINOR}/generic.cmake)
|
||||
|
||||
set(TOOLCHAIN_KCONFIG_DIR ${CMAKE_CURRENT_LIST_DIR}/${SDK_MAJOR_MINOR})
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue