sim: Make misaligned writes panic
To make things a little easier to debug, change misaligned writes to
panics, so that the debugger can more easily intercept them.
diff --git a/sim/src/flash.rs b/sim/src/flash.rs
index b85651c..5b04bf6 100644
--- a/sim/src/flash.rs
+++ b/sim/src/flash.rs
@@ -78,16 +78,16 @@
/// are entirely written as 0xFF.
pub fn write(&mut self, offset: usize, payload: &[u8]) -> Result<()> {
if offset + payload.len() > self.data.len() {
- bail!(ebounds("Write outside of device"));
+ panic!("Write outside of device");
}
// Verify the alignment (which must be a power of two).
if offset & (self.align - 1) != 0 {
- bail!(ewrite("Misaligned write address"));
+ panic!("Misaligned write address");
}
if payload.len() & (self.align - 1) != 0 {
- bail!(ewrite("Write length not multiple of alignment"));
+ panic!("Write length not multiple of alignment");
}
let mut sub = &mut self.data[offset .. offset + payload.len()];