Post

Zephyr RTOS: Coming back after 6 months — environment refresh guide

Step-by-step guide to refreshing your Zephyr RTOS development environment after a long break — using uv for Python package management and updating to v4.4.0.

Zephyr RTOS: Coming back after 6 months — environment refresh guide

Coming back to Zephyr after 6 months, here’s what I needed to do to get running again.

This guide uses uv instead of plain venv + pip. It installs ~150 packages in about 15 seconds including download, and - handy after a system upgrade - it can manage its own Python interpreter, so the venv stops breaking every time distribution ships the new system Python.

Recreate the Python environment

A venv is tied to one specific Python interpreter, so after a system upgrade the cleanest move is to throw it away and recreate it. It holds nothing important - just west and a few build-time packages.

1
2
3
4
5
6
cd ~/zephyrproject
rm -rf .venv
# Seed option installs pip and setuptools making it compatible with west
uv venv --python 3.13 --seed .venv
source .venv/bin/activate
uv pip install -U west

Alternative to uv command is python3 -m venv ~/zephyrproject/.venv.

Update zephyr

Fetch a new version

This downloads version 4.4.0

1
2
3
cd zephyr
git fetch
git checkout v4.4.0

Update the west projects

1
2
cd ~/zephyrproject
west update

Install required Python packages

1
uv pip install -r zephyr/scripts/requirements.txt

or west native slow way (needs --seed earlier)

1
west packages pip --install

Update/install new Zephyr SDK

First remove old SDK folder, which may take roughly 10GB

Then install what you need. ARM-Cortex and ESP32 architectures with host tools are maybe 2.1GB

1
2
3
west sdk install -t arm-zephyr-eabi                   # RPi Pico (2), nrf52 (ARM Cortex)
west sdk install -t xtensa-espressif_esp32_zephyr-elf # ESP32 (original)
west sdk install -t riscv64-zephyr-elf                # RPi Pico 2 in RISC-V mode, ESP32-C3, ESP32-C6, ...

Check ~/.cmake/packages/Zephyr-sdk/ for references to non-existing old directory.

Try build

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
(.venv) ~/zephyrproject$ west build --pristine --board rpi_pico zephyr/samples/hello_world
-- west build: making build dir /home/pavel/zephyrproject/build pristine
-- west build: generating a build system
Loading Zephyr default modules (Zephyr base).
-- Application: /home/pavel/zephyrproject/zephyr/samples/hello_world
-- CMake version: 4.2.3
-- Found Python3: /home/pavel/zephyrproject/.venv/bin/python3 (found suitable version "3.13.13", minimum required is "3.12") found components: Interpreter
-- Cache files will be written to: /home/pavel/.cache/zephyr
-- Zephyr version: 4.4.0 (/home/pavel/zephyrproject/zephyr)
-- Found west (found suitable version "1.5.0", minimum required is "0.14.0")
-- Board: rpi_pico, qualifiers: rp2040
-- ZEPHYR_TOOLCHAIN_VARIANT not set, trying to locate Zephyr SDK
-- Found host-tools: zephyr 1.0.1 (/home/pavel/zephyr-sdk-1.0.1)
-- Found toolchain: zephyr 1.0.1 (/home/pavel/zephyr-sdk-1.0.1)
-- Found Dtc: /home/pavel/zephyr-sdk-1.0.1/hosttools/sysroots/x86_64-pokysdk-linux/usr/bin/dtc (found suitable version "1.7.0", minimum required is "1.4.6")

...

[1/2] Building ASM object CMakeFiles/boot_stage2.dir/home/pavel/zephyrproject/modules/hal/rpi_pico/src/rp2040/boot_stage2/boot2_w25q080.S.obj
[2/2] Linking ASM executable boot_stage2
[156/156] Linking C executable zephyr/zephyr.elf
Memory region         Used Size  Region Size  %age Used
      BOOT_FLASH:         256 B        256 B    100.00%
           FLASH:       15748 B    2096896 B      0.75%
             RAM:        3968 B       264 KB      1.47%
        IDT_LIST:           0 B        32 KB      0.00%
Generating files from /home/pavel/zephyrproject/build/zephyr/zephyr.elf for board: rpi_pico/rp2040
Converted to uf2, output size: 32256, start address: 0x10000000
Wrote 32256 bytes to zephyr.uf2

Also target native_sim/native/64 works (yes, .exe file on Linux):

1
2
3
(.venv) ~/zephyrproject$ build/zephyr/zephyr.exe
*** Booting Zephyr OS build v4.4.0 ***
Hello World! native_sim/native/64

Other stuff

After going from Fedora 44 to openSuse, i needed to install ninja build system using sudo zypper in ninja, dtc package is in the official checklist, but it is the part of Zephyr SDK.

TL;DR

Fresh .venv → checkout v4.4.0west update → install deps → update SDK.

Works fine with uv instead of classic pip (use --seed).

Delete the old SDK folder(s) to reclaim ~10 GB.

This post is licensed under CC BY 4.0 by the author.