feat(dfu): Embassy boot and dfu flashing#877
Conversation
Size Report
|
0c23f04 to
9363725
Compare
c2c5d32 to
074f4d5
Compare
|
please review the addresses part thoroughly. I find the flash partitioning and the addressing (inside and outside the partition) quite confusing, as you can see with my bugfix commit for the storage start address. |
06ccea8 to
b1dcd26
Compare
58c3290 to
60c5ea6
Compare
ea5197d to
1dd85ce
Compare
Signed-off-by: Pascal Jäger <pascal.jaeger@leimstift.de>
Signed-off-by: Pascal Jäger <pascal.jaeger@leimstift.de>
Signed-off-by: Pascal Jäger <pascal.jaeger@leimstift.de>
Signed-off-by: Pascal Jäger <pascal.jaeger@leimstift.de>
Signed-off-by: Pascal Jäger <pascal.jaeger@leimstift.de>
Signed-off-by: Pascal Jäger <pascal.jaeger@leimstift.de>
update example cargo.locks Signed-off-by: Pascal Jäger <pascal.jaeger@leimstift.de>
HaoboGu
left a comment
There was a problem hiding this comment.
Very nice, thanks for your effort!
|
Thanks again for your effort! Having DFU support is great |
|
Great, thanks for reviewing and merging. I am preparing the follow up with dfu_split support now |
This PR adds DFU (Device Firmware Upgrade) support via embassy-boot for RP2040-based and NRF52840-based keyboards. Once set up, firmware updates can be done over USB with dfu-util — no need to press BOOTSEL/ RESET or use a debug probe.
What's implemented
rmk crate — new dfu_rp feature gate:
rmk-config crate — new [dfu] TOML section:
flash formula
embassy-boot needs a DFU and an ACTIVE partition. ACTIVE is where the actual firmware sits, DFU is where we can put firmware using dfu-utils for example and embassy-boot then copies DFU to ACTIVE.
Apart from that me have:
As a diagram:
In order to partition the flash I use the following constraints:
To calculate the length of ACTIVE, I calculate the remaining flash after subtracting all the fixed size partitions (BOOT2, EMBASSY-BOOT, BOOTLOADER-STATE, STORAGE):
remaining = flash_size - 28K (BOOT2, EMBASSY-BOOT, BOOTLOADER-STATE) - 128K (STORAGE size)The remaining flash must then be equally sized between ACTIVE and DFU, where DFU gets one more page:
ACTIVE size = (remaining - 4K (page size)) / 2DFU size = ACTIVE size + 4K (page size)Then we only need to get the start addresses of DFU and storage:
DFU offset = ACTIVE offset (always 0x10007000) + ACTIVE sizeand
STORAGE offset = DFU offset + DFU sizeExamples:
Documentation:
Feature flags
Usage flow
Perspective / Roadmap
Since embassy-boot is agnostic towards how the updated firmware gets into the DFU partition, this PR lays the foundation for future features like flashing via bluetooth or flashing the peripheral from the central using the serial connection between them.
I think the next steps after merging this should be:
Needs:
Optional: