Programming
Zephyr RTOS
Zephyr is the primary development platform for HealthyPi 5 — all new firmware features land here first. It’s an RTOS designed for resource-constrained devices, with first-class support for the RP2040, real-time scheduling, and a tight build system around west.
If you’re new to embedded development, Arduino is easier to start with. For ongoing work, you want to be on Zephyr.
The workflow at a glance
- Install Zephyr + the Zephyr SDK on your machine.
- Fetch the HealthyPi 5 firmware workspace.
- Build the right firmware variant for your kit.
- Flash via UF2 drag-and-drop or via a Raspberry Pi Debug Probe.
1. Install Zephyr and the SDK
Follow the official Zephyr Getting Started guide — there’s no HealthyPi-specific deviation here:
- Update your OS and install Zephyr’s host dependencies.
- Set up the Zephyr environment + Python dependencies.
- Install the Zephyr SDK — this is the toolchain bundle (compiler, linker, etc.) for each supported architecture.
2. Fetch the workspace
Pull the HealthyPi 5 firmware manifest into a fresh Zephyr workspace:
# Initialise the workspace using the HealthyPi 5 manifest
west init -m https://github.com/protocentral/protocentral_healthypi5_zephyr --mr main hpi5-workspace
# Enter the workspace and fetch all the projects in the manifest
cd hpi5-workspace
west update
west update clones Zephyr itself and all the modules referenced in the manifest. Expect a few gigabytes and 5–10 minutes the first time. To confirm it worked:
ls app
You should see source files like main.c and a CMakeLists.txt.
3. Build the firmware
Pick the build that matches your kit and display panel. Each variant has a corresponding make_*.sh script that wraps the same west build command, so you can use either.
| Kit / Display | west build command |
Shell script |
|---|---|---|
| Basic Kit or Complete Kit + ILI9488 (white) | west build -p auto -b healthypi5_rp2040 app -DEXTRA_CONF_FILE='overlay-bt.conf;overlay-display-ili9488.conf;overlay-logger-sd.conf' -DCONFIG_HEALTHYPI_OP_MODE_DISPLAY=n -DEXTRA_DTC_OVERLAY_FILE='healthypi5_rp2040_display_ili9488.overlay;healthypi5_rp2040_sd.overlay' |
make_basic_ili9488.sh |
| Basic Kit or Complete Kit + ST7796 (black) | west build -p auto -b healthypi5_rp2040 app -DEXTRA_CONF_FILE='overlay-bt.conf;overlay-display-st7796.conf;overlay-logger-sd.conf' -DCONFIG_HEALTHYPI_OP_MODE_DISPLAY=n -DEXTRA_DTC_OVERLAY_FILE='healthypi5_rp2040_display_st7796.overlay;healthypi5_rp2040_sd.overlay' |
make_basic_st7796.sh |
| Complete Kit + ILI9488 (white) — Display firmware | west build -p auto -b healthypi5_rp2040 app -DEXTRA_CONF_FILE='overlay-bt.conf;overlay-display-ili9488.conf;overlay-logger-sd.conf' -DCONFIG_HEALTHYPI_OP_MODE_DISPLAY=y -DEXTRA_DTC_OVERLAY_FILE='healthypi5_rp2040_display_ili9488.overlay;healthypi5_rp2040_sd.overlay' |
make_display_ili9488.sh |
| Complete Kit + ST7796 (black) — Display firmware | west build -p auto -b healthypi5_rp2040 app -DEXTRA_CONF_FILE='overlay-bt.conf;overlay-display-st7796.conf,overlay-logger-sd.conf' -DCONFIG_HEALTHYPI_OP_MODE_DISPLAY=y -DEXTRA_DTC_OVERLAY_FILE='healthypi5_rp2040_display_st7796.overlay;healthypi5_rp2040_sd.overlay' |
make_display_st7796.sh |
The build artefact lands in build/zephyr/zephyr.uf2.
4. Flash to the device
Two paths — drag-and-drop is the easier one; the Debug Probe gives you a real flash-and-attach workflow with serial logging.
Option A — drag and drop
Put the HealthyPi 5 into UF2 mode (hold the RP2040 boot button while powering on — see the Welcome page for the full sequence). Drop build/zephyr/zephyr.uf2 onto the RPI-RP2 drive and the device flashes itself.
Option B — Raspberry Pi Debug Probe (OpenOCD)
This is the proper development setup — flashes are atomic, serial logs are visible in the same terminal, and you can attach a debugger.
Install OpenOCD:
macOS
brew install openocd
Windows
- Download OpenOCD for Windows from gnutoolchains.com.
- Copy the
binandsharefolders intoC:Program FilesOpenOCD. - Add
C:Program FilesOpenOCDbinto yourPATHenvironment variable.
Wire up the Debug Probe:
- UART jumper — from the Debug Probe’s UART port to the RP2040 UART connector on HealthyPi 5 (located just below the SpO₂ port).
- SWD jumper — from the Debug Probe’s Debug port to the RP2040 Debug connector on HealthyPi 5 (located below the RP2040 port).
- Connect the Debug Probe to your host machine via a USB-B cable.
Flash:
west flash
This builds (if needed), programs the firmware, resets the device, and starts streaming UART logs.
Next
- Verify the flashed firmware by running through one of the operating modes.
- For the official Zephyr reference docs (Kconfig, devicetree, drivers), see docs.zephyrproject.org.
