Replace flash partitioning terminology
This change replaces the slot 0/1 terminology with primary/secondary
slot and replaces FLASH_AREA_IMAGE_0/1 with
FLASH_AREA_IMAGE_PRIMARY/SECONDARY. This naming convention may be more
understandable, fits better to MCUs with multiple images and it is an
architecture agnostic alternative as well.
Change-Id: I655a585f6ae023852c671ee6635399efe25209c9
Signed-off-by: David Vincze <david.vincze@arm.com>
Signed-off-by: David Brown <david.brown@linaro.org>
diff --git a/boot/zephyr/Kconfig b/boot/zephyr/Kconfig
index 29193d1..4e75cef 100644
--- a/boot/zephyr/Kconfig
+++ b/boot/zephyr/Kconfig
@@ -72,11 +72,11 @@
default "mcuboot-mbedtls-cfg.h"
config BOOT_VALIDATE_SLOT0
- bool "Validate image slot 0 on every boot"
+ bool "Validate image in the primary slot on every boot"
default y
help
- If y, the bootloader attempts to validate the signature of
- slot0 every boot. This adds the signature check time to
+ If y, the bootloader attempts to validate the signature of the
+ primary slot every boot. This adds the signature check time to
every boot, but can mitigate against some changes that are
able to modify the flash image itself.
@@ -84,25 +84,25 @@
bool "Overwrite image updates instead of swapping"
default n
help
- If y, overwrite slot0 with the upgrade image instead of
- swapping them. This prevents the fallback recovery, but
+ If y, overwrite the primary slot with the upgrade image instead
+ of swapping them. This prevents the fallback recovery, but
uses a much simpler code path.
config BOOT_BOOTSTRAP
- bool "Boostrap erased slot0 from slot1"
+ bool "Boostrap erased the primary slot from the secondary slot"
default n
help
If y, enables bootstraping support. Bootstrapping allows an erased
- slot0 to be initialized from a valid image in slot1.
+ primary slot to be initialized from a valid image in the secondary slot.
If unsure, leave at the default value.
config BOOT_ENCRYPT_RSA
bool "Support for encrypted upgrade images"
default n
help
- If y, images in slot 1 can be encrypted and are decrypted
- on the fly when upgrading to slot 0, as well as encrypted
- back when swapping from slot 0 to slot 1.
+ If y, images in the secondary slot can be encrypted and are decrypted
+ on the fly when upgrading to the primary slot, as well as encrypted
+ back when swapping from the primary slot to the secondary slot.
config BOOT_MAX_IMG_SECTORS
int "Maximum number of sectors per image slot"
diff --git a/boot/zephyr/flash_map_extended.c b/boot/zephyr/flash_map_extended.c
index 0c3d428..1b1b5ad 100644
--- a/boot/zephyr/flash_map_extended.c
+++ b/boot/zephyr/flash_map_extended.c
@@ -50,12 +50,13 @@
/*
* This depends on the mappings defined in sysflash.h.
- * MCUBoot uses continuous numbering for slot 0, slot 1, and the scratch
- * while zephyr might number it differently.
+ * MCUBoot uses continuous numbering for the primary slot, the secondary slot,
+ * and the scratch while zephyr might number it differently.
*/
int flash_area_id_from_image_slot(int slot)
{
- static const int area_id_tab[] = {FLASH_AREA_IMAGE_0, FLASH_AREA_IMAGE_1,
+ static const int area_id_tab[] = {FLASH_AREA_IMAGE_PRIMARY,
+ FLASH_AREA_IMAGE_SECONDARY,
FLASH_AREA_IMAGE_SCRATCH};
if (slot >= 0 && slot < ARRAY_SIZE(area_id_tab)) {
diff --git a/boot/zephyr/include/mcuboot_config/mcuboot_config.h b/boot/zephyr/include/mcuboot_config/mcuboot_config.h
index d30e108..dc70614 100644
--- a/boot/zephyr/include/mcuboot_config/mcuboot_config.h
+++ b/boot/zephyr/include/mcuboot_config/mcuboot_config.h
@@ -31,7 +31,7 @@
#endif
#ifdef CONFIG_BOOT_VALIDATE_SLOT0
-#define MCUBOOT_VALIDATE_SLOT0
+#define MCUBOOT_VALIDATE_PRIMARY_SLOT
#endif
#ifdef CONFIG_BOOT_UPGRADE_ONLY
diff --git a/boot/zephyr/include/sysflash/sysflash.h b/boot/zephyr/include/sysflash/sysflash.h
index 0fef026..2492244 100644
--- a/boot/zephyr/include/sysflash/sysflash.h
+++ b/boot/zephyr/include/sysflash/sysflash.h
@@ -5,8 +5,8 @@
#include <generated_dts_board.h>
-#define FLASH_AREA_IMAGE_0 DT_FLASH_AREA_IMAGE_0_ID
-#define FLASH_AREA_IMAGE_1 DT_FLASH_AREA_IMAGE_1_ID
-#define FLASH_AREA_IMAGE_SCRATCH DT_FLASH_AREA_IMAGE_SCRATCH_ID
+#define FLASH_AREA_IMAGE_PRIMARY DT_FLASH_AREA_IMAGE_0_ID
+#define FLASH_AREA_IMAGE_SECONDARY DT_FLASH_AREA_IMAGE_1_ID
+#define FLASH_AREA_IMAGE_SCRATCH DT_FLASH_AREA_IMAGE_SCRATCH_ID
#endif /* __SYSFLASH_H__ */