Flashing Firmware
How to get firmware onto a board. STM32 boards use an ST-Link over SWD; RP2040 boards use USB. PlatformIO drives both.
STM32 (PanelBridge, PanelGroup) — ST-Link over SWD
Every custom STM32 board exposes a 5-pin SWD header (PA13/PA14/NRST/GND/3.3 V). Connect an ST-Link and:
pio run -t upload # build + flash the default env
pio run -e PanelGroup -t upload # a specific env
upload_protocol = stlink is already set in the templates. No separate flasher GUI is needed —
PlatformIO drives the probe directly (STM32CubeProgrammer is optional). See
PlatformIO Setup.
A new board needs the bootloader first. The firmware starts at
0x08001000, behind the bootloader, so a board that has never been flashed gets both at once:
pio run -t bootstrap # bootloader + firmware, once per new board
After that, pio run -t upload flashes the firmware alone and keeps the bootloader. A release
carries every board's firmware in one zip, openskyhawk-firmware-<version>.zip, with a folder per
board. Each STM32 board's folder has three files: -full.hex (bootloader + firmware) for a new
board and .elf (firmware alone) for one that already has the bootloader, both for the ST-Link,
and .bin (firmware alone), which SkyHawkClient
loads onto a board that already has the bootloader, with no ST-Link. The Gateway's cockpit side
takes a different build of the bootloader from the nodes; bootstrap and the release files already
pick the right one for each board. First Setup & Updates walks through which file
goes on which board, in order.
The release has no PanelGroup file. Every panel group has its own NODE_ID and its own controls, so
you build its firmware from source and flash it with bootstrap as above.
Firmware/Examples/PanelGroupSample/ is a working one to start from, in your clone or in the
release's Source code archive.
The bootloader write-protects itself, so anything that writes from address 0 — the per-library test sketches, or a new bootloader — needs the protection lifted first. The one-line command is on the Bootloader page.
ST-Link troubleshooting
Upload fails with 'only supports deprecated HLA'?
The ST-Link's own firmware is too old — PlatformIO's OpenOCD needs V2J24 or newer, and
many clones ship older. Update the probe with ST's free
STSW-LINK007 updater: plug the
ST-Link in on its own, click Open in update mode, then Upgrade, and replug.
On macOS the updater needs Java (brew install --cask temurin); without it the app closes
as soon as it opens.
Clone reports 'tap not found'?
Many Blue Pill clones use JTAG ID 0x2ba01477 (standard is 0x1ba01477) and ST-Link
refuses to connect. Uncomment the override in platformio.ini:
upload_flags =
-c
set CPUTAPID 0
Use 0, not the clone's actual ID. 0 disables the ID check outright. Setting it to
0x2ba01477 gets past the initial check but has been observed to fail part-way through
the write — the projects under Firmware/Tests/ all use 0 for this reason.
RP2040 (SimGateway) — USB
No ST-Link needed — the board flashes over the same USB cable it runs on. Either:
- From PlatformIO:
pio run -t upload. PlatformIO resets the board into its bootloader by itself (the 1200-baud touch, which the Adafruit TinyUSB library in every SimGateway build handles), then flashes it. - By hand: a blank board shows up as the
RPI-RP2drive as soon as it is plugged in. Drag the.uf2onto the drive — from a release,gateway/gateway-<version>.uf2in the zip. A running board is restarted into the drive by the upload above or by SkyHawkClient; hold BOOTSEL while plugging it in only if its firmware hangs before USB comes up.
Upload can't find the board?
Something is holding the CDC port open. Close SkyHawkClient, serial monitors, and any
browser HID/serial page before flashing — an orphaned Electron process is enough to keep the
port claimed; check with lsof /dev/cu.usbmodem*.
The automatic reset needs the running firmware to answer on USB. If the board's firmware hangs before USB comes up, put it into BOOTSEL by hand and run the upload again.
After flashing
Watch the board come up on DiagSerial (115200) and check the status LED. See Bring-Up & Testing and Debugging on STM32.