Platform: Add new NV counter due to multiple image boot
Add new NV counter to the NV counter flash area to be used
by the bootloader as a separate second security counter
for another firmware image to enable multiple image boot.
Change-Id: I6cd3bf675317240e40cd0bc31a714070885791aa
Signed-off-by: David Vincze <david.vincze@arm.com>
diff --git a/bl2/ext/mcuboot/bootutil/src/loader.c b/bl2/ext/mcuboot/bootutil/src/loader.c
index c7c7173..ef2e812 100644
--- a/bl2/ext/mcuboot/bootutil/src/loader.c
+++ b/bl2/ext/mcuboot/bootutil/src/loader.c
@@ -392,7 +392,7 @@
goto done;
}
- rc = boot_nv_security_counter_update(0, img_security_cnt);
+ rc = boot_nv_security_counter_update(current_image, img_security_cnt);
if (rc != 0) {
goto done;
}
diff --git a/bl2/src/security_cnt.c b/bl2/src/security_cnt.c
index 03c438c..825a2d6 100644
--- a/bl2/src/security_cnt.c
+++ b/bl2/src/security_cnt.c
@@ -11,6 +11,7 @@
#include <stdint.h>
#define TFM_BOOT_NV_COUNTER_0 PLAT_NV_COUNTER_3 /* NV counter of Image 0 */
+#define TFM_BOOT_NV_COUNTER_1 PLAT_NV_COUNTER 4 /* NV counter of Image 1 */
#define TFM_BOOT_NV_COUNTER_MAX PLAT_NV_COUNTER_MAX
static enum tfm_nv_counter_t get_nv_counter_from_image_id(uint32_t image_id)