aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--platform/ext/target/mps2/an519/partition/flash_layout.h13
-rw-r--r--platform/ext/target/mps2/an521/partition/flash_layout.h13
-rw-r--r--platform/ext/target/mps3/an524/partition/flash_layout.h13
3 files changed, 30 insertions, 9 deletions
diff --git a/platform/ext/target/mps2/an519/partition/flash_layout.h b/platform/ext/target/mps2/an519/partition/flash_layout.h
index 86028242..b0ebbae6 100644
--- a/platform/ext/target/mps2/an519/partition/flash_layout.h
+++ b/platform/ext/target/mps2/an519/partition/flash_layout.h
@@ -36,6 +36,8 @@
* 0x0010_0000 Non-secure image
*/
+#define MAX(X,Y) ((X) > (Y) ? (X) : (Y))
+
/* This header file is included from linker scatter file as well, where only a
* limited C constructs are allowed. Therefore it is not possible to include
* here the platform_retarget.h to access flash related defines. To resolve this
@@ -79,9 +81,14 @@
FLASH_NS_PARTITION_SIZE)
/* The maximum number of status entries supported by the bootloader. */
-#define BOOT_STATUS_MAX_ENTRIES ((FLASH_S_PARTITION_SIZE + \
- FLASH_NS_PARTITION_SIZE) / \
- FLASH_AREA_IMAGE_SCRATCH_SIZE)
+/* The maximum number of status entries must be at least 2. For more
+ * information see the MCUBoot issue:
+ * https://github.com/JuulLabs-OSS/mcuboot/issues/427.
+ */
+#define BOOT_STATUS_MAX_ENTRIES MAX(2, \
+ (FLASH_S_PARTITION_SIZE + \
+ FLASH_NS_PARTITION_SIZE) / \
+ FLASH_AREA_IMAGE_SCRATCH_SIZE)
/* Maximum number of image sectors supported by the bootloader. */
#define BOOT_MAX_IMG_SECTORS ((FLASH_S_PARTITION_SIZE + \
diff --git a/platform/ext/target/mps2/an521/partition/flash_layout.h b/platform/ext/target/mps2/an521/partition/flash_layout.h
index d2ffa338..57c95926 100644
--- a/platform/ext/target/mps2/an521/partition/flash_layout.h
+++ b/platform/ext/target/mps2/an521/partition/flash_layout.h
@@ -36,6 +36,8 @@
* 0x0010_0000 Non-secure image
*/
+#define MAX(X,Y) ((X) > (Y) ? (X) : (Y))
+
/* This header file is included from linker scatter file as well, where only a
* limited C constructs are allowed. Therefore it is not possible to include
* here the platform_retarget.h to access flash related defines. To resolve this
@@ -79,9 +81,14 @@
FLASH_NS_PARTITION_SIZE)
/* The maximum number of status entries supported by the bootloader. */
-#define BOOT_STATUS_MAX_ENTRIES ((FLASH_S_PARTITION_SIZE + \
- FLASH_NS_PARTITION_SIZE) / \
- FLASH_AREA_IMAGE_SCRATCH_SIZE)
+/* The maximum number of status entries must be at least 2. For more
+ * information see the MCUBoot issue:
+ * https://github.com/JuulLabs-OSS/mcuboot/issues/427.
+ */
+#define BOOT_STATUS_MAX_ENTRIES MAX(2, \
+ (FLASH_S_PARTITION_SIZE + \
+ FLASH_NS_PARTITION_SIZE) / \
+ FLASH_AREA_IMAGE_SCRATCH_SIZE)
/* Maximum number of image sectors supported by the bootloader. */
#define BOOT_MAX_IMG_SECTORS ((FLASH_S_PARTITION_SIZE + \
diff --git a/platform/ext/target/mps3/an524/partition/flash_layout.h b/platform/ext/target/mps3/an524/partition/flash_layout.h
index c6afd9f7..918d4dc7 100644
--- a/platform/ext/target/mps3/an524/partition/flash_layout.h
+++ b/platform/ext/target/mps3/an524/partition/flash_layout.h
@@ -46,6 +46,8 @@
* 0x001C_5014 Unused
*/
+#define MAX(X,Y) ((X) > (Y) ? (X) : (Y))
+
/* Size of a Secure and of a Non-secure image */
#define FLASH_S_PARTITION_SIZE (0x40000) /* S partition: 256 KB */
#define FLASH_NS_PARTITION_SIZE (0x40000) /* NS partition: 256 KB */
@@ -78,9 +80,14 @@
FLASH_NS_PARTITION_SIZE)
/* The maximum number of status entries supported by the bootloader. */
-#define BOOT_STATUS_MAX_ENTRIES ((FLASH_S_PARTITION_SIZE + \
- FLASH_NS_PARTITION_SIZE) / \
- FLASH_AREA_IMAGE_SCRATCH_SIZE)
+/* The maximum number of status entries must be at least 2. For more
+ * information see the MCUBoot issue:
+ * https://github.com/JuulLabs-OSS/mcuboot/issues/427.
+ */
+#define BOOT_STATUS_MAX_ENTRIES MAX(2, \
+ (FLASH_S_PARTITION_SIZE + \
+ FLASH_NS_PARTITION_SIZE) / \
+ FLASH_AREA_IMAGE_SCRATCH_SIZE)
/* Maximum number of image sectors supported by the bootloader. */
#define BOOT_MAX_IMG_SECTORS ((FLASH_S_PARTITION_SIZE + \