build: deprecate ZEPHYR_GCC_VARIANT

We want to support other toolchain not based on GCC, so the variable is
confusing, use ZEPHYR_TOOLCHAIN_VARIANT instead.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
This commit is contained in:
Anas Nashif 2018-02-11 14:36:21 -06:00 committed by Andrew Boie
commit 7ee8bb9677
16 changed files with 46 additions and 37 deletions

View file

@ -8,7 +8,7 @@ env:
- SANITYCHECK_OPTIONS=" --inline-logs" - SANITYCHECK_OPTIONS=" --inline-logs"
- SANITYCHECK_OPTIONS_RETRY="${SANITYCHECK_OPTIONS} --only-failed --outdir=out-2nd-pass" - SANITYCHECK_OPTIONS_RETRY="${SANITYCHECK_OPTIONS} --only-failed --outdir=out-2nd-pass"
- ZEPHYR_SDK_INSTALL_DIR=/opt/sdk/zephyr-sdk-0.9.2 - ZEPHYR_SDK_INSTALL_DIR=/opt/sdk/zephyr-sdk-0.9.2
- ZEPHYR_GCC_VARIANT=zephyr - ZEPHYR_TOOLCHAIN_VARIANT=zephyr
- MATRIX_BUILDS="4" - MATRIX_BUILDS="4"
- MATRIX_BUILDS_EXTRA="4" - MATRIX_BUILDS_EXTRA="4"
matrix: matrix:

View file

@ -234,7 +234,7 @@ else() # GCC assumed
-Wno-unused-but-set-variable -Wno-unused-but-set-variable
-fno-reorder-functions -fno-reorder-functions
) )
if(NOT ${ZEPHYR_GCC_VARIANT} STREQUAL "xcc") if(NOT ${ZEPHYR_TOOLCHAIN_VARIANT} STREQUAL "xcc")
zephyr_cc_option(-fno-defer-pop) zephyr_cc_option(-fno-defer-pop)
endif() endif()
endif() endif()

View file

@ -17,4 +17,4 @@ an application.
To setup the build system with the correct toolchain use:: To setup the build system with the correct toolchain use::
export RISCV32_TOOLCHAIN_PATH=~/path/to/pulpino/toolchain export RISCV32_TOOLCHAIN_PATH=~/path/to/pulpino/toolchain
export ZEPHYR_GCC_VARIANT=riscv32 export ZEPHYR_TOOLCHAIN_VARIANT=riscv32

View file

@ -64,13 +64,13 @@ Set up build environment
With both the toolchain and SDK installed, the Zephyr build system must be With both the toolchain and SDK installed, the Zephyr build system must be
instructed to use this particular variant by setting the instructed to use this particular variant by setting the
``ZEPHYR_GCC_VARIANT`` shell variable. Two other environment variables ``ZEPHYR_TOOLCHAIN_VARIANT`` shell variable. Two other environment variables
should also be set, pointing to, respectively, the path where ESP-IDF can be should also be set, pointing to, respectively, the path where ESP-IDF can be
located, and where the toolchain has been installed: located, and where the toolchain has been installed:
.. code-block:: console .. code-block:: console
export ZEPHYR_GCC_VARIANT="espressif" export ZEPHYR_TOOLCHAIN_VARIANT="espressif"
export ESP_IDF_PATH="/path/to/esp-idf" export ESP_IDF_PATH="/path/to/esp-idf"
export ESPRESSIF_TOOLCHAIN_PATH="/path/to/xtensa-esp32-elf/" export ESPRESSIF_TOOLCHAIN_PATH="/path/to/xtensa-esp32-elf/"

View file

