sim: Allow access to the boot response
When the bootloader completes, it fills a response structure with
various information. Move this into the BootGoResult and provide an
accessor for it.
Signed-off-by: David Brown <david.brown@linaro.org>
diff --git a/sim/mcuboot-sys/src/c.rs b/sim/mcuboot-sys/src/c.rs
index f8211d1..5c791b8 100644
--- a/sim/mcuboot-sys/src/c.rs
+++ b/sim/mcuboot-sys/src/c.rs
@@ -20,6 +20,8 @@
Normal {
result: i32,
asserts: u8,
+
+ resp: api::BootRsp,
},
}
@@ -39,6 +41,7 @@
matches!(self, BootGoResult::Normal {
result: 0,
asserts: 0,
+ ..
})
}
@@ -49,6 +52,14 @@
_ => 0,
}
}
+
+ /// Retrieve the 'resp' field that is filled in.
+ pub fn resp(&self) -> Option<&api::BootRsp> {
+ match self {
+ BootGoResult::Normal { resp, .. } => Some(resp),
+ _ => None,
+ }
+ }
}
/// Invoke the bootloader on this flash device.
@@ -86,7 +97,7 @@
if result == -0x13579 {
BootGoResult::Stopped
} else {
- BootGoResult::Normal { result, asserts }
+ BootGoResult::Normal { result, asserts, resp: rsp }
}
}