# Zephyr RTOS minimal development environment

When I started developing for the Zephyr OS the first time I followed the project’s Getting Started Guide. It is easy to follow and will get you started quickly.
But now I needed something different!

Here’s another way, not officially documented, to create the minimal development environment I was looking for (only the necessary tools and source code are installed).

## Goal

Setup a custom Zephyr development environment with minimal footprint (<1GB incl SDK and workspace)

## Minimal Zephyr SDK

A full Zephyr SDK, installed by the steps of the [Getting Started Guide, contains the toolchains for all the supported architectures. most of which I (and probably you) will never use. In total they end up using some 5 to 6GB (with the latest versions of the SDK being also the more space hungry).

On the other end, a minimal SDK starts with an almost empty folder. Any needed toolchain is added manually. This way the disk used can be as low as 100-200MB.

Here how to do it (on Linux).

### SDK bundle

Download the desired version of the “minimal bundle” from the Zephyr SDK release page:

# replace 0.15.1 with the desired version
tar xvf zephyr-sdk-0.15.1_linux-x86_64_minimal.tar.gz


### Toolchain(s)

Most of my projects run non ARM microcontrollers so I will install just the toolchain for arm-zephyr-eabi:

cd zephyr-sdk-0.15.1
tar xvf toolchain_linux-x86_64_arm-zephyr-eabi.tar.gz
rm toolchain_linux-x86_64_arm-zephyr-eabi.tar.gz


### Host Tools

The odds are that, on top of building and flashing an application, a developer wants also to debug or simulate it. The Zephyr SDK provides a set of Host Tools for that, which include OpenOCD, QEMU and few others.

cd zephyr-sdk-0.15.1
tar xvf hosttools_linux-x86_64.tar.gz

# run it
./zephyr-sdk-x86_64-hosttools-standalone-0.9.sh


LOCATION I prefer to install the hosttools locally to the Zephyr SDK (instead of the default /opt/.. on Linux). This is advantageous if you need to use more than one SDK but, if not on the PATH, the full path to the binaries shall be provided. See [Zephyr workflow in VSCode])

## Minimal Zephyr source (via west Manifest)

Another area of optimization is the codebase any Zephyr workspace is initialized to. By default (see Getting Started Guide) the source code for zephyr, bootloader, tools and all modules are installed, using the manifest file from the remote default Zephyr repository. The entire codebase totals at around 3.7GB.

A valid alternative to the default manifest, is a custom one, eventually stored locally in the workspace.

NOTE: the manifest shall be stored in a workspace subfolder (e.g. zephyrproject/manifest)

The manifest will include for download only the source code for the modules that we really need (and of course the core Zephyr source)

Since I develop for STM32 a minimal manifest in my case looks like this:

manifest:

remotes:
- name: zephyr
url-base: https://github.com/zephyrproject-rtos

projects:
- name: zephyr
remote: zephyr
repo-path: zephyr
revision: main
import:
name-allowlist:
- cmsis
- hal_stm32


Tags:

Updated: