doc: toolchain: add a few words about XCC

This adds a few words about setting up XCC.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
This commit is contained in:
Daniel Leung 2022-02-01 16:00:48 -08:00 committed by Anas Nashif
commit 6964f2b130

View file

@ -210,6 +210,84 @@ You can build toolchains from source code using crosstool-NG.
$ echo $XTOOLS_TOOLCHAIN_PATH
/Volumes/CrossToolNGNew/build/output/
Cadence Tensilica Xtensa C/C++ Compiler (XCC)
*********************************************
#. Obtain Tensilica Software Development Toolkit targeting the specific SoC
on hand. This usually contains two parts:
* The Xtensa Xplorer which contains the necessary executables and
libraries.
* A SoC-specific add-on to be installed on top of Xtensa Xplorer.
* This add-on allows the compiler to generate code for the SoC on hand.
#. Install Xtensa Xplorer and then the SoC add-on.
* Follow the instruction from Cadence on how to install the SDK.
* Depending on the SDK, there are two set of compilers:
* GCC-based compiler: ``xt-xcc`` and its friends.
* Clang-based compiler: ``xt-clang`` and its friends.
* By default, Zephyr would use GCC-based ``xt-xcc``.
#. Make sure you have obtained a license to use the SDK, or has access to
a remote licensing server.
#. :ref:`Set these environment variables <env_vars>`:
* Set :envvar:`ZEPHYR_TOOLCHAIN_VARIANT` to ``xcc``.
* Set :envvar:`XTENSA_TOOLCHAIN_PATH` to the toolchain installation
directory.
* Set :envvar:`XTENSA_CORE` to the SoC ID where application is being
targeting.
* Set :envvar:`TOOLCHAIN_VER` to the Xtensa SDK version.
#. For example, assuming the SDK is installed in ``/opt/xtensa``, and
using the SDK for application development on ``intel_s1000_crb``,
setup the environment using:
.. code-block:: console
# Linux
export ZEPHYR_TOOLCHAIN_VARIANT=xcc
export XTENSA_TOOLCHAIN_PATH=/opt/xtensa/XtDevTools/install/tools/
export XTENSA_CORE=X6H3SUE_RI_2018_0
export TOOLCHAIN_VER=RI-2018.0-linux
#. To use Clang-based compiler:
* Set :envvar:`XCC_USE_CLANG` to ``1``.
* For example:
.. code-block:: console
# Linux
export XCC_USE_CLANG=1
* Note that the Clang-based compiler may contain an old LLVM bug which
results in the following error:
.. code-block:: console
/tmp/file.s: Assembler messages:
/tmp/file.s:20: Error: file number 1 already allocated
clang-3.9: error: Xtensa-as command failed with exit code 1
If this happens, set :envvar:`XCC_NO_G_FLAG` to ``1``.
* For example:
.. code-block:: console
# Linux
export XCC_NO_G_FLAG=1
.. _GNU Arm Embedded: https://developer.arm.com/open-source/gnu-toolchain/gnu-rm
.. _crosstool-ng site: http://crosstool-ng.org
.. _Arm Compiler 6: https://developer.arm.com/tools-and-software/embedded/arm-compiler/downloads/version-6