1.. _toolchain_iar_arm:
2
3IAR Arm Toolchain
4#################
5
6#. Download and install a release of  `IAR Arm Toolchain`_ (EWARM/CXARM) on your host.
7
8.. note::
9   As of now, a Development version of the IAR build tools for Arm is required to work with Zephyr.
10   It is distributed to selected partners and customers for evaluation. If you are interested in being
11   part of this program, please send a request to the IAR FAE team at fae.emea@iar.com.
12
13#. Make sure you have :ref:`Zephyr SDK <toolchain_zephyr_sdk>` installed on your host.
14
15.. note::
16   A Zephyr SDK is used as a source of tools like device tree compiler (DTC), QEMU, etc… Even though
17   IAR Arm toolchain is used for Zephyr RTOS build, still the GNU preprocessor & GNU objcopy might
18   be used for some steps like device tree preprocessing and .bin file generation.
19
20#. :ref:`Set these environment variables <env_vars>`:
21
22   - Set :envvar:`ZEPHYR_TOOLCHAIN_VARIANT` to ``iar``.
23   - Set :envvar:`IAR_TOOLCHAIN_PATH` to the toolchain installation directory.
24
25#. The IAR Toolchain needs the :envvar:`IAR_LMS_BEARER_TOKEN` environment
26   variable to be set to a valid ``license bearer token``.
27
28For example:
29
30   .. code-block:: bash
31
32      # Linux (default installation path):
33      export IAR_TOOLCHAIN_PATH=/opt/iarsystems/bxarm/arm
34      export ZEPHYR_TOOLCHAIN_VARIANT=iar
35      export IAR_LMS_BEARER_TOKEN="<BEARER-TOKEN>"
36
37   .. code-block:: batch
38
39      # Windows:
40      set IAR_TOOLCHAIN_PATH=c:\<path>\arm
41      set ZEPHYR_TOOLCHAIN_VARIANT=iar
42      set IAR_LMS_BEARER_TOKEN="<BEARER-TOKEN>"
43
44.. note::
45
46   The IAR Toolchain uses ``ilink`` for linking. This is incompatible with Zephyr’s
47   linker script template, which works with GNU ld. Zephyr’s IAR Arm Toolchain depends on
48   Zephyr’s CMake linker script generator, which supports generating icf-files.
49   Basic icf-file support is in place, but there are still areas which are not fully
50   supported by the CMake linker script generator.
51
52.. note::
53
54   The IAR Toolchain uses the GNU Assembler which is distributed with the Zephyr SDK
55   for ``.S-files``.
56
57.. note::
58
59   Some Zephyr subsystems or modules may also contain C or assembly code that relies
60   on GNU intrinsics and have not yet been updated to work fully with ``iar``.
61
62.. _IAR Arm Toolchain: https://www.iar.com/products/architectures/arm/
63