Add F7 flash and bootloader support

This commit is contained in:
Matous Hybl
2022-05-03 16:16:37 +02:00
parent f3700b4e42
commit 6d56f772e1
15 changed files with 413 additions and 3 deletions

View File

@ -16,6 +16,7 @@ const FLASH_END: usize = FLASH_BASE + FLASH_SIZE;
#[cfg_attr(any(flash_wl, flash_wb, flash_l0, flash_l1, flash_l4), path = "l.rs")]
#[cfg_attr(flash_f3, path = "f3.rs")]
#[cfg_attr(flash_f7, path = "f7.rs")]
mod family;
pub struct Flash<'d> {
@ -75,7 +76,7 @@ impl<'d> Flash<'d> {
if to < from || to as usize > FLASH_END {
return Err(Error::Size);
}
if from as usize % ERASE_SIZE != 0 || to as usize % ERASE_SIZE != 0 {
if ((to - from) as usize % ERASE_SIZE) != 0 {
return Err(Error::Unaligned);
}
@ -104,6 +105,7 @@ pub enum Error {
Seq,
Protected,
Unaligned,
Parallelism,
}
impl<'d> ErrorType for Flash<'d> {