@ -81,7 +81,7 @@ You can use the following code to create that file:
then then
export ARCH=xtensa export ARCH=xtensa
export BOARD=xt-sim export BOARD=xt-sim
export ZEPHYR_GCC_VARIANT=xcc export ZEPHYR_TOOLCHAIN_VARIANT=xcc
export XTENSA_TOOLS_PATH=/opt/xtensa/XtDevTools/install/tools/RG-2016.4-linux/XtensaTools export XTENSA_TOOLS_PATH=/opt/xtensa/XtDevTools/install/tools/RG-2016.4-linux/XtensaTools
export XTENSA_BUILDS_PATH=/opt/xtensa/XtDevTools/install/builds/RG-2016.4-linux export XTENSA_BUILDS_PATH=/opt/xtensa/XtDevTools/install/builds/RG-2016.4-linux
#export XTENSA_BUILD_DIR= #Keep empty to use default directory #export XTENSA_BUILD_DIR= #Keep empty to use default directory
@ -90,13 +90,13 @@ You can use the following code to create that file:
then then
export ARCH=xtensa export ARCH=xtensa
export BOARD=qemu export BOARD=qemu
export ZEPHYR_GCC_VARIANT=zephyr export ZEPHYR_TOOLCHAIN_VARIANT=zephyr
export ZEPHYR_SDK_INSTALL_DIR=/opt/xtensa/zephyr-sdk-64-INTERNAL-11-22-2016 export ZEPHYR_SDK_INSTALL_DIR=/opt/xtensa/zephyr-sdk-64-INTERNAL-11-22-2016
elif test "${CROSS}" = zephyr-x86 elif test "${CROSS}" = zephyr-x86
then then
export ARCH=x86 export ARCH=x86
export BOARD=qemu_x86 export BOARD=qemu_x86
export ZEPHYR_GCC_VARIANT=zephyr export ZEPHYR_TOOLCHAIN_VARIANT=zephyr
export ZEPHYR_SDK_INSTALL_DIR=/opt/xtensa/zephyr-sdk-64-INTERNAL-11-22-2016 export ZEPHYR_SDK_INSTALL_DIR=/opt/xtensa/zephyr-sdk-64-INTERNAL-11-22-2016
else else
echo "Unsupported compiler '${CROSS}' defined by environment variable CROSS" echo "Unsupported compiler '${CROSS}' defined by environment variable CROSS"

View file

@ -952,7 +952,7 @@ function(print arg)
endfunction() endfunction()
# Usage: # Usage:
# assert(ZEPHYR_GCC_VARIANT "ZEPHYR_GCC_VARIANT not set.") # assert(ZEPHYR_TOOLCHAIN_VARIANT "ZEPHYR_TOOLCHAIN_VARIANT not set.")
# #
# will cause a FATAL_ERROR and print an error message if the first # will cause a FATAL_ERROR and print an error message if the first
# expression is false # expression is false

View file

@ -2,10 +2,10 @@
# toolchain with a single environment variable. # toolchain with a single environment variable.
# #
# It is a legacy mechanism that will in Zephyr translate to # It is a legacy mechanism that will in Zephyr translate to
# specififying ZEPHYR_GCC_VARIANT to 'cross-compile' with the location # specififying ZEPHYR_TOOLCHAIN_VARIANT to 'cross-compile' with the location
# 'CROSS_COMPILE'. # 'CROSS_COMPILE'.
# #
# New users should set the env var 'ZEPHYR_GCC_VARIANT' to # New users should set the env var 'ZEPHYR_TOOLCHAIN_VARIANT' to
# 'cross-compile' and the 'CROSS_COMPILE' env var to the toolchain # 'cross-compile' and the 'CROSS_COMPILE' env var to the toolchain
# prefix. This interface is consisent with the other non-"Zephyr SDK" # prefix. This interface is consisent with the other non-"Zephyr SDK"
# toolchains. # toolchains.

View file

