feat: Firmware flash script (Issue #536) #537

Closed
sl-jetson wants to merge 0 commits from sl-android/issue-536-flash-script into main
Collaborator

Summary

  • scripts/flash_stm32.sh: one-command STM32 programming from Jetson Orin
  • Auto-detects ST-Link via st-info, openocd probe, or USB vendor ID (0483:374x)
  • Builds firmware with PlatformIO (pio run) or make, selecting env via --target
  • Flashes via st-flash (default) or openocd (--openocd); auto-falls back to DFU when no ST-Link found
  • DFU path sends 'R' serial reboot command, waits for USB DFU device (0483:df11), then uses dfu-util
  • Post-flash readback verification via st-flash read + cmp, or openocd verify_image
  • Hard resets target after flash via ST-Link or openocd
  • Flags: --no-build, --no-verify, --dfu, --openocd, --target <env>, --help
  • Full set -euo pipefail error handling with coloured output

Test plan

  • Run ./scripts/flash_stm32.sh on Jetson with ST-Link connected
  • Run ./scripts/flash_stm32.sh --dfu — DFU fallback path
  • Run ./scripts/flash_stm32.sh --no-build --no-verify — skip build/verify
  • Unplug ST-Link and run normally — auto-fallback to DFU
  • bash -n scripts/flash_stm32.sh — passes syntax check

🤖 Generated with Claude Code

## Summary - `scripts/flash_stm32.sh`: one-command STM32 programming from Jetson Orin - Auto-detects ST-Link via `st-info`, `openocd` probe, or USB vendor ID (0483:374x) - Builds firmware with PlatformIO (`pio run`) or `make`, selecting env via `--target` - Flashes via `st-flash` (default) or `openocd` (`--openocd`); auto-falls back to DFU when no ST-Link found - DFU path sends `'R'` serial reboot command, waits for USB DFU device (0483:df11), then uses `dfu-util` - Post-flash readback verification via `st-flash read` + `cmp`, or `openocd verify_image` - Hard resets target after flash via ST-Link or openocd - Flags: `--no-build`, `--no-verify`, `--dfu`, `--openocd`, `--target <env>`, `--help` - Full `set -euo pipefail` error handling with coloured output ## Test plan - [ ] Run `./scripts/flash_stm32.sh` on Jetson with ST-Link connected - [ ] Run `./scripts/flash_stm32.sh --dfu` — DFU fallback path - [ ] Run `./scripts/flash_stm32.sh --no-build --no-verify` — skip build/verify - [ ] Unplug ST-Link and run normally — auto-fallback to DFU - [ ] `bash -n scripts/flash_stm32.sh` — passes syntax check 🤖 Generated with [Claude Code](https://claude.com/claude-code)
sl-jetson closed this pull request 2026-03-07 13:47:02 -05:00

Pull request closed

Sign in to join this conversation.
No Reviewers
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: seb/saltylab-firmware#537
No description provided.