tooling: Add make deploy-usb for DAPLink mass-storage flashing.#382
tooling: Add make deploy-usb for DAPLink mass-storage flashing.#382
Conversation
There was a problem hiding this comment.
Pull request overview
Adds a new Makefile deploy target that flashes firmware by copying the built .bin to the board’s DAPLink USB mass-storage volume, and documents it in contributor docs.
Changes:
- Add
make deploy-usbtarget that detects the DAPLink mount (Linux viafindmntby label, macOS via/Volumes/...) and copiesfirmware.bin. - Update
CONTRIBUTING.mdto include the new deploy option alongside existing deploy targets.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| Makefile | Introduces deploy-usb target to deploy firmware via DAPLink USB mass-storage copy. |
| CONTRIBUTING.md | Documents make deploy-usb as an alternative flashing method. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| if [ -z "$$MOUNT" ] || [ ! -d "$$MOUNT" ]; then \ | ||
| echo "Error: STeaMi board not found. Is it connected and mounted?"; \ | ||
| exit 1; \ | ||
| fi; \ |
There was a problem hiding this comment.
deploy-usb copies $(STM32_DIR)/build-$(BOARD)/firmware.bin but only depends on $(MPY_DIR), so if the firmware hasn't been built yet the user will just get a generic cp failure. Consider either making deploy-usb depend on the firmware target, or adding an explicit pre-check for firmware.bin with a clearer message (e.g., instructing the user to run make firmware first).
| fi; \ | |
| fi; \ | |
| if [ ! -f "$(STM32_DIR)/build-$(BOARD)/firmware.bin" ]; then \ | |
| echo "Error: firmware binary not found at $(STM32_DIR)/build-$(BOARD)/firmware.bin"; \ | |
| echo "Run 'make firmware BOARD=$(BOARD)' first."; \ | |
| exit 1; \ | |
| fi; \ |
There was a problem hiding this comment.
Fixed: improved the error message in scripts/deploy_usb.py to instruct the user to run make firmware first when the binary is not found. Same approach as the existing deploy-pyocd and deploy-openocd targets which also don't depend on firmware (intentional, to allow re-flashing without rebuild).
852cf8e to
4faa9aa
Compare
a6c1eba to
3b23775
Compare
c14132b to
f2eed4c
Compare
|
🎉 This PR is included in version 0.16.3 🎉 The release is available on:
Your semantic-release bot 📦🚀 |
Closes #381
Summary
Add a portable
make deploy-usbtarget that flashes the firmware by copying the.binfile to the DAPLink USB mass-storage volume. Useful as an alternative tomake deploy(pyOCD) andmake deploy-openocd.Implementation
The detection logic is delegated to
scripts/deploy_usb.py(Python, no external deps), which handles all three OS:findmnt -n -o TARGET -S LABEL=STeaMi/Volumes/STeaMi(standard mount path)wmic logicaldisk where VolumeName='STeaMi'The Makefile target is just:
Notes
.binos.sync()ensures the write is flushed (Unix only, no-op on Windows)--serialoption could be added later)Test plan