crosspad_flash
Flash firmware to ESP32-S3 or STM32G0 after a preflight check verifies device, port role, build version, and board revision. Confirmation required before writing.
Instructions
[ESP HW | STM HW] Flash firmware. Danger tier: it always runs a preflight first, always returns that preflight (refusal included), and needs a confirmation before writing anything. Preflight reports: the device's USB mode, which role the target port plays (the STM32 bridge console is refused as a flash target), the binary's own version string, whether it is older than the newest file under main/ or components/, and whether the build's board revision matches the device's — a mismatch is a blocker, because the revisions differ in pinout and the wrong image looks like dead hardware. target='esp': transport='ota' streams over USB CDC with the device running (no bootloader mode); transport='uart' runs idf.py flash and needs download mode. wait_boot=true then opens the console and returns a BootResult. target='stm': method='swd' (ST-Link) or 'dfu' (system bootloader, hold pad 1 at boot). The flash runs as a job: wait_seconds=0 (default) returns a task handle for crosspad_task; wait_seconds>0 inlines the final status. dry_run=true stops after the preflight. force=true overrides every blocker except the port-role refusal.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| port | No | ESP only. Serial port to flash. Omit to let the daemon choose. The STM32 bridge console port is refused — it carries logs, not the flash. | |
| force | No | Proceed despite preflight blockers (stale build, board-revision mismatch, missing device). The port-role refusal is never overridden. | |
| device | No | ESP only. Device id (dev_xxxx) or one of its port paths; omit when exactly one CrossPad is connected. | |
| method | No | STM only. 'swd' = ST-Link; 'dfu' = the STM32 system bootloader (hold pad 1 at boot). | |
| target | No | 'esp' = ESP32-S3 application firmware (transport uart|ota); 'stm' = STM32G0 bridge firmware via STM32_Programmer_CLI (method swd|dfu). | esp |
| dry_run | No | Run the preflight and stop: no confirmation token is minted and nothing is written. | |
| build_dir | No | ESP only. Build directory holding the binary and its sdkconfig (default '<idf-root>/build'; per-revision dirs are build_v1 / build_v2). | |
| transport | No | ESP only. 'ota' streams the binary over USB CDC with the device running (no bootloader mode); 'uart' runs idf.py flash and needs download mode. | |
| wait_boot | No | ESP only. After flashing, open the console and wait for the boot markers; the job result carries a BootResult {complete, missing, fatal, errors, bootloops, seconds}. Default false. | |
| build_type | No | STM only. Picks the build/<preset> dir for the default binary. Default Debug. | |
| delta_base | No | ESP OTA only. Previously flashed binary to diff against — sends a delta instead of the whole image. | |
| wait_seconds | No | 0 (default) returns the task handle immediately — poll it with crosspad_task. >0 waits that long and inlines the task status; a timeout is not an error, the job keeps running. | |
| confirm_token | No | Token from a previous confirmation_required result. Re-issue the identical call with it to proceed. | |
| firmware_path | No | Custom binary. ESP default '<build_dir>/CrossPad.bin'; STM default '<stm-root>/build/<preset>/CrossPad_STM32_r20.bin'. | |
| boot_timeout_s | No | wait_boot: how long to wait for a complete boot (default 45, the firmware's own boot budget). |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| ts | No | ||
| hint | No | ||
| task | No | ||
| tool | No | ||
| error | No | ||
| device | No | ||
| status | No | ||
| target | No | ||
| details | No | ||
| dry_run | No | ||
| success | Yes | ||
| preflight | No | ||
| transport | No | ||
| resultType | No | ||
| confirmation | No | ||
| firmware_path | No |