tooling(daplink_bridge): Add SWD-based DAPLink flash targets.#394
Merged
tooling(daplink_bridge): Add SWD-based DAPLink flash targets.#394
Conversation
Closes #388. New Make targets for flashing the DAPLink chip via an external SWD probe: daplink-bootloader Build stm32f103xb_bl (bootloader, 47 KB at 0x08000000) daplink-deploy-pyocd Flash interface firmware via SWD (pyocd, no MAINTENANCE) daplink-deploy-openocd Flash interface firmware via SWD (openocd) daplink-deploy-bootloader Alias for bootloader-pyocd daplink-deploy-bootloader-pyocd Flash bootloader via SWD (pyocd) daplink-deploy-bootloader-openocd Flash bootloader via SWD (openocd) The OpenOCD sequence mirrors steamicc/DapLink-EasyFlash: ST-Link hla_swd transport, `stm32f1x unlock 0` before `program verify` so locked chips can be recovered. pyOCD uses the built-in `stm32f103rc` target (flash-compatible with the STM32F103CB on the DAPLink chip for the lower 128 KB). Every SWD target prints a bootstrap warning explaining that a board cannot reflash its own on-board DAPLink via its own SWD pins — an EXTERNAL probe is required on the target's SWD header. CONTRIBUTING.md documents the new targets, the bootstrap constraint, and the override variables (DAPLINK_OPENOCD_INTERFACE, DAPLINK_OPENOCD_TRANSPORT, DAPLINK_PYOCD_TARGET) for non-ST-Link probes. Since daplink-deploy-pyocd and daplink-deploy-openocd now exist, the short-name deprecation messages for `deploy-pyocd` / `deploy-openocd` are reverted to the standard DEPRECATED_FIRMWARE form that points to both the micropython- and daplink- variants. The DEPRECATED_MICROPYTHON_ONLY macro is removed. Verified locally: - make daplink-bootloader → builds stm32f103xb_bl_crc.bin (Start 0x8000000, Length 0xbc00, CRC32 0x564aa44f) - make help lists the five new targets - make -n on each SWD target produces the expected pyocd / openocd command with the warning prelude and the correct base address - make lint / make test-mock still pass Hardware verification pending: flashing with a real ST-Link on a STeaMi board must be done before merging.
Contributor
There was a problem hiding this comment.
Pull request overview
Adds Makefile tooling to build and flash the DAPLink STM32F103 (bootloader + interface firmware) via an external SWD probe, complementing the existing USB MAINTENANCE update path and documenting the bootstrap limitation.
Changes:
- Introduces new Make targets to build the DAPLink bootloader and flash bootloader/interface firmware via pyOCD or OpenOCD over SWD.
- Adds configurable SWD flashing variables in
env.mk(targets, OpenOCD interface/transport, and flash base addresses). - Updates contributor documentation to describe the new SWD-based flows and the “external probe required” warning.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
env.mk |
Adds DAPLink bootloader build dir and SWD-flash configuration defaults/overrides (addresses + pyOCD/OpenOCD knobs). |
Makefile |
Implements new daplink-bootloader + SWD deploy targets; adds shared warning banner and OpenOCD flash helper; removes obsolete deprecation macro. |
CONTRIBUTING.md |
Documents the new targets and clearly explains MAINTENANCE vs SWD flashing and the external-probe requirement. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
🎉 This PR is included in version 0.16.8 🎉 The release is available on:
Your semantic-release bot 📦🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Implements #388.
Five new Make targets for flashing the DAPLink chip via an external SWD probe (ST-Link, J-Link, or another CMSIS-DAP board):
daplink-bootloaderstm32f103xb_bl(47 KB, address0x08000000)daplink-deploy-pyocddaplink-deploy-openocddaplink-deploy-bootloader-pyocdvariantdaplink-deploy-bootloader-pyocddaplink-deploy-bootloader-openocdDesign notes
transport select hla_swd,reset_config none separate,stm32f1x unlock 0beforeprogram verifyso read-protected chips can be recovered in one shot.stm32f103rctarget (flash-compatible with the STM32F103CB on the DAPLink chip for the lower 128 KB). Configurable viaDAPLINK_PYOCD_TARGET.DAPLINK_OPENOCD_FLASHmake-function and aDAPLINK_SWD_WARNINGbanner printed before every SWD deploy. The warning explains that a board cannot reflash its own on-board DAPLink and that an external probe is mandatory.env.mk:DAPLINK_OPENOCD_INTERFACE,DAPLINK_OPENOCD_TRANSPORT,DAPLINK_OPENOCD_TARGET,DAPLINK_PYOCD_TARGET,DAPLINK_FLASH_ADDR,DAPLINK_BL_FLASH_ADDR— for non-ST-Link probes or custom layouts.daplink-deploy-pyocd/daplink-deploy-openocdno longer trigger the "use the micropython- variant" deprecation message, since both now exist. TheDEPRECATED_MICROPYTHON_ONLYmacro is removed.Test plan
make daplink-bootloaderbuildsstm32f103xb_bl_crc.bin(Start0x8000000, Length0xbc00, CRC320x564aa44f).make helplists the five new targets.make -non each SWD target prints the warning banner followed by the expected pyocd / openocd command with the correct base address (0x08000000for bootloader,0x08002000for interface).make lint/make test-mockstill pass (364 passed, 2 skipped).Closes
#388