Skip to content

Commit 852cf8e

Browse files
committed
tooling: Add make deploy-usb for DAPLink mass-storage flashing.
1 parent 1f060e6 commit 852cf8e

2 files changed

Lines changed: 18 additions & 0 deletions

File tree

CONTRIBUTING.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,7 @@ make firmware # Clone micropython-steami (if needed), link local drivers,
195195
make firmware-update # Refresh the MicroPython clone and board-specific submodules
196196
make deploy # Flash firmware via pyOCD (default)
197197
make deploy-openocd # Flash firmware via OpenOCD (alternative)
198+
make deploy-usb # Flash firmware via DAPLink USB mass-storage (alternative)
198199
make run SCRIPT=lib/steami_config/examples/show_config.py # Run with live output
199200
make deploy-script SCRIPT=lib/.../calibrate_magnetometer.py # Deploy as main.py for autonomous use
200201
make run-main # Re-execute the deployed main.py

Makefile

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,23 @@ deploy-pyocd: $(MPY_DIR) ## Flash firmware via pyOCD (CMSIS-DAP)
134134
deploy-openocd: $(MPY_DIR) ## Flash firmware via OpenOCD
135135
$(MAKE) -C $(STM32_DIR) BOARD=$(BOARD) deploy-openocd
136136

137+
.PHONY: deploy-usb
138+
deploy-usb: $(MPY_DIR) ## Flash firmware via DAPLink USB mass-storage
139+
@set -e; \
140+
case $$(uname) in \
141+
Linux) MOUNT=$$(findmnt -n -o TARGET -S LABEL=STeaMi | head -1) ;; \
142+
Darwin) MOUNT=/Volumes/STeaMi ;; \
143+
*) echo "Error: unsupported OS $$(uname)"; exit 1 ;; \
144+
esac; \
145+
if [ -z "$$MOUNT" ] || [ ! -d "$$MOUNT" ]; then \
146+
echo "Error: STeaMi board not found. Is it connected and mounted?"; \
147+
exit 1; \
148+
fi; \
149+
echo "Copying firmware to $$MOUNT..."; \
150+
cp $(STM32_DIR)/build-$(BOARD)/firmware.bin "$$MOUNT/"; \
151+
sync; \
152+
echo "Firmware deployed via USB. Board will reset automatically."
153+
137154
.PHONY: run
138155
run: ## Run a script on the board with live output (SCRIPT=path/to/file.py)
139156
@if [ -z "$(SCRIPT)" ]; then \

0 commit comments

Comments
 (0)