@@ -742,8 +742,7 @@ impl Images {
742
742
fails += 1 ;
743
743
}
744
744
745
- if !self . verify_trailers ( & flash, 1 , BOOT_MAGIC_UNSET ,
746
- BOOT_FLAG_UNSET , BOOT_FLAG_UNSET ) {
745
+ if !self . verify_post_upgrade_secondary_trailer ( & flash) {
747
746
warn ! ( "Mismatched trailer for the secondary slot" ) ;
748
747
fails += 1 ;
749
748
}
@@ -792,8 +791,7 @@ impl Images {
792
791
error ! ( "Mismatched trailer for the primary slot" ) ;
793
792
fails += 1 ;
794
793
}
795
- if !self . verify_trailers ( & flash, 1 , BOOT_MAGIC_UNSET ,
796
- BOOT_FLAG_UNSET , BOOT_FLAG_UNSET ) {
794
+ if !self . verify_post_upgrade_secondary_trailer ( & flash) {
797
795
error ! ( "Mismatched trailer for the secondary slot" ) ;
798
796
fails += 1 ;
799
797
}
@@ -852,13 +850,14 @@ impl Images {
852
850
warn ! ( "Primary slot image verification FAIL" ) ;
853
851
fails += 1 ;
854
852
}
853
+
855
854
if !self . verify_trailers ( & flash, 0 , BOOT_MAGIC_GOOD ,
856
855
BOOT_FLAG_UNSET , BOOT_FLAG_SET ) {
857
856
warn ! ( "Mismatched trailer for the primary slot" ) ;
858
857
fails += 1 ;
859
858
}
860
- if ! self . verify_trailers ( & flash , 1 , BOOT_MAGIC_UNSET ,
861
- BOOT_FLAG_UNSET , BOOT_FLAG_UNSET ) {
859
+
860
+ if ! self . verify_post_upgrade_secondary_trailer ( & flash ) {
862
861
warn ! ( "Mismatched trailer for the secondary slot" ) ;
863
862
fails += 1 ;
864
863
}
@@ -1530,8 +1529,7 @@ impl Images {
1530
1529
warn ! ( "Mismatched trailer for the primary slot before revert" ) ;
1531
1530
fails += 1 ;
1532
1531
}
1533
- if !self . verify_trailers ( & flash, 1 , BOOT_MAGIC_UNSET ,
1534
- BOOT_FLAG_UNSET , BOOT_FLAG_UNSET ) {
1532
+ if !self . verify_post_upgrade_secondary_trailer ( & flash) {
1535
1533
warn ! ( "Mismatched trailer for the secondary slot before revert" ) ;
1536
1534
fails += 1 ;
1537
1535
}
@@ -1670,6 +1668,17 @@ impl Images {
1670
1668
} )
1671
1669
}
1672
1670
1671
+ // Verify the trailers in the secondary slot contains the expected values after an upgrade.
1672
+ fn verify_post_upgrade_secondary_trailer ( & self , flash : & SimMultiFlash ) -> bool {
1673
+ if Caps :: SwapUsingMove . present ( ) {
1674
+ return self . verify_trailers ( & flash, 1 , BOOT_MAGIC_GOOD ,
1675
+ BOOT_FLAG_UNSET , BOOT_FLAG_SET ) ;
1676
+ } else {
1677
+ return self . verify_trailers ( & flash, 1 , BOOT_MAGIC_UNSET ,
1678
+ BOOT_FLAG_UNSET , BOOT_FLAG_UNSET ) ;
1679
+ }
1680
+ }
1681
+
1673
1682
/// Mark each of the images for permanent upgrade.
1674
1683
fn mark_permanent_upgrades ( & self , flash : & mut SimMultiFlash , slot : usize ) {
1675
1684
for image in & self . images {
0 commit comments