Merge pull request #35 from utzig/increase-sim-debug-info
Add extra information on errors
This commit is contained in:
commit
bef227c3a0
|
@ -29,6 +29,9 @@ pub extern fn sim_flash_write(dev: *mut Flash, offset: u32, src: *const u8, size
|
|||
fn map_err(err: Result<()>) -> libc::c_int {
|
||||
match err {
|
||||
Ok(()) => 0,
|
||||
Err(_) => -1,
|
||||
Err(e) => {
|
||||
warn!("{}", e);
|
||||
-1
|
||||
},
|
||||
}
|
||||
}
|
||||
|
|
|
@ -94,8 +94,10 @@ impl Flash {
|
|||
}
|
||||
|
||||
let mut sub = &mut self.data[offset .. offset + payload.len()];
|
||||
if sub.iter().any(|x| *x != 0xFF) {
|
||||
bail!(ewrite(format!("Write to non-FF location: offset: {:x}", offset)));
|
||||
for (i, x) in sub.iter().enumerate() {
|
||||
if *x != 0xFF {
|
||||
bail!(ewrite(format!("Write to non-FF location at 0x{:x}", offset + i)));
|
||||
}
|
||||
}
|
||||
|
||||
sub.copy_from_slice(payload);
|
||||
|
|
Loading…
Reference in New Issue