Skip to content

Commit 60f5b24

Browse files
authored
tooling: Rename firmware targets to micropython-* with deprecation errors. (#386)
* tooling: Rename firmware targets to micropython-* with deprecation errors. * docs: Disambiguate firmware references (MicroPython vs DAPLink).
1 parent c375fad commit 60f5b24

9 files changed

Lines changed: 73 additions & 39 deletions

File tree

.devcontainer/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
FROM mcr.microsoft.com/devcontainers/python:3.10
22

3-
# System packages for firmware build and board communication
3+
# System packages for MicroPython firmware build and board communication
44
RUN apt-get update && apt-get install -y --no-install-recommends \
55
gcc-arm-none-eabi \
66
libnewlib-arm-none-eabi \

.devcontainer/devcontainer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
},
66

77
// USB access for STeaMi board (DAPLink / mpremote / pyOCD / OpenOCD).
8-
// Privileged mode is required for firmware flashing and board communication.
8+
// Privileged mode is required for MicroPython firmware flashing and board communication.
99
// This is incompatible with GitHub Codespaces but essential for local use.
1010
"privileged": true,
1111
"mounts": ["type=bind,source=/dev/bus/usb,target=/dev/bus/usb"],

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ jobs:
7171
sudo apt-get install -y --no-install-recommends gcc-arm-none-eabi libnewlib-arm-none-eabi
7272
7373
- name: Build firmware
74-
run: make firmware
74+
run: make micropython-firmware
7575

7676
- name: Attach firmware to release
7777
env:

CONTRIBUTING.md

Lines changed: 22 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -119,9 +119,9 @@ For local development (without dev container):
119119

120120
* Python 3.10+
121121
* Node.js 22+ (for husky, commitlint, lint-staged, semantic-release)
122-
* `arm-none-eabi-gcc` toolchain (for `make firmware`)
123-
* `pyocd` (for `make deploy`, installed via `pip install -e ".[flash]"`)
124-
* OpenOCD (optional, for `make deploy-openocd`)
122+
* `arm-none-eabi-gcc` toolchain (for `make micropython-firmware`)
123+
* `pyocd` (for `make micropython-deploy`, installed via `pip install -e ".[flash]"`)
124+
* OpenOCD (optional, for `make micropython-deploy-openocd`)
125125
* `mpremote` (installed via `pip install -e ".[test]"`)
126126
* GitHub CLI (`gh`)
127127

@@ -140,7 +140,7 @@ The container also provides:
140140
* **zsh + oh-my-zsh** as default shell with persistent shell history
141141
* **Pylance** configured with MicroPython STM32 stubs (no false `import machine` errors)
142142
* **Serial Monitor** extension for board communication
143-
* **USB passthrough** for mpremote, pyOCD, OpenOCD, and firmware flashing (the container runs in privileged mode with `/dev/bus/usb` mounted)
143+
* **USB passthrough** for mpremote, pyOCD, OpenOCD, and MicroPython firmware flashing (the container runs in privileged mode with `/dev/bus/usb` mounted)
144144
* **udev rules** for the DAPLink interface (auto-started on container creation)
145145

