Skip to content

fix: Force frozen rebuild and switch deploy to pyOCD.#379

Merged
nedseb merged 4 commits intomainfrom
fix/force-frozen-rebuild
Apr 13, 2026
Merged

fix: Force frozen rebuild and switch deploy to pyOCD.#379
nedseb merged 4 commits intomainfrom
fix/force-frozen-rebuild

Conversation

@nedseb
Copy link
Copy Markdown
Contributor

@nedseb nedseb commented Apr 10, 2026

Closes #348

Summary

Two changes to fix the firmware build and deploy workflow:

1. Force frozen module regeneration

Delete frozen_content.c before each build to force MicroPython to regenerate it. This ensures that driver modifications are always included in the firmware, even when timestamps are stale due to the symlink.

2. Switch default deploy to pyOCD

Replace OpenOCD with pyOCD as the default flash tool. pyOCD reliably detects the STeaMi board via CMSIS-DAP and flashes correctly, while OpenOCD has issues (#380).

New targets:

  • make deploy — alias for deploy-pyocd (default)
  • make deploy-pyocd — flash via pyOCD
  • make deploy-openocd — flash via OpenOCD (kept for compatibility)

3. Install pyOCD via pip

Added flash optional dependency group in pyproject.toml with pyocd>=0.44. make install now installs .[dev,test,flash].

Verified

  • make firmware && make deploy — builds and flashes correctly via pyOCD
  • Board runs updated firmware after deploy
  • pyOCD auto-detects the STeaMi board (no target pack needed)

Copilot AI review requested due to automatic review settings April 10, 2026 13:54
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Forces MicroPython’s frozen_content.c to be regenerated on each firmware build to prevent stale frozen-module content when local driver sources are symlinked and timestamps don’t trigger rebuilds.

Changes:

  • Remove ports/stm32/build-$(BOARD)/frozen_content.c before invoking the STM32 build to force regeneration of frozen module content.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@nedseb nedseb force-pushed the fix/force-frozen-rebuild branch from b286ce6 to 09aaed1 Compare April 12, 2026 17:32
@nedseb nedseb changed the title fix: Force frozen module regeneration on every firmware build. fix: Force frozen rebuild and switch deploy to pyOCD. Apr 12, 2026
@nedseb nedseb requested a review from Copilot April 12, 2026 17:36
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 126 to +131
.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
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.

@nedseb nedseb merged commit 4004540 into main Apr 13, 2026
9 checks passed
@nedseb nedseb deleted the fix/force-frozen-rebuild branch April 13, 2026 02:07
semantic-release-updater bot pushed a commit that referenced this pull request Apr 13, 2026
## [0.16.2](v0.16.1...v0.16.2) (2026-04-13)

### Bug Fixes

* Force frozen rebuild and switch deploy to pyOCD. ([#379](#379)) ([4004540](4004540))
@semantic-release-updater
Copy link
Copy Markdown

🎉 This PR is included in version 0.16.2 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix: make deploy does not update firmware reliably.

2 participants