Skip to content

Commit 52ba928

Browse files
committed
sim: Use largest image for all upgrade strategies
The simulator was testing the upgrade with the largest image possible for all strategies, except for overwrite-only, swap-move and swap-offset because some tests were failing when the maximum image size was used. For overwrite-only, this was due to an incorrect trailer size computation. This has been fixed by 88294be. For swap-move and swap-offset, this was due to the simulator not taking into account the padding needed by those strategies in the primary or secondary slot, but also to incorrect computation of the maximum image size in some cases by the MCUboot library. Both issues have been fixed by the previous commits. Since all those issues have been fixed, the simulator can now be configured to test upgrade with the largest possible image for all strategies. Note that logic needed to generate image of a given image is kept even if not useful anymore at the moment, since that might be needed when test will be added to ensure proper behavior when images of different sizes are used. Signed-off-by: Thomas Altenbach <[email protected]>
1 parent cfa8e42 commit 52ba928

File tree

1 file changed

+3
-9
lines changed

1 file changed

+3
-9
lines changed

sim/src/image.rs

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1747,6 +1747,7 @@ fn show_flash(flash: &dyn Flash) {
17471747
#[derive(Debug)]
17481748
enum ImageSize {
17491749
/// Make the image the specified given size.
1750+
#[allow(dead_code)]
17501751
Given(usize),
17511752
/// Make the image as large as it can be for the partition/device.
17521753
Largest,
@@ -2410,15 +2411,8 @@ trait AsRaw : Sized {
24102411

24112412
/// Determine whether it makes sense to test this configuration with a maximally-sized image.
24122413
/// Returns an ImageSize representing the best size to test, possibly just with the given size.
2413-
fn maximal(size: usize) -> ImageSize {
2414-
if Caps::OverwriteUpgrade.present() ||
2415-
Caps::SwapUsingOffset.present() ||
2416-
Caps::SwapUsingMove.present()
2417-
{
2418-
ImageSize::Given(size)
2419-
} else {
2420-
ImageSize::Largest
2421-
}
2414+
fn maximal(_size: usize) -> ImageSize {
2415+
ImageSize::Largest
24222416
}
24232417

24242418
pub fn show_sizes() {

0 commit comments

Comments
 (0)