diff --git a/boot/bootutil/include/bootutil/bootutil_public.h b/boot/bootutil/include/bootutil/bootutil_public.h index 421d854b1..a0ee5872a 100644 --- a/boot/bootutil/include/bootutil/bootutil_public.h +++ b/boot/bootutil/include/bootutil/bootutil_public.h @@ -129,6 +129,14 @@ _Static_assert(MCUBOOT_BOOT_MAX_ALIGN >= 8 && MCUBOOT_BOOT_MAX_ALIGN <= 32, (swap_info) = (image) << 4 \ | (type); \ } + +enum boot_slot { + BOOT_SLOT_PRIMARY = 0, /* Primary slot */ + BOOT_SLOT_SECONDARY = 1, /* Secondary slot */ + BOOT_SLOT_COUNT = 2, /* Number of slots */ + BOOT_SLOT_NONE = UINT32_MAX /* special value representing no active slot */ +}; + #ifdef MCUBOOT_HAVE_ASSERT_H #include "mcuboot_config/mcuboot_assert.h" #else diff --git a/boot/bootutil/src/bootutil_priv.h b/boot/bootutil/src/bootutil_priv.h index c0a285bbe..4e0260a50 100644 --- a/boot/bootutil/src/bootutil_priv.h +++ b/boot/bootutil/src/bootutil_priv.h @@ -51,7 +51,7 @@ struct flash_area; #define BOOT_TMPBUF_SZ 256 -#define NO_ACTIVE_SLOT UINT32_MAX +#define NO_ACTIVE_SLOT BOOT_SLOT_NONE /** Number of image slots in flash; currently limited to two. */ #if defined(MCUBOOT_SINGLE_APPLICATION_SLOT) || defined(MCUBOOT_SINGLE_APPLICATION_SLOT_RAM_LOAD) @@ -222,8 +222,8 @@ _Static_assert(sizeof(boot_img_magic) == BOOT_MAGIC_SZ, "Invalid size for image /** Maximum number of image sectors supported by the bootloader. */ #define BOOT_STATUS_MAX_ENTRIES BOOT_MAX_IMG_SECTORS -#define BOOT_PRIMARY_SLOT 0 -#define BOOT_SECONDARY_SLOT 1 +#define BOOT_PRIMARY_SLOT BOOT_SLOT_PRIMARY +#define BOOT_SECONDARY_SLOT BOOT_SLOT_SECONDARY #define BOOT_STATUS_SOURCE_NONE 0 #define BOOT_STATUS_SOURCE_SCRATCH 1