sim: Use `usize` instead of `u8` for alignment
Some devices have a write alignment larger than 128. Allow this within
the simulator, by using `usize` instead of `u8` for the write alignment.
The value is still returned to the C code as an 8-bit integer, but this
help start debugging issues found on these devices.
Signed-off-by: David Brown <david.brown@linaro.org>
diff --git a/sim/src/image.rs b/sim/src/image.rs
index 60369ef..d183c40 100644
--- a/sim/src/image.rs
+++ b/sim/src/image.rs
@@ -84,7 +84,7 @@
/// Construct a new image builder for the given device. Returns
/// Some(builder) if is possible to test this configuration, or None if
/// not possible (for example, if there aren't enough image slots).
- pub fn new(device: DeviceName, align: u8, erased_val: u8) -> Option<Self> {
+ pub fn new(device: DeviceName, align: usize, erased_val: u8) -> Option<Self> {
let (flash, areadesc) = Self::make_device(device, align, erased_val);
let num_images = Caps::get_num_images();
@@ -227,7 +227,7 @@
}
/// Build the Flash and area descriptor for a given device.
- pub fn make_device(device: DeviceName, align: u8, erased_val: u8) -> (SimMultiFlash, AreaDesc) {
+ pub fn make_device(device: DeviceName, align: usize, erased_val: u8) -> (SimMultiFlash, AreaDesc) {
match device {
DeviceName::Stm32f4 => {
// STM style flash. Large sectors, with a large scratch area.