146146
Note: GitHub Codespaces is not supported because the container requires privileged mode and USB device access for board communication.
@@ -186,25 +186,32 @@ make bump PART=minor # minor: v1.0.1 → v1.1.0
186186
make bump PART=major # major: v1.1.0 → v2.0.0
187187
```
188188

189-
## Firmware build and deploy
189+
## MicroPython firmware build and deploy
190190

191-
The drivers are "frozen" into the MicroPython firmware for the STeaMi board. The Makefile automates cloning, building, and flashing:
191+
The STeaMi board has two distinct firmwares:
192+
193+
- **MicroPython firmware** — runs on the STM32WB55 main MCU and exposes the drivers from this repository
194+
- **DAPLink firmware** — runs on the STM32F103 interface chip and provides the I2C bridge, mass-storage, and CMSIS-DAP debug interface (build targets planned in #377)
195+
196+
This section covers the **MicroPython firmware** only. The drivers in this repository are "frozen" into it. The Makefile automates cloning, building, and flashing:
192197

193198
```bash
194-
make firmware # Clone micropython-steami (if needed), link local drivers, build
195-
make firmware-update # Refresh the MicroPython clone and board-specific submodules
196-
make deploy # Flash firmware via pyOCD (default)
197-
make deploy-openocd # Flash firmware via OpenOCD (alternative)
198-
make deploy-usb # Flash firmware via DAPLink USB mass-storage (alternative)
199+
make micropython-firmware # Clone micropython-steami (if needed), link local drivers, build
200+
make micropython-update # Refresh the MicroPython clone and board-specific submodules
201+
make micropython-deploy # Flash MicroPython firmware via pyOCD (default)
202+
make micropython-deploy-openocd # Flash MicroPython firmware via OpenOCD (alternative)
203+
make micropython-deploy-usb # Flash MicroPython firmware via DAPLink USB mass-storage (alternative)
204+
make micropython-clean # Clean MicroPython firmware build artifacts
199205
make run SCRIPT=lib/steami_config/examples/show_config.py # Run with live output
200206
make deploy-script SCRIPT=lib/.../calibrate_magnetometer.py # Deploy as main.py for autonomous use
201-
make run-main # Re-execute the deployed main.py
202-
make firmware-clean # Clean firmware build artifacts
207+
make run-main # Re-execute main.py on the board
203208
```
204209

205-
The firmware source is cloned into `.build/micropython-steami/` (gitignored). A symbolic link replaces the submodule `lib/micropython-steami-lib` with your local working directory, so the firmware always includes your latest changes — even uncommitted ones.
210+
The legacy short names (`make firmware`, `make deploy`, etc.) are deprecated and now print an error message asking which firmware (MicroPython or DAPLink) you intended to target.
211+
212+
The MicroPython firmware source is cloned into `.build/micropython-steami/` (gitignored). A symbolic link replaces the submodule `lib/micropython-steami-lib` with your local working directory, so the firmware always includes your latest changes — even uncommitted ones.
206213

207-
Use `make firmware` for normal rebuilds from the existing local clone. Use `make firmware-update` only when you want to refresh the `micropython-steami` checkout itself or resync the board-specific submodules before rebuilding.
214+
Use `make micropython-firmware` for normal rebuilds from the existing local clone. Use `make micropython-update` only when you want to refresh the `micropython-steami` checkout itself or resync the board-specific submodules before rebuilding.
208215

209216
All these tools are included in the dev container. For local development, see the [Prerequisites](#prerequisites) section.
210217

Makefile

Lines changed: 42 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -88,16 +88,16 @@ ci: lint test test-examples ## Run all CI checks (lint + tests + examples)
8888
.PHONY: build
8989
build: lint test ## Build (lint + test)
9090

91-
# --- Firmware ---
91+
# --- MicroPython firmware ---
9292

9393
$(MPY_DIR):
9494
@echo "Cloning micropython-steami into $(CURDIR)/$(MPY_DIR)..."
9595
@mkdir -p $(dir $(CURDIR)/$(MPY_DIR))
9696
git clone --branch $(MICROPYTHON_BRANCH) $(MICROPYTHON_REPO) $(CURDIR)/$(MPY_DIR)
9797
$(MAKE) -C $(STM32_DIR) BOARD=$(BOARD) submodules
9898

99-
.PHONY: firmware
100-
firmware: $(MPY_DIR) ## Build MicroPython firmware with current drivers
99+
.PHONY: micropython-firmware
100+
micropython-firmware: $(MPY_DIR) ## Build MicroPython firmware with current drivers
101101
@set -e
102102
@if [ ! -f "$(MPY_DIR)/lib/micropython-lib/README.md" ]; then \
103103
echo "Initializing submodules for $(BOARD)..."; \
@@ -111,8 +111,8 @@ firmware: $(MPY_DIR) ## Build MicroPython firmware with current drivers
111111
$(MAKE) -C $(STM32_DIR) BOARD=$(BOARD)
112112
@echo "Firmware ready: $(STM32_DIR)/build-$(BOARD)/firmware.hex"
113113

114-
.PHONY: firmware-update
115-
firmware-update: $(MPY_DIR) ## Update the MicroPython clone and board-specific submodules
114+
.PHONY: micropython-update
115+
micropython-update: $(MPY_DIR) ## Update the MicroPython clone and board-specific submodules
116116
@set -e
117117
@echo "Updating micropython-steami..."
118118
rm -rf $(CURDIR)/$(MPY_DIR)/lib/micropython-steami-lib
@@ -123,21 +123,48 @@ firmware-update: $(MPY_DIR) ## Update the MicroPython clone and board-specific s
123123
@echo "Updating required submodules for $(BOARD)..."
124124
$(MAKE) -C $(STM32_DIR) BOARD=$(BOARD) submodules
125125

126-
.PHONY: deploy
127-
deploy: deploy-pyocd ## Flash firmware (default: pyocd)
126+
.PHONY: micropython-deploy
127+
micropython-deploy: micropython-deploy-pyocd ## Flash MicroPython firmware (default: pyocd)
128128

129-
.PHONY: deploy-pyocd
130-
deploy-pyocd: $(MPY_DIR) ## Flash firmware via pyOCD (CMSIS-DAP)
129+
.PHONY: micropython-deploy-pyocd
130+
micropython-deploy-pyocd: $(MPY_DIR) ## Flash MicroPython firmware via pyOCD (CMSIS-DAP)
131131
$(PYTHON) -m pyocd flash $(STM32_DIR)/build-$(BOARD)/firmware.elf --format elf
132132

133-
.PHONY: deploy-openocd
134-
deploy-openocd: $(MPY_DIR) ## Flash firmware via OpenOCD
133+
.PHONY: micropython-deploy-openocd
134+
micropython-deploy-openocd: $(MPY_DIR) ## Flash MicroPython 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
137+
.PHONY: micropython-deploy-usb
138+
micropython-deploy-usb: $(MPY_DIR) ## Flash MicroPython firmware via DAPLink USB mass-storage
139139
@$(PYTHON) scripts/deploy_usb.py $(STM32_DIR)/build-$(BOARD)/firmware.bin
140140

141+
# --- Deprecated targets (ambiguous since DAPLink build is also planned) ---
142+
# Replaced by explicit micropython-* / daplink-* targets to avoid confusion
143+
# about which firmware is being built or flashed.
144+
145+
define DEPRECATED_FIRMWARE
146+
@echo "Error: 'make $(1)' is ambiguous. Use one of:"; \
147+
echo " make micropython-$(2) (MicroPython firmware)"; \
148+
echo " make daplink-$(2) (DAPLink firmware, see #377)"; \
149+
exit 1
150+
endef
151+
152+
.PHONY: firmware firmware-update firmware-clean deploy deploy-pyocd deploy-openocd deploy-usb
153+
firmware:
154+
$(call DEPRECATED_FIRMWARE,firmware,firmware)
155+
firmware-update:
156+
$(call DEPRECATED_FIRMWARE,firmware-update,update)
157+
firmware-clean:
158+
$(call DEPRECATED_FIRMWARE,firmware-clean,clean)
159+
deploy:
160+
$(call DEPRECATED_FIRMWARE,deploy,deploy)
161+
deploy-pyocd:
162+
$(call DEPRECATED_FIRMWARE,deploy-pyocd,deploy-pyocd)
163+
deploy-openocd:
164+
$(call DEPRECATED_FIRMWARE,deploy-openocd,deploy-openocd)
165+
deploy-usb:
166+
$(call DEPRECATED_FIRMWARE,deploy-usb,deploy-usb)
167+
141168
.PHONY: run
142169
run: ## Run a script on the board with live output (SCRIPT=path/to/file.py)
143170
@if [ -z "$(SCRIPT)" ]; then \
@@ -158,8 +185,8 @@ deploy-script: ## Deploy a script as main.py for autonomous execution (SCRIPT=pa
158185
run-main: ## Re-execute main.py on the board and capture output
159186
$(PYTHON) -m mpremote connect $(PORT) exec "exec(open('/flash/main.py').read())"
160187

161-
.PHONY: firmware-clean
162-
firmware-clean: ## Clean firmware build artifacts
188+
.PHONY: micropython-clean
189+
micropython-clean: ## Clean MicroPython firmware build artifacts
163190
@if [ -d "$(STM32_DIR)" ]; then \
164191
$(MAKE) -C $(STM32_DIR) BOARD=$(BOARD) clean; \
165192
fi

lib/steami_config/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
Persistent configuration module for the STeaMi board.
44

55
Configuration data (board info, sensor calibration) is stored as compact JSON
6-
in the STM32F103 internal flash config zone (1 KB) and survives firmware
7-
updates and `clear_flash` operations.
6+
in the STM32F103 internal flash config zone (1 KB) and survives MicroPython
7+
firmware updates and `clear_flash` operations.
88

99
---
1010

lib/steami_config/examples/calibrate_temperature.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
config zone and survive power cycles.
66
77
Note: this example assumes the drivers are frozen into the firmware.
8-
Use ``make firmware && make deploy`` to build a firmware with the
9-
latest drivers before running this script.
8+
Use ``make micropython-firmware && make micropython-deploy`` to build a
9+
firmware with the latest drivers before running this script.
1010
"""
1111

1212
from time import sleep_ms

lib/wsen-hids/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -308,4 +308,4 @@ The `examples/` directory provides practical scripts demonstrating how to use th
308308
| `data_logger.py` | Log data every 5 seconds in CSV format (`timestamp, humidity, temperature`) for serial capture |
309309
| `dew_point.py` | Compute and display dew point using temperature and humidity (Magnus formula) |
310310
| `heater_demo.py` | Demonstrate the built-in heater: compare readings before and after enabling it |
311-
| `low_power_sampling.py` | Low-power sampling: one-shot every 10 s with `power_off()` between reads. Requires firmware >= v0.1.0 (#238) |
311+
| `low_power_sampling.py` | Low-power sampling: one-shot every 10 s with `power_off()` between reads. Requires MicroPython firmware >= v0.1.0 (#238) |

scripts/deploy_usb.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ def main():
139139
firmware = sys.argv[1]
140140
if not os.path.isfile(firmware):
141141
print("Error: firmware binary not found: " + firmware, file=sys.stderr)
142-
print("Run 'make firmware' first.", file=sys.stderr)
142+
print("Run 'make micropython-firmware' first.", file=sys.stderr)
143143
sys.exit(1)
144144

145145
mount = find_steami()

0 commit comments

Comments
 (0)