Skip to content

feat(dfu_ext): Add ext dfu flash - #4

Draft
Schievel1 wants to merge 5 commits into
mainfrom
add-ext-DFU-flash
Draft

feat(dfu_ext): Add ext dfu flash#4
Schievel1 wants to merge 5 commits into
mainfrom
add-ext-DFU-flash

Conversation

@Schievel1

Copy link
Copy Markdown
Collaborator

adds possibilty to use external flash as dfu partition

@Schievel1
Schievel1 force-pushed the add-ext-DFU-flash branch 6 times, most recently from 61dd81a to 92c4abc Compare August 16, 2026 12:33
@Schievel1
Schievel1 requested a lite review from Copilot August 17, 2026 04:42

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR extends the bootloader to support using an external SPI NOR flash (W25Q-class) as the DFU download partition (dfu_ext), alongside adding a noswap build mode and broadening nRF support to include nRF52833 (via a shared nrf528xx feature). It also introduces optional defmt RTT logging and updates the build/release tooling and documentation to cover the new variants.

Changes:

  • Add dfu_ext flow: external SPI flash is used as the DFU partition for swap-based updates (RP2040 + nRF52) and for USB DFU (nRF52).
  • Add noswap flow: disable swap logic and boot ACTIVE directly, with updated build variants and docs.
  • Add nRF52833 support and unify nRF gating under nrf528xx; update build scripts, release workflow, and README accordingly.

Reviewed changes

Copilot reviewed 31 out of 50 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
src/rp2040.rs Adds dfu_ext external-flash DFU partition support and refactors swap/boot flow gating.
src/nrf52840.rs Unifies nRF boot flow under nrf528xx and adds dfu_ext external-flash DFU partition + USB DFU entry handling.
src/main.rs Adds feature exclusivity checks, shared SWAP_PAGE_SIZE, optional defmt startup logging, and makes current_progress mutex-generic.
src/led_pwm.rs Renames nRF feature gating from nrf52840 to nrf528xx.
src/driver/w25q.rs New W25Q-compatible SPI NOR flash driver implementing embedded_storage NOR flash traits.
src/driver/mod.rs New driver module export for the W25Q flash implementation.
src/dfu.rs Adds run_dfu_usb_ext for writing DFU images to external SPI flash (nRF52), plus defmt logging hooks.
rmk-boot-rp2040-8mb.hex Adds/updates prebuilt Intel HEX artifact for RP2040 8MB variant.
rmk-boot-rp2040-8mb-noswap.hex Adds/updates prebuilt Intel HEX artifact for RP2040 8MB noswap variant.
rmk-boot-rp2040-4mb.hex Adds/updates prebuilt Intel HEX artifact for RP2040 4MB variant.
rmk-boot-rp2040-4mb-noswap.hex Adds/updates prebuilt Intel HEX artifact for RP2040 4MB noswap variant.
rmk-boot-rp2040-2mb.hex Adds/updates prebuilt Intel HEX artifact for RP2040 2MB variant.
rmk-boot-rp2040-2mb-noswap.hex Adds/updates prebuilt Intel HEX artifact for RP2040 2MB noswap variant.
rmk-boot-rp2040-16mb-noswap.hex Adds/updates prebuilt Intel HEX artifact for RP2040 16MB noswap variant.
Readme.org Updates docs for nRF52833, noswap, dfu_ext, build targets, LED patterns, and SPI pin defaults.
Makefile.toml Expands cargo-make tasks to cover nRF52833, noswap, and dfu_ext UF2/HEX build matrices; renames RP2040 tasks.
Cargo.toml Adds nrf528xx feature factoring, nrf52833, noswap, dfu_ext, and optional defmt dependencies/features.
Cargo.lock Updates lockfile for new dependencies/features (notably defmt and related transitive deps).
build.rs Extends layout generation for noswap/dfu_ext, adds nRF52833 RAM sizing and variant slugging, and adds defmt link arg.
.github/workflows/release.yml Builds and uploads additional nRF52833 and noswap ELF assets; broadens uploaded asset patterns.
.cargo/config.toml Sets DEFMT_LOG=trace environment variable for builds.
Suppressed comments (1)

src/nrf52840.rs:120

  • Same issue as above: ext_mutex_data is stack-local, but ext_mutex is created as &'static via addr_of!, which is undefined behavior. This also means the DFU partition backing store may alias invalid memory during bootloader swap operations.

Please move the external-flash mutex into static storage (e.g. static mut MaybeUninit<...> + one-time init) and reference that instead of extending a stack reference to 'static.


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread src/nrf52840.rs Outdated
Comment thread src/dfu.rs Outdated
Comment thread src/rp2040.rs
@Schievel1
Schievel1 force-pushed the add-ext-DFU-flash branch 2 times, most recently from ea8ea19 to daf823e Compare August 18, 2026 10:45
@Schievel1 Schievel1 mentioned this pull request Aug 18, 2026
@Schievel1
Schievel1 force-pushed the add-ext-DFU-flash branch 3 times, most recently from cd12d06 to 906a683 Compare August 19, 2026 06:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants