Platform: Rename platform specific MCUBoot macros
The BOOT_MAX_IMG_SECTORS and BOOT_STATUS_MAX_ENTRIES macros in the
original MCUBoot code base are defined in bootutil_priv.h. Rename
them to avoid redefinition errors when building TF-M with upstream
MCUBoot.
Change-Id: I2e3ff105077f06bcb2ffafe3a2ac1863ec6e0478
Signed-off-by: David Vincze <david.vincze@arm.com>
diff --git a/bl2/ext/mcuboot/bootutil/src/bootutil_priv.h b/bl2/ext/mcuboot/bootutil/src/bootutil_priv.h
index a603b01..4edfcdb 100644
--- a/bl2/ext/mcuboot/bootutil/src/bootutil_priv.h
+++ b/bl2/ext/mcuboot/bootutil/src/bootutil_priv.h
@@ -21,7 +21,7 @@
* Original code taken from mcuboot project at:
* https://github.com/JuulLabs-OSS/mcuboot
* Git SHA of the original version: ac55554059147fff718015be9f4bd3108123f50a
- * Modifications are Copyright (c) 2018-2019 Arm Limited.
+ * Modifications are Copyright (c) 2018-2020 Arm Limited.
*/
#ifndef H_BOOTUTIL_PRIV_
@@ -129,6 +129,8 @@
_Static_assert(BOOT_IMAGE_NUMBER > 0, "Invalid value for BOOT_IMAGE_NUMBER");
+#define BOOT_MAX_IMG_SECTORS MCUBOOT_MAX_IMG_SECTORS
+
/*
* Extract the swap type and image number from image trailers's swap_info
* field.
@@ -166,6 +168,7 @@
/** Maximum number of image sectors supported by the bootloader. */
#define BOOT_STATUS_STATE_COUNT 3
+#define BOOT_STATUS_MAX_ENTRIES MCUBOOT_STATUS_MAX_ENTRIES
#define BOOT_PRIMARY_SLOT 0
#define BOOT_SECONDARY_SLOT 1
diff --git a/bl2/ext/mcuboot/include/target.h b/bl2/ext/mcuboot/include/target.h
index 68f1190..a812df6 100644
--- a/bl2/ext/mcuboot/include/target.h
+++ b/bl2/ext/mcuboot/include/target.h
@@ -1,6 +1,6 @@
/*
* Copyright (C) 2017, Linaro Ltd
- * Copyright (c) 2018-2019, Arm Limited.
+ * Copyright (c) 2018-2020, Arm Limited.
*
* SPDX-License-Identifier: Apache-2.0
*/
@@ -85,12 +85,12 @@
#error "BL2 supports CMSIS flash interface and device name must be specified"
#endif
-#ifndef BOOT_STATUS_MAX_ENTRIES
-#error "BOOT_STATUS_MAX_ENTRIES must be defined by the target"
+#ifndef MCUBOOT_STATUS_MAX_ENTRIES
+#error "MCUBOOT_STATUS_MAX_ENTRIES must be defined by the target"
#endif
-#ifndef BOOT_MAX_IMG_SECTORS
-#error "BOOT_MAX_IMG_SECTORS must be defined by the target"
+#ifndef MCUBOOT_MAX_IMG_SECTORS
+#error "MCUBOOT_MAX_IMG_SECTORS must be defined by the target"
#endif
#endif /* H_TARGETS_TARGET_ */
diff --git a/platform/ext/target/mps2/an519/partition/flash_layout.h b/platform/ext/target/mps2/an519/partition/flash_layout.h
index 65e03f1..8b6991c 100644
--- a/platform/ext/target/mps2/an519/partition/flash_layout.h
+++ b/platform/ext/target/mps2/an519/partition/flash_layout.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017-2019 Arm Limited. All rights reserved.
+ * Copyright (c) 2017-2020 Arm Limited. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -100,11 +100,11 @@
#define FLASH_AREA_SCRATCH_SIZE (FLASH_S_PARTITION_SIZE + \
FLASH_NS_PARTITION_SIZE)
/* The maximum number of status entries supported by the bootloader. */
-#define BOOT_STATUS_MAX_ENTRIES ((FLASH_S_PARTITION_SIZE + \
+#define MCUBOOT_STATUS_MAX_ENTRIES ((FLASH_S_PARTITION_SIZE + \
FLASH_NS_PARTITION_SIZE) / \
FLASH_AREA_SCRATCH_SIZE)
/* Maximum number of image sectors supported by the bootloader. */
-#define BOOT_MAX_IMG_SECTORS ((FLASH_S_PARTITION_SIZE + \
+#define MCUBOOT_MAX_IMG_SECTORS ((FLASH_S_PARTITION_SIZE + \
FLASH_NS_PARTITION_SIZE) / \
FLASH_AREA_IMAGE_SECTOR_SIZE)
#elif (MCUBOOT_IMAGE_NUMBER == 2)
@@ -129,10 +129,10 @@
#define FLASH_AREA_SCRATCH_OFFSET (FLASH_AREA_3_OFFSET + FLASH_AREA_3_SIZE)
#define FLASH_AREA_SCRATCH_SIZE (FLASH_MAX_PARTITION_SIZE)
/* The maximum number of status entries supported by the bootloader. */
-#define BOOT_STATUS_MAX_ENTRIES (FLASH_MAX_PARTITION_SIZE / \
+#define MCUBOOT_STATUS_MAX_ENTRIES (FLASH_MAX_PARTITION_SIZE / \
FLASH_AREA_SCRATCH_SIZE)
/* Maximum number of image sectors supported by the bootloader. */
-#define BOOT_MAX_IMG_SECTORS (FLASH_MAX_PARTITION_SIZE / \
+#define MCUBOOT_MAX_IMG_SECTORS (FLASH_MAX_PARTITION_SIZE / \
FLASH_AREA_IMAGE_SECTOR_SIZE)
#else /* MCUBOOT_IMAGE_NUMBER > 2 */
#error "Only MCUBOOT_IMAGE_NUMBER 1 and 2 are supported!"
diff --git a/platform/ext/target/mps2/an521/partition/flash_layout.h b/platform/ext/target/mps2/an521/partition/flash_layout.h
index becd326..f4a0bf5 100644
--- a/platform/ext/target/mps2/an521/partition/flash_layout.h
+++ b/platform/ext/target/mps2/an521/partition/flash_layout.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017-2019 Arm Limited. All rights reserved.
+ * Copyright (c) 2017-2020 Arm Limited. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -100,11 +100,11 @@
#define FLASH_AREA_SCRATCH_SIZE (FLASH_S_PARTITION_SIZE + \
FLASH_NS_PARTITION_SIZE)
/* The maximum number of status entries supported by the bootloader. */
-#define BOOT_STATUS_MAX_ENTRIES ((FLASH_S_PARTITION_SIZE + \
+#define MCUBOOT_STATUS_MAX_ENTRIES ((FLASH_S_PARTITION_SIZE + \
FLASH_NS_PARTITION_SIZE) / \
FLASH_AREA_SCRATCH_SIZE)
/* Maximum number of image sectors supported by the bootloader. */
-#define BOOT_MAX_IMG_SECTORS ((FLASH_S_PARTITION_SIZE + \
+#define MCUBOOT_MAX_IMG_SECTORS ((FLASH_S_PARTITION_SIZE + \
FLASH_NS_PARTITION_SIZE) / \
FLASH_AREA_IMAGE_SECTOR_SIZE)
#elif (MCUBOOT_IMAGE_NUMBER == 2)
@@ -129,10 +129,10 @@
#define FLASH_AREA_SCRATCH_OFFSET (FLASH_AREA_3_OFFSET + FLASH_AREA_3_SIZE)
#define FLASH_AREA_SCRATCH_SIZE (FLASH_MAX_PARTITION_SIZE)
/* The maximum number of status entries supported by the bootloader. */
-#define BOOT_STATUS_MAX_ENTRIES (FLASH_MAX_PARTITION_SIZE / \
+#define MCUBOOT_STATUS_MAX_ENTRIES (FLASH_MAX_PARTITION_SIZE / \
FLASH_AREA_SCRATCH_SIZE)
/* Maximum number of image sectors supported by the bootloader. */
-#define BOOT_MAX_IMG_SECTORS (FLASH_MAX_PARTITION_SIZE / \
+#define MCUBOOT_MAX_IMG_SECTORS (FLASH_MAX_PARTITION_SIZE / \
FLASH_AREA_IMAGE_SECTOR_SIZE)
#else /* MCUBOOT_IMAGE_NUMBER > 2 */
#error "Only MCUBOOT_IMAGE_NUMBER 1 and 2 are supported!"
diff --git a/platform/ext/target/mps2/an539/partition/flash_layout.h b/platform/ext/target/mps2/an539/partition/flash_layout.h
index 23bd9b4..2573002 100644
--- a/platform/ext/target/mps2/an539/partition/flash_layout.h
+++ b/platform/ext/target/mps2/an539/partition/flash_layout.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2019 Arm Limited. All rights reserved.
+ * Copyright (c) 2019-2020 Arm Limited. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -98,11 +98,11 @@
#define FLASH_AREA_SCRATCH_SIZE (FLASH_S_PARTITION_SIZE + \
FLASH_NS_PARTITION_SIZE)
/* The maximum number of status entries supported by the bootloader. */
-#define BOOT_STATUS_MAX_ENTRIES ((FLASH_S_PARTITION_SIZE + \
+#define MCUBOOT_STATUS_MAX_ENTRIES ((FLASH_S_PARTITION_SIZE + \
FLASH_NS_PARTITION_SIZE) / \
FLASH_AREA_SCRATCH_SIZE)
/* Maximum number of image sectors supported by the bootloader. */
-#define BOOT_MAX_IMG_SECTORS ((FLASH_S_PARTITION_SIZE + \
+#define MCUBOOT_MAX_IMG_SECTORS ((FLASH_S_PARTITION_SIZE + \
FLASH_NS_PARTITION_SIZE) / \
FLASH_AREA_IMAGE_SECTOR_SIZE)
#elif (MCUBOOT_IMAGE_NUMBER == 2)
@@ -127,10 +127,10 @@
#define FLASH_AREA_SCRATCH_OFFSET (FLASH_AREA_3_OFFSET + FLASH_AREA_3_SIZE)
#define FLASH_AREA_SCRATCH_SIZE (FLASH_MAX_PARTITION_SIZE)
/* The maximum number of status entries supported by the bootloader. */
-#define BOOT_STATUS_MAX_ENTRIES (FLASH_MAX_PARTITION_SIZE / \
+#define MCUBOOT_STATUS_MAX_ENTRIES (FLASH_MAX_PARTITION_SIZE / \
FLASH_AREA_SCRATCH_SIZE)
/* Maximum number of image sectors supported by the bootloader. */
-#define BOOT_MAX_IMG_SECTORS (FLASH_MAX_PARTITION_SIZE / \
+#define MCUBOOT_MAX_IMG_SECTORS (FLASH_MAX_PARTITION_SIZE / \
FLASH_AREA_IMAGE_SECTOR_SIZE)
#else /* MCUBOOT_IMAGE_NUMBER > 2 */
#error "Only MCUBOOT_IMAGE_NUMBER 1 and 2 are supported!"
diff --git a/platform/ext/target/mps3/an524/partition/flash_layout.h b/platform/ext/target/mps3/an524/partition/flash_layout.h
index 9107b00..6d571f6 100644
--- a/platform/ext/target/mps3/an524/partition/flash_layout.h
+++ b/platform/ext/target/mps3/an524/partition/flash_layout.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2019 Arm Limited. All rights reserved.
+ * Copyright (c) 2019-2020 Arm Limited. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -86,7 +86,7 @@
#define FLASH_AREA_SCRATCH_OFFSET (FLASH_AREA_2_OFFSET + FLASH_AREA_2_SIZE)
#define FLASH_AREA_SCRATCH_SIZE (0)
/* Maximum number of image sectors supported by the bootloader. */
-#define BOOT_MAX_IMG_SECTORS ((FLASH_S_PARTITION_SIZE + \
+#define MCUBOOT_MAX_IMG_SECTORS ((FLASH_S_PARTITION_SIZE + \
FLASH_NS_PARTITION_SIZE) / \
FLASH_AREA_IMAGE_SECTOR_SIZE)
#elif (MCUBOOT_IMAGE_NUMBER == 2)
@@ -113,7 +113,7 @@
#define FLASH_AREA_SCRATCH_OFFSET (FLASH_AREA_3_OFFSET + FLASH_AREA_3_SIZE)
#define FLASH_AREA_SCRATCH_SIZE (0)
/* Maximum number of image sectors supported by the bootloader. */
-#define BOOT_MAX_IMG_SECTORS (FLASH_MAX_PARTITION_SIZE / \
+#define MCUBOOT_MAX_IMG_SECTORS (FLASH_MAX_PARTITION_SIZE / \
FLASH_AREA_IMAGE_SECTOR_SIZE)
#else /* MCUBOOT_IMAGE_NUMBER > 2 */
#error "Only MCUBOOT_IMAGE_NUMBER 1 and 2 are supported!"
@@ -123,7 +123,7 @@
* is supported on AN524. The maximum number of status entries
* supported by the bootloader.
*/
-#define BOOT_STATUS_MAX_ENTRIES (0)
+#define MCUBOOT_STATUS_MAX_ENTRIES (0)
/* Secure Storage (SST) Service definitions */
#define FLASH_SST_AREA_OFFSET (FLASH_AREA_SCRATCH_OFFSET + \
diff --git a/platform/ext/target/musca_a/partition/flash_layout.h b/platform/ext/target/musca_a/partition/flash_layout.h
index 8bb8814..1ee2bab 100644
--- a/platform/ext/target/musca_a/partition/flash_layout.h
+++ b/platform/ext/target/musca_a/partition/flash_layout.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018-2019 Arm Limited. All rights reserved.
+ * Copyright (c) 2018-2020 Arm Limited. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -90,7 +90,7 @@
#define FLASH_AREA_SCRATCH_OFFSET (FLASH_AREA_2_OFFSET + FLASH_AREA_2_SIZE)
#define FLASH_AREA_SCRATCH_SIZE (0)
/* Maximum number of image sectors supported by the bootloader. */
-#define BOOT_MAX_IMG_SECTORS ((FLASH_S_PARTITION_SIZE + \
+#define MCUBOOT_MAX_IMG_SECTORS ((FLASH_S_PARTITION_SIZE + \
FLASH_NS_PARTITION_SIZE) / \
FLASH_AREA_IMAGE_SECTOR_SIZE)
#elif (MCUBOOT_IMAGE_NUMBER == 2)
@@ -117,7 +117,7 @@
#define FLASH_AREA_SCRATCH_OFFSET (FLASH_AREA_3_OFFSET + FLASH_AREA_3_SIZE)
#define FLASH_AREA_SCRATCH_SIZE (0)
/* Maximum number of image sectors supported by the bootloader. */
-#define BOOT_MAX_IMG_SECTORS (FLASH_MAX_PARTITION_SIZE / \
+#define MCUBOOT_MAX_IMG_SECTORS (FLASH_MAX_PARTITION_SIZE / \
FLASH_AREA_IMAGE_SECTOR_SIZE)
#else /* MCUBOOT_IMAGE_NUMBER > 2 */
#error "Only MCUBOOT_IMAGE_NUMBER 1 and 2 are supported!"
@@ -127,7 +127,7 @@
* is supported on Musca-A. The maximum number of status entries
* supported by the bootloader.
*/
-#define BOOT_STATUS_MAX_ENTRIES (0)
+#define MCUBOOT_STATUS_MAX_ENTRIES (0)
/* Secure Storage (SST) Service definitions */
#define FLASH_SST_AREA_OFFSET (FLASH_AREA_SCRATCH_OFFSET + \
diff --git a/platform/ext/target/musca_b1/partition/flash_layout.h b/platform/ext/target/musca_b1/partition/flash_layout.h
index ede8d0f..9fda96a 100644
--- a/platform/ext/target/musca_b1/partition/flash_layout.h
+++ b/platform/ext/target/musca_b1/partition/flash_layout.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018-2019 Arm Limited. All rights reserved.
+ * Copyright (c) 2018-2020 Arm Limited. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -85,7 +85,7 @@
#define FLASH_AREA_SCRATCH_OFFSET (FLASH_AREA_2_OFFSET + FLASH_AREA_2_SIZE)
#define FLASH_AREA_SCRATCH_SIZE (0)
/* Maximum number of image sectors supported by the bootloader. */
-#define BOOT_MAX_IMG_SECTORS ((FLASH_S_PARTITION_SIZE + \
+#define MCUBOOT_MAX_IMG_SECTORS ((FLASH_S_PARTITION_SIZE + \
FLASH_NS_PARTITION_SIZE) / \
FLASH_AREA_IMAGE_SECTOR_SIZE)
#elif (MCUBOOT_IMAGE_NUMBER == 2)
@@ -112,7 +112,7 @@
#define FLASH_AREA_SCRATCH_OFFSET (FLASH_AREA_3_OFFSET + FLASH_AREA_3_SIZE)
#define FLASH_AREA_SCRATCH_SIZE (0)
/* Maximum number of image sectors supported by the bootloader. */
-#define BOOT_MAX_IMG_SECTORS (FLASH_MAX_PARTITION_SIZE / \
+#define MCUBOOT_MAX_IMG_SECTORS (FLASH_MAX_PARTITION_SIZE / \
FLASH_AREA_IMAGE_SECTOR_SIZE)
#else /* MCUBOOT_IMAGE_NUMBER > 2 */
#error "Only MCUBOOT_IMAGE_NUMBER 1 and 2 are supported!"
@@ -122,7 +122,7 @@
* is supported on Musca-B1. The maximum number of status entries
* supported by the bootloader.
*/
-#define BOOT_STATUS_MAX_ENTRIES (0)
+#define MCUBOOT_STATUS_MAX_ENTRIES (0)
/* Note: FLASH_SST_AREA_OFFSET, FLASH_ITS_AREA_OFFSET and
* FLASH_NV_COUNTERS_AREA_OFFSET point to offsets in flash, but reads and writes
diff --git a/platform/ext/target/musca_s1/partition/flash_layout.h b/platform/ext/target/musca_s1/partition/flash_layout.h
index c460dbc..f83e90a 100644
--- a/platform/ext/target/musca_s1/partition/flash_layout.h
+++ b/platform/ext/target/musca_s1/partition/flash_layout.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018-2019 Arm Limited. All rights reserved.
+ * Copyright (c) 2018-2020 Arm Limited. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -83,7 +83,7 @@
#define FLASH_AREA_SCRATCH_OFFSET (FLASH_AREA_2_OFFSET + FLASH_AREA_2_SIZE)
#define FLASH_AREA_SCRATCH_SIZE (0)
/* Maximum number of image sectors supported by the bootloader. */
-#define BOOT_MAX_IMG_SECTORS ((FLASH_S_PARTITION_SIZE + \
+#define MCUBOOT_MAX_IMG_SECTORS ((FLASH_S_PARTITION_SIZE + \
FLASH_NS_PARTITION_SIZE) / \
FLASH_AREA_IMAGE_SECTOR_SIZE)
#elif (MCUBOOT_IMAGE_NUMBER == 2)
@@ -110,7 +110,7 @@
#define FLASH_AREA_SCRATCH_OFFSET (FLASH_AREA_3_OFFSET + FLASH_AREA_3_SIZE)
#define FLASH_AREA_SCRATCH_SIZE (0)
/* Maximum number of image sectors supported by the bootloader. */
-#define BOOT_MAX_IMG_SECTORS (FLASH_MAX_PARTITION_SIZE / \
+#define MCUBOOT_MAX_IMG_SECTORS (FLASH_MAX_PARTITION_SIZE / \
FLASH_AREA_IMAGE_SECTOR_SIZE)
#else /* MCUBOOT_IMAGE_NUMBER > 2 */
#error "Only MCUBOOT_IMAGE_NUMBER 1 and 2 are supported!"
@@ -120,7 +120,7 @@
* is supported on Musca-S1. The maximum number of status entries
* supported by the bootloader.
*/
-#define BOOT_STATUS_MAX_ENTRIES (0)
+#define MCUBOOT_STATUS_MAX_ENTRIES (0)
/* Note: FLASH_SST_AREA_OFFSET, FLASH_ITS_AREA_OFFSET and
* FLASH_NV_COUNTERS_AREA_OFFSET point to offsets in flash, but reads and writes
diff --git a/platform/ext/target/sse-200_aws/partition/flash_layout.h b/platform/ext/target/sse-200_aws/partition/flash_layout.h
index edbc4cd..d963dd2 100644
--- a/platform/ext/target/sse-200_aws/partition/flash_layout.h
+++ b/platform/ext/target/sse-200_aws/partition/flash_layout.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017-2019 Arm Limited. All rights reserved.
+ * Copyright (c) 2017-2020 Arm Limited. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -100,11 +100,11 @@
#define FLASH_AREA_SCRATCH_SIZE (FLASH_S_PARTITION_SIZE + \
FLASH_NS_PARTITION_SIZE)
/* The maximum number of status entries supported by the bootloader. */
-#define BOOT_STATUS_MAX_ENTRIES ((FLASH_S_PARTITION_SIZE + \
+#define MCUBOOT_STATUS_MAX_ENTRIES ((FLASH_S_PARTITION_SIZE + \
FLASH_NS_PARTITION_SIZE) / \
FLASH_AREA_SCRATCH_SIZE)
/* Maximum number of image sectors supported by the bootloader. */
-#define BOOT_MAX_IMG_SECTORS ((FLASH_S_PARTITION_SIZE + \
+#define MCUBOOT_MAX_IMG_SECTORS ((FLASH_S_PARTITION_SIZE + \
FLASH_NS_PARTITION_SIZE) / \
FLASH_AREA_IMAGE_SECTOR_SIZE)
#elif (MCUBOOT_IMAGE_NUMBER == 2)
@@ -129,10 +129,10 @@
#define FLASH_AREA_SCRATCH_OFFSET (FLASH_AREA_3_OFFSET + FLASH_AREA_3_SIZE)
#define FLASH_AREA_SCRATCH_SIZE (FLASH_MAX_PARTITION_SIZE)
/* The maximum number of status entries supported by the bootloader. */
-#define BOOT_STATUS_MAX_ENTRIES (FLASH_MAX_PARTITION_SIZE / \
+#define MCUBOOT_STATUS_MAX_ENTRIES (FLASH_MAX_PARTITION_SIZE / \
FLASH_AREA_SCRATCH_SIZE)
/* Maximum number of image sectors supported by the bootloader. */
-#define BOOT_MAX_IMG_SECTORS (FLASH_MAX_PARTITION_SIZE / \
+#define MCUBOOT_MAX_IMG_SECTORS (FLASH_MAX_PARTITION_SIZE / \
FLASH_AREA_IMAGE_SECTOR_SIZE)
#else /* MCUBOOT_IMAGE_NUMBER > 2 */
#error "Only MCUBOOT_IMAGE_NUMBER 1 and 2 are supported!"