Add align/erased_val params per flash device
The previous c/rust ffi functions were hardcoding the values of align
and erased_val before each run through static globals. This adds new sim
flash functions that get the align/erased_val from the sim flash device
that is being run on, allowing that later multiple flash devices can
each use its own params.
Signed-off-by: Fabio Utzig <utzig@apache.org>
diff --git a/sim/mcuboot-sys/src/area.rs b/sim/mcuboot-sys/src/area.rs
index c4f437e..08896db 100644
--- a/sim/mcuboot-sys/src/area.rs
+++ b/sim/mcuboot-sys/src/area.rs
@@ -54,7 +54,7 @@
area.push(FlashArea {
flash_id: id,
- device_id: 42,
+ device_id: 0,
pad16: 0,
off: sector.base as u32,
size: sector.size as u32,
@@ -71,7 +71,7 @@
self.areas.push(area);
self.whole.push(FlashArea {
flash_id: id,
- device_id: 42,
+ device_id: 0,
pad16: 0,
off: orig_base as u32,
size: orig_len as u32,
@@ -85,7 +85,7 @@
pub fn add_simple_image(&mut self, base: usize, len: usize, id: FlashId) {
let area = vec![FlashArea {
flash_id: id,
- device_id: 42,
+ device_id: 0,
pad16: 0,
off: base as u32,
size: len as u32,
@@ -94,7 +94,7 @@
self.areas.push(area);
self.whole.push(FlashArea {
flash_id: id,
- device_id: 42,
+ device_id: 0,
pad16: 0,
off: base as u32,
size: len as u32,