-
Notifications
You must be signed in to change notification settings - Fork 935
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: enhance bootloader for multiple flash support #2540
feat: enhance bootloader for multiple flash support #2540
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for looking at this. The previous incarnation of the config did support multiple flashes but somehow it lost this capability. I've usually resorted to do this outside embassy-boot (https://github.com/lulf/watchful/blob/main/firmware/boot/src/main.rs#L68), but having this supported 'natively' is good.
Ah, that explains why the Embassy bootloader doc. page says: Once I get your thoughts on the changes and |
> | ||
{ | ||
/// Create a bootloader config from the flash and address symbols defined in the linkerfile | ||
// #[cfg(target_os = "none")] | ||
pub fn from_linkerfile_blocking(flash: &'a Mutex<NoopRawMutex, RefCell<FLASH>>) -> Self { | ||
pub fn from_linkerfile_blocking( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Personally I don't think this API is too bad. Using a builder doesn't provide that much gain, but perhaps a better rustdoc order explaining the parameters would be appropriate
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done in 634c409.
I updated and compiled all examples. Side note: is it useful to maintain that many I am not sure how to fix CI failures though. Does it test examples on hardware? |
There is no HIL test for the bootloader, but any examples should be added to the ci.sh to ensure they always compile. It's unfortunate that the size increased previously though, and it goes undetected because in ci it compiles with --features skip-include to avoid the double pass. The ci/test is failing on the unit tests in the bootloader though https://ci.embassy.dev/jobs/d45560625688 |
Alright, CI is happy now. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks!
Summary
This pull request introduces a enhancement to the
BootLoaderConfig
andFirmwareUpdaterConfig
in theembassy-boot
crate. The primary goal is to implement support for multiple flash partitions, enabling the bootloader and firmware updater to handleActiveFlash
,DFUFlash
, andStateFlash
independently. This change is particularly beneficial for systems with dual-bank or external flash setups.Key Changes
BootLoaderConfig
andFirmwareUpdaterConfig
have been updated to support different flash partition types.BlockingPartition
andPartition
.bootloader/stm32
andbootloader/stm32wb-dfu
have been updated and a new examplebootloader/stm32-dual-bank
has been introduced.Testing
TODO
from_linkerfile_blocking
api?Your review would be greatly appreciated!
Specifically, I am not fully satisfied with the
from_linkerfile_blocking
when the same flash is used:I see two ways to handle this: a builder pattern or wrapping
&flash
with an Option.