Bfd flash programmer

From Sonder4/STM32-BFD-Kit · View interactive version

Bfd flash programmer is an AI agent skill from the GitHub repository Sonder4/STM32-BFD-Kit. Use when flashing STM32 firmware, verifying flash results, diagnosing download failures, or running repeatable CLI-based flash workflows.

How to use this skill

Skill file

BFD Flash Programmer

Self-Improvement Loop (Required)

Use this skill for deterministic flash and verification workflows.

Quick Start

  1. Generate bootstrap profile first.
  2. Confirm STM32_DEVICE/STM32_ELF in profile.
  3. Flash and keep logs under logs/flash/.

Core Commands

# 0) Bootstrap profile (required)
python3 ./.codex/skills/bfd-project-init/scripts/bootstrap.py --project-root . --mode check
# 0a) Nested subproject case: current cwd is the firmware subproject, but .codex lives in a shared workspace root
python3 /abs/path/to/.codex/skills/bfd-project-init/scripts/bootstrap.py \
  --project-root /abs/path/to/firmware_subproject \
  --mode check
# 1) Project standard flash flow
bash ./build_tools/jlink/flash.sh | tee logs/flash/flash_$(date +%Y%m%d_%H%M%S).log
# 2) Optional build-dir override
bash ./build_tools/jlink/flash.sh builds/gcc/debug | tee logs/flash/flash_builddir_$(date +%Y%m%d_%H%M%S).log
# 3) Python wrapper with explicit override
python3 ./.codex/skills/bfd-flash-programmer/scripts/jlink_flash.py \
  --firmware "${STM32_HEX}" \
  --device "${STM32_DEVICE}" \
  --address 0x08000000
# 4) DAPLink / CMSIS-DAP fallback through PyOCD
python3 BFD-Kit/scripts/bfd_pyocd_flash.py \
  --firmware "${STM32_HEX}" \
  --target stm32h723xx \
  --uid "<cmsis-dap-uid>" \
  --frequency 100000 \
  --force-program \
  --log-dir logs/flash \
  --log-prefix pyocd_flash
# 5) FanX/Tek DAPLink High probe firmware update on Linux (dry-run by default)
python3 BFD-Kit/scripts/bfd_fanx_daplink_update.py info \
  --firmware .tools/FanX_Tek_DAPLink_High1_V261.bin \
  --updater-zip .tools/FanX_Tek_DAPLink_Updater_V0.0.2.zip

python3 BFD-Kit/scripts/bfd_fanx_daplink_update.py update \
  --firmware .tools/FanX_Tek_DAPLink_High1_V261.bin

# Add --execute only after confirming the detected DAPLINK/BOOTLOADER mount.
python3 BFD-Kit/scripts/bfd_fanx_daplink_update.py update \
  --firmware .tools/FanX_Tek_DAPLink_High1_V261.bin \
  --execute
# 6) Fallback when the project copy does not ship build_tools/jlink/flash.sh
printf "device ${STM32_DEVICE}\nsi ${STM32_IF}\nspeed ${STM32_SPEED_KHZ}\nconnect\nr\nloadfile ${STM32_HEX}\nr\ng\nexit\n" \
  | JLinkExe | tee logs/flash/flash_jlink_direct_$(date +%Y%m%d_%H%M%S).log

Workflow

  1. Run bootstrap profile.
  2. Connect and identify device.
  3. Program and verify.
  4. Reset and validate runtime logs.

Hard Rules

Scripts

Related Skills

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.