Skip to content

Commit 32d6592

Browse files
committed
Fixed regression on powerfail resume
1 parent 68f3bfa commit 32d6592

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

src/update_flash.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -464,10 +464,7 @@ static int RAMFUNCTION wolfBoot_update(int fallback_allowed)
464464
if (flag != SECT_FLAG_NEW &&
465465
wolfBoot_get_partition_state(PART_UPDATE, &st) == 0 &&
466466
st == IMG_STATE_UPDATING) {
467-
if (cur_v == up_v) {
468-
inverse = 0;
469-
}
470-
else if (cur_v < up_v) {
467+
if ((cur_v == 0) || (cur_v == up_v)) {
471468
inverse = 1;
472469
inverse_resume = 1;
473470
}

tools/scripts/sim-update-powerfail-resume.sh

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,13 @@ if [ "x$V" != "x1" ]; then
3838
fi
3939

4040
if [ "x$V" != "x1" ]; then
41-
echo "Failed fallback (V: $V)"
42-
exit 1
41+
echo "Did not fallback (V: $V)"
42+
echo "Retrying get_version after reboot..."
43+
V=`./wolfboot.elf get_version 2>/dev/null`
44+
if [ "x$V" != "x1" ]; then
45+
echo "Error: failed fallback (V: $V)"
46+
exit 1
47+
fi
4348
fi
4449

4550
echo Test successful.

0 commit comments

Comments
 (0)