Zephyr SDK

The Zephyr Software Development Kit (SDK) contains toolchains for each of Zephyr’s supported architectures. It also includes additional host tools, such as custom QEMU and OpenOCD.

Use of the Zephyr SDK is highly recommended and may even be required under certain conditions (for example, running tests in QEMU for some architectures).

Supported architectures

The Zephyr SDK supports the following target architectures:

  • ARC (32-bit and 64-bit; ARCv1, ARCv2, ARCv3)

  • ARM (32-bit and 64-bit; ARMv6, ARMv7, ARMv8; A/R/M Profiles)

  • MIPS (32-bit and 64-bit)

  • Nios II

  • RISC-V (32-bit and 64-bit; RV32I, RV32E, RV64I)

  • x86 (32-bit and 64-bit)

  • Xtensa

Installation bundle and variables

The Zephyr SDK bundle supports all major operating systems (Linux, macOS and Windows) and is delivered as a compressed file. The installation consists of extracting the file and running the included setup script. Additional OS-specific instructions are described in the sections below.

If no toolchain is selected, the build system looks for Zephyr SDK and uses the toolchain from there. You can enforce this by setting the environment variable ZEPHYR_TOOLCHAIN_VARIANT to zephyr.

If you install the Zephyr SDK outside any of the default locations (listed in the operating system specific instructions below) and you want automatic discovery of the Zephyr SDK, then you must register the Zephyr SDK in the CMake package registry by running the setup script. If you decide not to register the Zephyr SDK in the CMake registry, then the ZEPHYR_SDK_INSTALL_DIR can be used to point to the Zephyr SDK installation directory.

You can also set ZEPHYR_SDK_INSTALL_DIR to point to a directory containing multiple Zephyr SDKs, allowing for automatic toolchain selection. For example, you can set ZEPHYR_SDK_INSTALL_DIR to /company/tools, where the company/tools folder contains the following subfolders:

  • /company/tools/zephyr-sdk-0.13.2

  • /company/tools/zephyr-sdk-a.b.c

  • /company/tools/zephyr-sdk-x.y.z

This allows the Zephyr build system to choose the correct version of the SDK, while allowing multiple Zephyr SDKs to be grouped together at a specific path.

Zephyr SDK version compatibility

In general, the Zephyr SDK version referenced in this page should be considered the recommended version for the corresponding Zephyr version.

For the full list of compatible Zephyr and Zephyr SDK versions, refer to the Zephyr SDK Version Compatibility Matrix.

Zephyr SDK installation

Note

You can change 0.16.5 to another version in the instructions below if needed; the Zephyr SDK Releases page contains all available SDK releases.

Note

If you want to uninstall the SDK, you may simply remove the directory where you installed it.

  1. Download and verify the Zephyr SDK bundle:

    cd ~
    wget https://github.com/zephyrproject-rtos/sdk-ng/releases/download/v0.16.5/zephyr-sdk-0.16.5_linux-x86_64.tar.xz
    wget -O - https://github.com/zephyrproject-rtos/sdk-ng/releases/download/v0.16.5/sha256.sum | shasum --check --ignore-missing

    If your host architecture is 64-bit ARM (for example, Raspberry Pi), replace x86_64 with aarch64 in order to download the 64-bit ARM Linux SDK.

  2. Extract the Zephyr SDK bundle archive:

    tar xvf zephyr-sdk-0.16.5_linux-x86_64.tar.xz

    Note

    It is recommended to extract the Zephyr SDK bundle at one of the following locations:

    • $HOME

    • $HOME/.local

    • $HOME/.local/opt

    • $HOME/bin

    • /opt

    • /usr/local

    The Zephyr SDK bundle archive contains the zephyr-sdk-<version> directory and, when extracted under $HOME, the resulting installation path will be $HOME/zephyr-sdk-<version>.

  3. Run the Zephyr SDK bundle setup script:

    cd zephyr-sdk-0.16.5
    ./setup.sh

    Note

    You only need to run the setup script once after extracting the Zephyr SDK bundle.

    You must rerun the setup script if you relocate the Zephyr SDK bundle directory after the initial setup.

  4. Install udev rules, which allow you to flash most Zephyr boards as a regular user:

    sudo cp ~/zephyr-sdk-0.16.5/sysroots/x86_64-pokysdk-linux/usr/share/openocd/contrib/60-openocd.rules /etc/udev/rules.d
    sudo udevadm control --reload