feat(dfu_ext): Add ext dfu flash - #4
Conversation
61dd81a to
92c4abc
Compare
There was a problem hiding this comment.
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_extflow: external SPI flash is used as the DFU partition for swap-based updates (RP2040 + nRF52) and for USB DFU (nRF52). - Add
noswapflow: 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_datais stack-local, butext_mutexis created as&'staticviaaddr_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.
ea8ea19 to
daf823e
Compare
2f005c3 to
c9e9b18
Compare
62e048b to
133ec37
Compare
Signed-off-by: Pascal Jäger <pascal.jaeger@bode-global.com> Signed-off-by: Pascal Jäger <pascal.jaeger@leimstift.de>
cf7cea4 to
307d203
Compare
adds possibilty to use external flash as dfu partition
Also adds noswap feature, to omit DFU and directly flash the firmware to ACTIVE partition.
And defmt feature for logs.