Skip to content

feat(scripts): add MCU flash tool with TUI, JSON, and headless modes#194

Open
gmmcosta15 wants to merge 6 commits intodevfrom
feature/tool-mcu-flash
Open

feat(scripts): add MCU flash tool with TUI, JSON, and headless modes#194
gmmcosta15 wants to merge 6 commits intodevfrom
feature/tool-mcu-flash

Conversation

@gmmcosta15
Copy link
Collaborator

@gmmcosta15 gmmcosta15 commented Mar 11, 2026

Description

Select the type:

  • Feature
  • Bug fix
  • Code refactor
  • Documentation

This Pull Request adds:

  • Adds scripts/flash_mcus.sh — a Bash MCU flasher for Blocks 3D printers
  • Supports 4 flash methods: CAN (Katapult), USB Katapult, BOOTSEL/picoboot, STM32 DFU
  • Three non-interactive modes (--list-json, --flash <name>, --flash-all) designed for PyQt6 panel integration
  • UUID auto-discovery from printer.cfg; live firmware version query from Moonraker API
  • Bundles Klipper + Katapult build configs for EBB CAN, Eddy Duo, and Octopus boards
  • Adds curl and jq to system-dependencies.json

Motivation

Flashing Klipper firmware to the printer's MCUs (Octopus Pro, EBB-36 toolhead, Eddy Duo probe) has historically been a fully manual process: building firmware with make menuconfig, determining the right flash transport for each board (CAN via Katapult, STM32 DFU, RP2040 BOOTSEL), looking up CAN UUIDs from printer.cfg, and invoking the right tool in the right order with the added constraint that the CAN bridge MCU (Octopus) must be flashed last or it drops can0 mid-session.

This is error-prone, time-consuming, and a significant source of friction during printer firmware updates. It also blocks building a future GUI panel in BlocksScreen: the UI needs a way to discover MCU state (detected, current version, needs update) and trigger flashing without re-implementing all of this logic in Python.

Future work

  • Add more MCU's to the config folder

  Adds flash_mcus.sh — a Bash tool for flashing Klipper firmware to all
  supported Blocks printer MCUs. Supports an interactive TUI, --list-json
  for JSON output, --flash / --flash-all for headless use,
  and --force to bypass version checks.

  Flash methods: CAN via Katapult, USB Katapult, BOOTSEL/picoboot, STM32
  DFU. UUID auto-discovery from printer.cfg; live firmware version query
  from Moonraker API; auto-starts Klipper/Moonraker if stopped.

  Bundles mcu_config/ files for EBB CAN (STM32G0B1), Eddy Duo (RP2040),
  and Octopus (STM32H723) with their Katapult bootloader counterparts.

  Adds curl and jq to system-dependencies.json (required by flash_mcus.sh).
@gmmcosta15 gmmcosta15 requested a review from HugoCLSC March 11, 2026 16:23
@gmmcosta15 gmmcosta15 self-assigned this Mar 11, 2026
@gmmcosta15 gmmcosta15 added the enhancement New feature or request. label Mar 11, 2026
@gmmcosta15 gmmcosta15 marked this pull request as ready for review March 11, 2026 16:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant