Skip to content

Commit

Permalink
boot: mynewt: add config for swap without scratch
Browse files Browse the repository at this point in the history
Add Mynewt option to enable building a bootloader that uses an
alternative swap algorithm, that first moves up all sectors in slot1 and
then directly swaps between slot0 and slot1.

Signed-off-by: Fabio Utzig <utzig@apache.org>
  • Loading branch information
utzig committed Nov 22, 2019
1 parent 2ffe525 commit 2668a60
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 0 deletions.
2 changes: 2 additions & 0 deletions boot/mynewt/flash_map_backend/src/flash_map_extended.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@ int flash_area_id_from_multi_image_slot(int image_index, int slot)
switch (slot) {
case 0: return FLASH_AREA_IMAGE_PRIMARY(image_index);
case 1: return FLASH_AREA_IMAGE_SECONDARY(image_index);
#if MCUBOOT_USE_SCRATCH
case 2: return FLASH_AREA_IMAGE_SCRATCH;
#endif
}
return 255;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,9 @@
MYNEWT_VAL(BOOTUTIL_ENCRYPT_EC256)
#define MCUBOOT_ENC_IMAGES 1
#endif
#if MYNEWT_VAL(BOOTUTIL_SWAP_MOVE)
#define MCUBOOT_SWAP_MOVE 1
#endif
#if MYNEWT_VAL(BOOTUTIL_OVERWRITE_ONLY)
#define MCUBOOT_OVERWRITE_ONLY 1
#endif
Expand Down
3 changes: 3 additions & 0 deletions boot/mynewt/mcuboot_config/syscfg.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,9 @@ syscfg.defs:
BOOTUTIL_USE_TINYCRYPT:
description: 'Use tinycrypt for crypto operations.'
value: 0
BOOTUTIL_SWAP_MOVE:
description: 'Perform swap without requiring scratch.'
value: 0
BOOTUTIL_OVERWRITE_ONLY:
description: 'Non-swapping upgrades, copy from slot 1 to slot 0 only.'
value: 0
Expand Down

0 comments on commit 2668a60

Please sign in to comment.