Skip to content

Building

Val edited this page Nov 27, 2026 · 2 revisions

Requirements

  • PlatformIO (CLI or the IDE extension).
  • Python 3 (comes with PlatformIO).

PlatformIO installs the pinned platform and GCC toolchain on the first build. The STM32 project uses the libraries in vendor/.

Build

pio run                              # all four environments
pio run -e recovery -e firmware      # ZT703S only
pio run -e zt706s_recovery -e zt706s_firmware   # ZT706S only
Environment Model Output
recovery ZT703S .pio/build/recovery/OpenOSC-Recovery-ZT703S.ZTK
firmware ZT703S .pio/build/firmware/OpenOSC-Firmware-ZT703S.OSC
zt706s_recovery ZT706S .pio/build/zt706s_recovery/OpenOSC-Recovery-ZT706S.ZTK
zt706s_firmware ZT706S .pio/build/zt706s_firmware/OpenOSC-Firmware-ZT706S.OSC

Each build folder also has firmware.bin and firmware.elf. The firmware .bin carries a board marker and is accepted by Recovery as well. The ZT706S environments extend the ZT703S ones and change only the board.

The version comes from the VERSION file in the repository root.

For a release that includes the Wireless Module, run python3 scripts/build_firmware.py to build the four STM32 targets and the ESP32-C3 add-on together. The command collects the versioned files under build/releases/vX.Y.Z/assets/ and writes SHA256SUMS next to that directory. Use --esp32-only to build just the add-on for development. Wireless Module installation

Board definitions

config/boards/<model>.json is the single source of board parameters used by both C++ and Python. After changing one, regenerate the derived files:

python3 scripts/generate_board_config.py

This updates boards/<model>.json and include/openosc/board/generated/<model>.hpp. The build stops with an error if they are out of date.

Packaging

Script Does
scripts/build.py PlatformIO hook: build flags, board defines, packaging after linking
scripts/package_image.py Wraps the firmware into an .OSC package (1 KiB header, CRC trailer) for Recovery
scripts/bin_to_ztk.py Packs Recovery into the .ZTK container accepted by the device's USB update mode

Installing a build

Copy the .OSC to /openosc/UPDATE/ in Recovery and install it, as described in Updating. Recovery itself is installed like in Installation.

Reproducible builds

The same commit and toolchain produce byte-identical files. Release notes list SHA-256 checksums, so you can compare your build with a release.

Clone this wiki locally