bootutil: Fix for flash_area_id_to_image
The function was incorrectly identifying partition of secondary slot
of image 0 as belonging to image 1, at the same time failing to
identify partition of primary slot of image 1.
Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
diff --git a/boot/bootutil/src/bootutil_public.c b/boot/bootutil/src/bootutil_public.c
index 0f0d385..f245739 100644
--- a/boot/bootutil/src/bootutil_public.c
+++ b/boot/bootutil/src/bootutil_public.c
@@ -463,7 +463,7 @@
#if BOOT_IMAGE_NUMBER > 2
#error "BOOT_IMAGE_NUMBER > 2 requires change to flash_area_id_to_image"
#elif BOOT_IMAGE_NUMBER > 1
- if (FLASH_AREA_IMAGE_SECONDARY(0) == id || (FLASH_AREA_IMAGE_SECONDARY(1) == id)) {
+ if (FLASH_AREA_IMAGE_PRIMARY(1) == id || (FLASH_AREA_IMAGE_SECONDARY(1) == id)) {
return 1;
}
#else