Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"dockerfile": "Dockerfile"
},

// USB access for STeaMi board (DAPLink / mpremote / OpenOCD).
// USB access for STeaMi board (DAPLink / mpremote / pyOCD / OpenOCD).
// Privileged mode is required for firmware flashing and board communication.
// This is incompatible with GitHub Codespaces but essential for local use.
"privileged": true,
Expand Down
10 changes: 6 additions & 4 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -120,15 +120,16 @@ For local development (without dev container):
* Python 3.10+
* Node.js 22+ (for husky, commitlint, lint-staged, semantic-release)
* `arm-none-eabi-gcc` toolchain (for `make firmware`)
* OpenOCD (for `make deploy`)
* `pyocd` (for `make deploy`, installed via `pip install -e ".[flash]"`)
* OpenOCD (optional, for `make deploy-openocd`)
* `mpremote` (installed via `pip install -e ".[test]"`)
* GitHub CLI (`gh`)

Then run `make setup` to install all dependencies and git hooks. This creates a `.venv` with ruff, pytest, mpremote, and MicroPython type stubs for Pylance.

## Dev Container

A dev container is available for VS Code (local Docker only, not GitHub Codespaces). It includes all prerequisites out of the box: Python 3.10, Node.js 22, ruff, pytest, mpremote, arm-none-eabi-gcc, OpenOCD, and the GitHub CLI.
A dev container is available for VS Code (local Docker only, not GitHub Codespaces). It includes all prerequisites out of the box: Python 3.10, Node.js 22, ruff, pytest, mpremote, pyOCD, arm-none-eabi-gcc, OpenOCD, and the GitHub CLI.

1. Open the repository in VS Code
2. When prompted, click **Reopen in Container** (or use the command palette: *Dev Containers: Reopen in Container*)
Expand All @@ -139,7 +140,7 @@ The container also provides:
* **zsh + oh-my-zsh** as default shell with persistent shell history
* **Pylance** configured with MicroPython STM32 stubs (no false `import machine` errors)
* **Serial Monitor** extension for board communication
* **USB passthrough** for mpremote, OpenOCD, and firmware flashing (the container runs in privileged mode with `/dev/bus/usb` mounted)
* **USB passthrough** for mpremote, pyOCD, OpenOCD, and firmware flashing (the container runs in privileged mode with `/dev/bus/usb` mounted)
* **udev rules** for the DAPLink interface (auto-started on container creation)

Note: GitHub Codespaces is not supported because the container requires privileged mode and USB device access for board communication.
Expand Down Expand Up @@ -192,7 +193,8 @@ The drivers are "frozen" into the MicroPython firmware for the STeaMi board. The
```bash
make firmware # Clone micropython-steami (if needed), link local drivers, build
make firmware-update # Refresh the MicroPython clone and board-specific submodules
make deploy # Flash firmware via OpenOCD
make deploy # Flash firmware via pyOCD (default)
make deploy-openocd # Flash firmware via OpenOCD (alternative)
make run SCRIPT=lib/steami_config/examples/show_config.py # Run with live output
make deploy-script SCRIPT=lib/.../calibrate_magnetometer.py # Deploy as main.py for autonomous use
make run-main # Re-execute the deployed main.py
Expand Down
12 changes: 10 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ $(VENV_DIR)/bin/activate:

.PHONY: install
install: $(VENV_DIR)/bin/activate node_modules/.package-lock.json ## Install dev tools (pip + npm)
$(VENV_DIR)/bin/pip install -e ".[dev,test]"
$(VENV_DIR)/bin/pip install -e ".[dev,test,flash]"

# --- Linting ---

Expand Down Expand Up @@ -107,6 +107,7 @@ firmware: $(MPY_DIR) ## Build MicroPython firmware with current drivers
rm -rf $(CURDIR)/$(MPY_DIR)/lib/micropython-steami-lib
ln -s $(CURDIR) $(CURDIR)/$(MPY_DIR)/lib/micropython-steami-lib
@echo "Building firmware for $(BOARD)..."
rm -f $(STM32_DIR)/build-$(BOARD)/frozen_content.c
$(MAKE) -C $(STM32_DIR) BOARD=$(BOARD)
@echo "Firmware ready: $(STM32_DIR)/build-$(BOARD)/firmware.hex"

Expand All @@ -123,7 +124,14 @@ firmware-update: $(MPY_DIR) ## Update the MicroPython clone and board-specific s
$(MAKE) -C $(STM32_DIR) BOARD=$(BOARD) submodules

.PHONY: deploy
deploy: $(MPY_DIR) ## Flash firmware to the board via OpenOCD
deploy: deploy-pyocd ## Flash firmware (default: pyocd)

.PHONY: deploy-pyocd
deploy-pyocd: $(MPY_DIR) ## Flash firmware via pyOCD (CMSIS-DAP)
$(PYTHON) -m pyocd flash $(STM32_DIR)/build-$(BOARD)/firmware.elf --format elf
Comment on lines 126 to +131
Copy link

Copilot AI Apr 12, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After switching make deploy to default to pyOCD, the docs are now out of sync: CONTRIBUTING.md still lists OpenOCD as a prerequisite for make deploy and says make deploy flashes via OpenOCD (see CONTRIBUTING.md:123 and :195). Please update the documentation to reflect the new default (deploy→pyOCD) and the OpenOCD compatibility target.

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 291df8b: updated CONTRIBUTING.md to list pyOCD as the prerequisite for make deploy and added make deploy-openocd as the alternative.


.PHONY: deploy-openocd
deploy-openocd: $(MPY_DIR) ## Flash firmware via OpenOCD
$(MAKE) -C $(STM32_DIR) BOARD=$(BOARD) deploy-openocd

.PHONY: run
Expand Down
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ requires-python = ">=3.7"
[project.optional-dependencies]
dev = ["ruff==0.11.6", "micropython-stm32-stubs>=1.24"]
test = ["pytest==7.4.0", "pyyaml==6.0.2", "mpremote>=1.0"]
flash = ["pyocd>=0.44"]

[tool.setuptools]
# No Python packages to install — this project contains MicroPython drivers
Expand Down
Loading