diff --git a/sim/src/api.rs b/sim/src/api.rs index 71d46430..ec502a2d 100644 --- a/sim/src/api.rs +++ b/sim/src/api.rs @@ -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 + }, } } diff --git a/sim/src/flash.rs b/sim/src/flash.rs index 797a044d..adbb69a3 100644 --- a/sim/src/flash.rs +++ b/sim/src/flash.rs @@ -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);