@ -8,23 +8,29 @@ set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY) set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)
if(NOT ZEPHYR_GCC_VARIANT) # Until we completely deprecate it
if(DEFINED ENV{ZEPHYR_GCC_VARIANT}) if(DEFINED ENV{ZEPHYR_GCC_VARIANT})
set(ZEPHYR_GCC_VARIANT $ENV{ZEPHYR_GCC_VARIANT}) message(WARNING "ZEPHYR_GCC_VARIANT is deprecated, please use ZEPHYR_TOOLCHAIN_VARIANT instead")
elseif(CROSS_COMPILE OR CONFIG_CROSS_COMPILE OR (DEFINED ENV{CROSS_COMPILE})) set(ZEPHYR_TOOLCHAIN_VARIANT $ENV{ZEPHYR_GCC_VARIANT})
set(ZEPHYR_GCC_VARIANT cross-compile)
endif() endif()
endif()
set(ZEPHYR_GCC_VARIANT ${ZEPHYR_GCC_VARIANT} CACHE STRING "Zephyr GCC variant")
assert(ZEPHYR_GCC_VARIANT "Zephyr GCC variant invalid: please set the ZEPHYR_GCC_VARIANT-variable")
if(CONFIG_ARCH_POSIX OR (ZEPHYR_GCC_VARIANT STREQUAL "host")) 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}))
set(ZEPHYR_TOOLCHAIN_VARIANT cross-compile)
endif()
endif()
set(ZEPHYR_TOOLCHAIN_VARIANT ${ZEPHYR_TOOLCHAIN_VARIANT} CACHE STRING "Zephyr toolchain variant")
assert(ZEPHYR_TOOLCHAIN_VARIANT "Zephyr toolchain variant invalid: please set the ZEPHYR_TOOLCHAIN_VARIANT-variable")
if(CONFIG_ARCH_POSIX OR (ZEPHYR_TOOLCHAIN_VARIANT STREQUAL "host"))
set(COMPILER host-gcc) set(COMPILER host-gcc)
endif() endif()
# Configure the toolchain based on what SDK/toolchain is in use. # Configure the toolchain based on what SDK/toolchain is in use.
if(NOT (COMPILER STREQUAL "host-gcc")) if(NOT (COMPILER STREQUAL "host-gcc"))
include(${ZEPHYR_BASE}/cmake/toolchain-${ZEPHYR_GCC_VARIANT}.cmake) include(${ZEPHYR_BASE}/cmake/toolchain-${ZEPHYR_TOOLCHAIN_VARIANT}.cmake)
endif() endif()
# Configure the toolchain based on what toolchain technology is used # Configure the toolchain based on what toolchain technology is used

View file

@ -55,7 +55,7 @@ Our documentation processing has been tested to run with:
Begin by cloning a copy of the git repository for the zephyr project and Begin by cloning a copy of the git repository for the zephyr project and
setting up your development environment as described in :ref:`getting_started` setting up your development environment as described in :ref:`getting_started`
or specifically for Ubuntu in :ref:`installation_linux`. (Be sure to or specifically for Ubuntu in :ref:`installation_linux`. (Be sure to
export the environment variables ``ZEPHYR_GCC_VARIANT`` and export the environment variables ``ZEPHYR_TOOLCHAIN_VARIANT`` and
``ZEPHYR_SDK_INSTALL_DIR`` as documented there.) ``ZEPHYR_SDK_INSTALL_DIR`` as documented there.)
Other than ``doxygen``, the documentation tools should be installed using ``pip``. Other than ``doxygen``, the documentation tools should be installed using ``pip``.

View file

