Split bootloader implementation into multiple files
This commit is contained in:
22
embassy-boot/boot/src/partition.rs
Normal file
22
embassy-boot/boot/src/partition.rs
Normal file
@ -0,0 +1,22 @@
|
||||
/// A region in flash used by the bootloader.
|
||||
#[derive(Copy, Clone, Debug)]
|
||||
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
|
||||
pub struct Partition {
|
||||
/// Start of the flash region.
|
||||
pub from: usize,
|
||||
/// End of the flash region.
|
||||
pub to: usize,
|
||||
}
|
||||
|
||||
impl Partition {
|
||||
/// Create a new partition with the provided range
|
||||
pub const fn new(from: usize, to: usize) -> Self {
|
||||
Self { from, to }
|
||||
}
|
||||
|
||||
/// Return the length of the partition
|
||||
#[allow(clippy::len_without_is_empty)]
|
||||
pub const fn len(&self) -> usize {
|
||||
self.to - self.from
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user