MYNEWT-518 - Clean up previous commit.
The previous commit for this ticket left the code in a working state.
However, it was not possible for image management to distinguish between
the test and permanent states.
Now, these two states are indicated by the addition of a new swap type:
BOOT_SWAP_TYPE_PERMANENT.
diff --git a/boot/bootutil/src/loader.c b/boot/bootutil/src/loader.c
index e4dfc61..fc20fdb 100644
--- a/boot/bootutil/src/loader.c
+++ b/boot/bootutil/src/loader.c
@@ -143,6 +143,7 @@
static const uint8_t boot_swap_trans_table[][2] = {
/* From To */
{ BOOT_SWAP_TYPE_REVERT, BOOT_SWAP_TYPE_NONE },
+ { BOOT_SWAP_TYPE_PERM, BOOT_SWAP_TYPE_NONE },
{ BOOT_SWAP_TYPE_TEST, BOOT_SWAP_TYPE_REVERT },
};
@@ -974,6 +975,7 @@
swap_type = boot_validated_swap_type();
switch (swap_type) {
case BOOT_SWAP_TYPE_TEST:
+ case BOOT_SWAP_TYPE_PERM:
case BOOT_SWAP_TYPE_REVERT:
rc = boot_copy_image(&bs);
assert(rc == 0);
@@ -1040,6 +1042,7 @@
break;
case BOOT_SWAP_TYPE_TEST:
+ case BOOT_SWAP_TYPE_PERM:
slot = 1;
boot_finalize_test_swap();
break;