Infineon: Add cyw20829 platform, shared slot feature, json memory map, psoc6 xip
Based in 1.8.0 release of MCUBoot library
This commit adds CYW20829 Infineon platform support with following capabilities:
1. Overwrite and swap upgrade mode support
2. Multi-image with up to 4 images
3. Hardware security counter is supported for CYW20829 platform
Add XIP support for PSOC6 platform - place BOOT slot in external memory and execute it in place using SMIF in XIP mode
and some new features for Infineon devices.
1. Shared upgrade slot feature - use one shared area for upgrade slots of multiple images
2. Memory map defined using JSON file - define memory regions for bootloader and user app in conventional way using JSON file
diff --git a/boot/zephyr/flash_map_extended.c b/boot/zephyr/flash_map_extended.c
index 7b6ae63..a52d58f 100644
--- a/boot/zephyr/flash_map_extended.c
+++ b/boot/zephyr/flash_map_extended.c
@@ -15,7 +15,7 @@
#include "bootutil/bootutil_log.h"
-MCUBOOT_LOG_MODULE_DECLARE(mcuboot);
+BOOT_LOG_MODULE_DECLARE(mcuboot);
#if (!defined(CONFIG_XTENSA) && defined(DT_CHOSEN_ZEPHYR_FLASH_CONTROLLER_LABEL))
#define FLASH_DEVICE_ID SOC_FLASH_0_ID
@@ -59,9 +59,9 @@
case 0: return FLASH_AREA_IMAGE_PRIMARY(image_index);
#if !defined(CONFIG_SINGLE_APPLICATION_SLOT)
case 1: return FLASH_AREA_IMAGE_SECONDARY(image_index);
-#if !defined(CONFIG_BOOT_SWAP_USING_MOVE)
- case 2: return FLASH_AREA_IMAGE_SCRATCH;
#endif
+#if defined(CONFIG_BOOT_SWAP_USING_SCRATCH)
+ case 2: return FLASH_AREA_IMAGE_SCRATCH;
#endif
}
@@ -93,6 +93,30 @@
return flash_area_id_to_multi_image_slot(0, area_id);
}
+#if defined(CONFIG_MCUBOOT_SERIAL_DIRECT_IMAGE_UPLOAD)
+int flash_area_id_from_direct_image(int image_id)
+{
+ switch (image_id) {
+ case 0:
+ case 1:
+ return FLASH_AREA_ID(image_0);
+#if DT_HAS_FIXED_PARTITION_LABEL(image_1)
+ case 2:
+ return FLASH_AREA_ID(image_1);
+#endif
+#if DT_HAS_FIXED_PARTITION_LABEL(image_2)
+ case 3:
+ return FLASH_AREA_ID(image_2);
+#endif
+#if DT_HAS_FIXED_PARTITION_LABEL(image_3)
+ case 4:
+ return FLASH_AREA_ID(image_3);
+#endif
+ }
+ return -EINVAL;
+}
+#endif
+
int flash_area_sector_from_off(off_t off, struct flash_sector *sector)
{
int rc;
@@ -109,6 +133,12 @@
return rc;
}
+uint8_t flash_area_get_device_id(const struct flash_area *fa)
+{
+ (void)fa;
+ return FLASH_DEVICE_ID;
+}
+
#define ERASED_VAL 0xff
__weak uint8_t flash_area_erased_val(const struct flash_area *fap)
{