1.. _toolchain_cadence_xcc: 2 3Cadence Tensilica Xtensa C/C++ Compiler (XCC) 4############################################# 5 6#. Obtain Tensilica Software Development Toolkit targeting the specific SoC 7 on hand. This usually contains two parts: 8 9 * The Xtensa Xplorer which contains the necessary executables and 10 libraries. 11 12 * A SoC-specific add-on to be installed on top of Xtensa Xplorer. 13 14 * This add-on allows the compiler to generate code for the SoC on hand. 15 16#. Install Xtensa Xplorer and then the SoC add-on. 17 18 * Follow the instruction from Cadence on how to install the SDK. 19 20 * Depending on the SDK, there are two set of compilers: 21 22 * GCC-based compiler: ``xt-xcc`` and its friends. 23 24 * Clang-based compiler: ``xt-clang`` and its friends. 25 26#. Make sure you have obtained a license to use the SDK, or has access to 27 a remote licensing server. 28 29#. :ref:`Set these environment variables <env_vars>`: 30 31 * Set :envvar:`ZEPHYR_TOOLCHAIN_VARIANT` to ``xcc`` or ``xt-clang``. 32 * Set :envvar:`XTENSA_TOOLCHAIN_PATH` to the toolchain installation 33 directory. 34 35 * There are two ways to specify the SoC ID and the SDK version to use. 36 They are mutually exclusive, and cannot be used together. 37 38 #. When building for a single SoC: 39 40 * Set :envvar:`XTENSA_CORE` to the SoC ID where application is being 41 targeted. 42 * Set :envvar:`TOOLCHAIN_VER` to the Xtensa SDK version. 43 44 #. When building for multiple SoCs, for each SoC and board combination: 45 46 * Set :envvar:`XTENSA_CORE_{normalized_board_target}` 47 to the SoC ID where application is being targeted. 48 * Set :envvar:`TOOLCHAIN_VAR_{normalized_board_target}` 49 to the Xtensa SDK version. 50 51#. For example, assuming the SDK is installed in ``/opt/xtensa``, and 52 using the SDK for application development on ``intel_adsp/ace15_mtpm``, 53 setup the environment using the two above mentioned ways: 54 55 #. Single SoC: 56 57 .. code-block:: console 58 59 # Linux 60 export ZEPHYR_TOOLCHAIN_VARIANT=xt-clang 61 export XTENSA_TOOLCHAIN_PATH=/opt/xtensa/XtDevTools/install/tools/ 62 export XTENSA_CORE=ace10_LX7HiFi4_2022_10 63 export TOOLCHAIN_VER=RI-2022.10-linux 64 65 #. Multiple SoCs: 66 67 .. code-block:: console 68 69 # Linux 70 export ZEPHYR_TOOLCHAIN_VARIANT=xt-clang 71 export XTENSA_TOOLCHAIN_PATH=/opt/xtensa/XtDevTools/install/tools/ 72 export TOOLCHAIN_VER_intel_adsp_ace15_mtpm=RI-2022.10-linux 73 export XTENSA_CORE_intel_adsp_ace15_mtpm=ace10_LX7HiFi4_2022_10 74 75#. To use Clang-based compiler: 76 77 * Set :envvar:`ZEPHYR_TOOLCHAIN_VARIANT` to ``xt-clang``. 78 79 * Note that the Clang-based compiler may contain an old LLVM bug which 80 results in the following error: 81 82 .. code-block:: console 83 84 /tmp/file.s: Assembler messages: 85 /tmp/file.s:20: Error: file number 1 already allocated 86 clang-3.9: error: Xtensa-as command failed with exit code 1 87 88 If this happens, set :envvar:`XCC_NO_G_FLAG` to ``1``. 89 90 * For example: 91 92 .. code-block:: console 93 94 # Linux 95 export XCC_NO_G_FLAG=1 96