Getting Started with Zephyr

What is Zephyr OS?

Zephyr is a scalable, open-source real-time operating system (RTOS) designed for resource-constrained devices. It is developed under the Linux Foundation and supports multiple architectures including ARM, x86, RISC-V, and more.

Key Features

  • Small footprint: Designed for devices with limited memory
  • Multi-architecture support: ARM Cortex-M, RISC-V, x86, ARC, Xtensa, and more
  • Security-focused: Built-in support for TrustZone, secure boot, and cryptographic libraries
  • Connectivity: Native support for Bluetooth LE, Thread, Wi-Fi, LoRaWAN, and other protocols
  • Real-time: Deterministic kernel with configurable scheduling algorithms
  • Modular: Only include what you need in your build
  • Active community: Backed by major companies (Intel, Nordic, NXP, STMicroelectronics, etc.)

Installation Procedure

Fedora / RHEL-based

The official Zephyr documentation only provides installation instructions for Ubuntu. Here are the equivalent dependencies for Fedora, RHEL, CentOS, Rocky Linux, and other DNF-based distributions:

sudo dnf install git cmake ninja-build gperf ccache dfu-util dtc wget \
  python3-devel python3-tkinter xz file make gcc gcc-c++ \
  glibc-devel.i686 libstdc++-devel.i686 SDL2-devel file-libs libusb1-devel libevdev-devel

Install West (Zephyr meta-tool)

West is Zephyr’s command-line tool for managing repositories and building applications:

pip install west

Get Zephyr Source Code

west init ~/zephyrproject
cd ~/zephyrproject
west update

Install Zephyr SDK

Download and install the Zephyr SDK which includes toolchains for all supported architectures:

cd ~
wget https://github.com/zephyrproject-rtos/sdk-ng/releases/download/v0.16.8/zephyr-sdk-0.16.8_linux-x86_64.tar.xz
tar xvf zephyr-sdk-0.16.8_linux-x86_64.tar.xz
cd zephyr-sdk-0.16.8
./setup.sh

Set Environment Variables

cd ~/zephyrproject/zephyr
source zephyr-env.sh

Build and Run Locally (Native Simulator)

To build and run Zephyr applications on your local PC without hardware, use the native simulator:

west build -b native_sim samples/hello_world

Run the application:

west build -t run

For more details, see the Native Simulator documentation.

Follow the official Zephyr Project installation guide to set up your development environment:

Zephyr Getting Started Guide

Board

ST Electronic Board

STM32CubeProgrammer is an all-in-one software tool for programming STM32 MCU memories (such as Flash and RAM). It provides an easy-to-use and efficient environment to read, write, and verify STM32 MCU memory through their debug interface (JTAG and SWD) or bootloader interface (accessible via UART, USB DFU, I2C, SPI, or CAN). It is available in both GUI (graphical user interface) and CLI (command-line interface) versions.

Download here: STM32CubeProgrammer

Installation on Linux:

unzip ./stm32cubeprg-lin-v2-21-0.zip
./SetupSTM32CubeProgrammer-2.21.0.linux

Then follow the UI instructions to complete the installation.

Configure udev rules to allow access to ST-Link debuggers without root privileges:

sudo cp ~/STMicroelectronics/STM32Cube/STM32CubeProgrammer/Drivers/rules/*.rules /etc/udev/rules.d/
sudo udevadm control --reload-rules
sudo usermod -aG dialout $USER

Log out and log back in for the group change to take effect.

Build and flash your application to the board:

west build -b stm32h573i_dk samples/hello_world
west flash

Monitor the UART output:

minicom -D /dev/ttyACM0

Useful Resources