@ -92,12 +92,15 @@ To build an example application follow these steps:
# On Linux/macOS # On Linux/macOS
export ZEPHYR_GCC_VARIANT=zephyr export ZEPHYR_TOOLCHAIN_VARIANT=zephyr
export ZEPHYR_SDK_INSTALL_DIR=<sdk installation directory> export ZEPHYR_SDK_INSTALL_DIR=<sdk installation directory>
# On Windows # On Windows
set ZEPHYR_GCC_VARIANT=zephyr set ZEPHYR_TOOLCHAIN_VARIANT=zephyr
set ZEPHYR_SDK_INSTALL_DIR=<sdk installation directory> set ZEPHYR_SDK_INSTALL_DIR=<sdk installation directory>
.. note:: In previous releases of Zephyr, the ``ZEPHYR_TOOLCHAIN_VARIANT``
variable was called ``ZEPHYR_GCC_VARIANT``.
#. Navigate to the main project directory: #. Navigate to the main project directory:
.. code-block:: console .. code-block:: console
@ -182,12 +185,12 @@ must be installed.
.. code-block:: console .. code-block:: console
# On Linux/macOS # On Linux/macOS
unset ZEPHYR_GCC_VARIANT unset ZEPHYR_TOOLCHAIN_VARIANT
unset ZEPHYR_SDK_INSTALL_DIR unset ZEPHYR_SDK_INSTALL_DIR
cd <zephyr git clone location> cd <zephyr git clone location>
source zephyr-env.sh source zephyr-env.sh
# On Windows # On Windows
set ZEPHYR_GCC_VARIANT= set ZEPHYR_TOOLCHAIN_VARIANT=
set ZEPHYR_SDK_INSTALL_DIR= set ZEPHYR_SDK_INSTALL_DIR=
cd <zephyr git clone location> cd <zephyr git clone location>
zephyr-env.cmd zephyr-env.cmd
@ -234,10 +237,10 @@ without the Zephyr SDK`_ for details.
# On Linux/macOS # On Linux/macOS
export GCCARMEMB_TOOLCHAIN_PATH="~/gcc-arm-none-eabi-5_3-2016q1/" export GCCARMEMB_TOOLCHAIN_PATH="~/gcc-arm-none-eabi-5_3-2016q1/"
export ZEPHYR_GCC_VARIANT=gccarmemb export ZEPHYR_TOOLCHAIN_VARIANT=gccarmemb
# On Windows # On Windows
set GCCARMEMB_TOOLCHAIN_PATH="%userprofile%\gcc-arm-none-eabi-5_3-2016q1\" set GCCARMEMB_TOOLCHAIN_PATH="%userprofile%\gcc-arm-none-eabi-5_3-2016q1\"
set ZEPHYR_GCC_VARIANT=gccarmemb set ZEPHYR_TOOLCHAIN_VARIANT=gccarmemb
.. zephyr-app-commands:: .. zephyr-app-commands::
:zephyr-app: samples/hello_world :zephyr-app: samples/hello_world

View file

@ -153,7 +153,7 @@ Follow these steps to install the SDK on your Linux host system.
.. code-block:: console .. code-block:: console
export ZEPHYR_GCC_VARIANT=zephyr export ZEPHYR_TOOLCHAIN_VARIANT=zephyr
export ZEPHYR_SDK_INSTALL_DIR=<sdk installation directory> export ZEPHYR_SDK_INSTALL_DIR=<sdk installation directory>
To use the same toolchain in new sessions in the future you can set the To use the same toolchain in new sessions in the future you can set the
@ -162,7 +162,7 @@ Follow these steps to install the SDK on your Linux host system.
.. code-block:: console .. code-block:: console
cat <<EOF > ~/.zephyrrc cat <<EOF > ~/.zephyrrc
export ZEPHYR_GCC_VARIANT=zephyr export ZEPHYR_TOOLCHAIN_VARIANT=zephyr
export ZEPHYR_SDK_INSTALL_DIR=/opt/zephyr-sdk export ZEPHYR_SDK_INSTALL_DIR=/opt/zephyr-sdk
EOF EOF

View file

@ -237,7 +237,7 @@ and use the target location where the toolchain was installed, type:
.. code-block:: console .. code-block:: console
export ZEPHYR_GCC_VARIANT=xtools export ZEPHYR_TOOLCHAIN_VARIANT=xtools
export XTOOLS_TOOLCHAIN_PATH=/Volumes/CrossToolNG/x-tools export XTOOLS_TOOLCHAIN_PATH=/Volumes/CrossToolNG/x-tools
@ -248,7 +248,7 @@ variables in the file :file:`${HOME}/.zephyrrc`, for example:
cat <<EOF > ~/.zephyrrc cat <<EOF > ~/.zephyrrc
export XTOOLS_TOOLCHAIN_PATH=/Volumes/CrossToolNG/x-tools export XTOOLS_TOOLCHAIN_PATH=/Volumes/CrossToolNG/x-tools
export ZEPHYR_GCC_VARIANT=xtools export ZEPHYR_TOOLCHAIN_VARIANT=xtools
EOF EOF
.. _Homebrew site: http://brew.sh/ .. _Homebrew site: http://brew.sh/

View file

@ -122,7 +122,7 @@ packages from their respective websites.
.. code-block:: console .. code-block:: console
set ZEPHYR_GCC_VARIANT=issm set ZEPHYR_TOOLCHAIN_VARIANT=issm
set ISSM_INSTALLATION_PATH=c:\issm0-toolchain-windows-2017-01-25 set ISSM_INSTALLATION_PATH=c:\issm0-toolchain-windows-2017-01-25
Use the path where you extracted the ISSM toolchain. Use the path where you extracted the ISSM toolchain.
@ -131,7 +131,7 @@ packages from their respective websites.
.. code-block:: console .. code-block:: console
set ZEPHYR_GCC_VARIANT=gccarmemb set ZEPHYR_TOOLCHAIN_VARIANT=gccarmemb
set GCCARMEMB_TOOLCHAIN_PATH=c:\gccarmemb set GCCARMEMB_TOOLCHAIN_PATH=c:\gccarmemb
To use the same toolchain in new sessions in the future you can set the To use the same toolchain in new sessions in the future you can set the
@ -281,7 +281,7 @@ environment for Windows. Follow the steps below to set it up:
.. code-block:: console .. code-block:: console
export ZEPHYR_GCC_VARIANT=issm export ZEPHYR_TOOLCHAIN_VARIANT=issm
export ISSM_INSTALLATION_PATH=/c/issm0-toolchain-windows-2017-01-25 export ISSM_INSTALLATION_PATH=/c/issm0-toolchain-windows-2017-01-25
Use the path where you extracted the ISSM toolchain. Use the path where you extracted the ISSM toolchain.
@ -290,7 +290,7 @@ environment for Windows. Follow the steps below to set it up:
.. code-block:: console .. code-block:: console
export ZEPHYR_GCC_VARIANT=gccarmemb export ZEPHYR_TOOLCHAIN_VARIANT=gccarmemb
export GCCARMEMB_TOOLCHAIN_PATH=/c/gccarmemb export GCCARMEMB_TOOLCHAIN_PATH=/c/gccarmemb
And for either, run the provided script to set up zephyr project specific And for either, run the provided script to set up zephyr project specific

View file

@ -191,7 +191,7 @@ arch:
Architecture of the board Architecture of the board
toolchain: toolchain:
The list of supported toolchains that can build this board. This should match The list of supported toolchains that can build this board. This should match
one of the values used for 'ZEPHYR_GCC_VARIANT' when building on the command line one of the values used for 'ZEPHYR_TOOLCHAIN_VARIANT' when building on the command line
ram: ram:
Available RAM on the board (specified in KB). This is used to match testcase Available RAM on the board (specified in KB). This is used to match testcase
requirements. If not specified we default to 128KB. requirements. If not specified we default to 128KB.

View file

@ -2,7 +2,7 @@ zephyr_library()
zephyr_library_sources(libc-hooks.c) zephyr_library_sources(libc-hooks.c)
# LIBC_*_DIR may or may not have been set by the toolchain. E.g. when # LIBC_*_DIR may or may not have been set by the toolchain. E.g. when
# using ZEPHYR_GCC_VARIANT=cross-compile it will be either up to the # using ZEPHYR_TOOLCHAIN_VARIANT=cross-compile it will be either up to the
# toolchain to know where it's libc implementation is, or if it is # toolchain to know where it's libc implementation is, or if it is
# unable to, it will be up to the user to specify LIBC_*_DIR vars to # unable to, it will be up to the user to specify LIBC_*_DIR vars to
# point to a newlib implementation. # point to a newlib implementation.

View file

@ -1544,7 +1544,7 @@ class TestSuite:
def apply_filters(self): def apply_filters(self):
toolchain = os.environ.get("ZEPHYR_GCC_VARIANT", None) toolchain = os.environ.get("ZEPHYR_TOOLCHAIN_VARIANT", None)
instances = [] instances = []
discards = {} discards = {}
platform_filter = options.platform platform_filter = options.platform