flash_firmware
Program firmware binaries to STM32, ESP, and Cortex-M boards with dry-run preview and confirm safeguards, then reset the target to run.
Instructions
烧录固件到开发板(不可逆操作,双闸门)。
第一道:dry_run 默认 True,只返回将要执行的完整命令供逐字核对,不写 flash。 第二道:真正执行必须 dry_run=False 且 confirm=True —— 两道都齐才会写。 另受隔离档位管辖:MCU_DEBUG_MCP_MODE 为 readonly(默认)时直接拒绝。 STM32+ST-Link(默认首选,实测最稳): flash_firmware("app.bin", chip="stm32h563") → STM32_Programmer_CLI -c port=SWD mode=normal -w app.bin 0x08000000 -v -rst 接多台同型号调试器时用 sn 指定探针序列号。 ESP 系:flash_firmware("app.bin", chip="esp32", port="COM5") 通用 Cortex-M:flash_firmware("app.elf", tool="pyocd", chip="stm32f103c8") 烧完自动 -rst 复位;不复位的话 SWD 会把内核 halt 住,板子不会跑。
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| sn | No | ||
| chip | No | ||
| port | No | ||
| tool | No | auto | |
| confirm | No | ||
| dry_run | No | ||
| file_path | Yes |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |