Skip to content

Commit

Permalink
Ignore, define check updates which will be squashed later
Browse files Browse the repository at this point in the history
  • Loading branch information
nordicjm committed Jan 2, 2025
1 parent 304560e commit d7f3058
Show file tree
Hide file tree
Showing 9 changed files with 16 additions and 10 deletions.
1 change: 1 addition & 0 deletions boot/bootutil/include/bootutil/boot_status.h
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ enum mcuboot_mode {
MCUBOOT_MODE_RAM_LOAD,
MCUBOOT_MODE_FIRMWARE_LOADER,
MCUBOOT_MODE_SINGLE_SLOT_RAM_LOAD,
MCUBOOT_MODE_SWAP_USING_OFFSET,
};

enum mcuboot_signature_type {
Expand Down
2 changes: 1 addition & 1 deletion boot/bootutil/include/bootutil/bootutil_public.h
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ extern "C" {

#ifdef MCUBOOT_BOOT_MAX_ALIGN

#if defined(MCUBOOT_SWAP_USING_MOVE) || defined(MCUBOOT_SWAP_USING_SCRATCH)
#if defined(MCUBOOT_SWAP_USING_MOVE) || defined(MCUBOOT_SWAP_USING_SCRATCH) || defined(MCUBOOT_SWAP_USING_OFFSET)
_Static_assert(MCUBOOT_BOOT_MAX_ALIGN >= 8 && MCUBOOT_BOOT_MAX_ALIGN <= 32,
"Unsupported value for MCUBOOT_BOOT_MAX_ALIGN for SWAP upgrade modes");
#endif
Expand Down
1 change: 1 addition & 0 deletions boot/bootutil/include/bootutil/caps.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ uint32_t bootutil_get_caps(void);
#define BOOTUTIL_CAP_DIRECT_XIP (1<<17)
#define BOOTUTIL_CAP_HW_ROLLBACK_PROT (1<<18)
#define BOOTUTIL_CAP_ECDSA_P384 (1<<19)
#define BOOTUTIL_CAP_SWAP_USING_OFFSET (1<<20)

/*
* Query the number of images this bootloader is configured for. This
Expand Down
2 changes: 2 additions & 0 deletions boot/bootutil/src/boot_record.c
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,8 @@ int boot_save_shared_data(const struct image_header *hdr, const struct flash_are
uint8_t mode = MCUBOOT_MODE_UPGRADE_ONLY;
#elif defined(MCUBOOT_SWAP_USING_MOVE)
uint8_t mode = MCUBOOT_MODE_SWAP_USING_MOVE;
#elif defined(MCUBOOT_SWAP_USING_OFFSET)
uint8_t mode = MCUBOOT_MODE_SWAP_USING_OFFSET;
#elif defined(MCUBOOT_DIRECT_XIP)
#if defined(MCUBOOT_DIRECT_XIP_REVERT)
uint8_t mode = MCUBOOT_MODE_DIRECT_XIP_WITH_REVERT;
Expand Down
2 changes: 1 addition & 1 deletion boot/bootutil/src/bootutil_misc.c
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,7 @@ uint32_t bootutil_max_image_size(const struct flash_area *fap)
#if defined(MCUBOOT_SWAP_USING_SCRATCH) || defined(MCUBOOT_SINGLE_APPLICATION_SLOT) || \
defined(MCUBOOT_FIRMWARE_LOADER) || defined(MCUBOOT_SINGLE_APPLICATION_SLOT_RAM_LOAD)
return boot_status_off(fap);
#elif defined(MCUBOOT_SWAP_USING_MOVE)
#elif defined(MCUBOOT_SWAP_USING_MOVE) || defined(MCUBOOT_SWAP_USING_OFFSET)
struct flash_sector sector;
/* get the last sector offset */
int rc = flash_area_get_sector(fap, boot_status_off(fap), &sector);
Expand Down
2 changes: 2 additions & 0 deletions boot/bootutil/src/caps.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ uint32_t bootutil_get_caps(void)
res |= BOOTUTIL_CAP_OVERWRITE_UPGRADE;
#elif defined(MCUBOOT_SWAP_USING_MOVE)
res |= BOOTUTIL_CAP_SWAP_USING_MOVE;
#elif defined(MCUBOOT_SWAP_USING_OFFSET)
res |= BOOTUTIL_CAP_SWAP_USING_OFFSET;
#else
res |= BOOTUTIL_CAP_SWAP_USING_SCRATCH;
#endif
Expand Down
6 changes: 3 additions & 3 deletions boot/bootutil/src/loader.c
Original file line number Diff line number Diff line change
Expand Up @@ -991,7 +991,7 @@ boot_validate_slot(struct boot_loader_state *state, int slot,
if (boot_check_header_erased(state, slot) == 0 ||
(hdr->ih_flags & IMAGE_F_NON_BOOTABLE)) {

#if defined(MCUBOOT_SWAP_USING_SCRATCH) || defined(MCUBOOT_SWAP_USING_MOVE)
#if defined(MCUBOOT_SWAP_USING_SCRATCH) || defined(MCUBOOT_SWAP_USING_MOVE) || defined(MCUBOOT_SWAP_USING_OFFSET)
/*
* This fixes an issue where an image might be erased, but a trailer
* be left behind. It can happen if the image is in the secondary slot
Expand Down Expand Up @@ -1921,7 +1921,7 @@ boot_prepare_image_for_update(struct boot_loader_state *state,
}
#endif

#if defined(MCUBOOT_SWAP_USING_SCRATCH) || defined(MCUBOOT_SWAP_USING_MOVE)
#if defined(MCUBOOT_SWAP_USING_SCRATCH) || defined(MCUBOOT_SWAP_USING_MOVE) || defined(MCUBOOT_SWAP_USING_OFFSET)
/*
* Must re-read image headers because the boot status might
* have been updated in the previous function call.
Expand Down Expand Up @@ -2094,7 +2094,7 @@ static int
check_downgrade_prevention(struct boot_loader_state *state)
{
#if defined(MCUBOOT_DOWNGRADE_PREVENTION) && \
(defined(MCUBOOT_SWAP_USING_MOVE) || defined(MCUBOOT_SWAP_USING_SCRATCH))
(defined(MCUBOOT_SWAP_USING_MOVE) || defined(MCUBOOT_SWAP_USING_SCRATCH) || defined(MCUBOOT_SWAP_USING_OFFSET))
uint32_t security_counter[2];
int rc;

Expand Down
4 changes: 2 additions & 2 deletions boot/bootutil/src/swap_misc.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@

BOOT_LOG_MODULE_DECLARE(mcuboot);

#if defined(MCUBOOT_SWAP_USING_SCRATCH) || defined(MCUBOOT_SWAP_USING_MOVE)
#if defined(MCUBOOT_SWAP_USING_SCRATCH) || defined(MCUBOOT_SWAP_USING_MOVE) || defined(MCUBOOT_SWAP_USING_OFFSET)
int
swap_erase_trailer_sectors(const struct boot_loader_state *state,
const struct flash_area *fap)
Expand Down Expand Up @@ -231,4 +231,4 @@ swap_set_image_ok(uint8_t image_index)
}


#endif /* defined(MCUBOOT_SWAP_USING_SCRATCH) || defined(MCUBOOT_SWAP_USING_MOVE) */
#endif /* defined(MCUBOOT_SWAP_USING_SCRATCH) || defined(MCUBOOT_SWAP_USING_MOVE) || defined(MCUBOOT_SWAP_USING_OFFSET) */
6 changes: 3 additions & 3 deletions boot/bootutil/src/swap_priv.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

#include "mcuboot_config/mcuboot_config.h"

#if defined(MCUBOOT_SWAP_USING_SCRATCH) || defined(MCUBOOT_SWAP_USING_MOVE)
#if defined(MCUBOOT_SWAP_USING_SCRATCH) || defined(MCUBOOT_SWAP_USING_MOVE) || defined(MCUBOOT_SWAP_USING_OFFSET)

/**
* Calculates the amount of space required to store the trailer, and erases
Expand Down Expand Up @@ -99,9 +99,9 @@ static inline size_t boot_scratch_area_size(const struct boot_loader_state *stat
}
#endif

#endif /* defined(MCUBOOT_SWAP_USING_SCRATCH) || defined(MCUBOOT_SWAP_USING_MOVE) */
#endif /* defined(MCUBOOT_SWAP_USING_SCRATCH) || defined(MCUBOOT_SWAP_USING_MOVE) || defined(MCUBOOT_SWAP_USING_OFFSET) */

#if defined(MCUBOOT_SWAP_USING_MOVE)
#if defined(MCUBOOT_SWAP_USING_MOVE) || defined(MCUBOOT_SWAP_USING_OFFSET)
/**
* Check if device write block sizes are as expected, function should emit an error if there is
* a problem. If true is returned, the slots are marked as compatible, otherwise the slots are
Expand Down

0 comments on commit d7f3058

Please sign in to comment.