Commit 39757d6a authored by Jerzy Kasenberg's avatar Jerzy Kasenberg Committed by Fabio Utzig
Browse files

mynewt: Add support for MCUBOOT_SINGLE_APPLICATION_SLOT

So far mynewt code required definition of second slot in bsp.
Even in cases when overwrite only option was used bsp had to
have secondary slot with 0 length or pointing to some
unreachable flash or flash area.

Now when BOOTUTIL_SINGLE_APPLICATION_SLOT is set to 1
there is not need for fake flash areas when mcuboot
provides way for upgrade like boot serial or other
supported ways (USB DFU or USB MSC)

Signed-off-by: default avatarJerzy Kasenberg <jerzy.kasenberg@codecoup.pl>
parent c5a528ba
Loading
Loading
Loading
Loading
+4 −0
Changes for boot/mynewt/flash_map_backend/include/flash_map_backend/flash_map_backend.h: 4 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -17,9 +17,13 @@
#define FLASH_AREA_IMAGE_PRIMARY(x)    (((x) == 0) ?          \
                                         FLASH_AREA_IMAGE_0 : \
                                         FLASH_AREA_IMAGE_0)
#if MYNEWT_VAL(BOOTUTIL_SINGLE_APPLICATION_SLOT)
#define FLASH_AREA_IMAGE_SECONDARY FLASH_AREA_IMAGE_PRIMARY
#else
#define FLASH_AREA_IMAGE_SECONDARY(x)  (((x) == 0) ?          \
                                         FLASH_AREA_IMAGE_1 : \
                                         FLASH_AREA_IMAGE_1)
#endif

#elif (MCUBOOT_IMAGE_NUMBER == 2)

+4 −0
Changes for boot/mynewt/flash_map_backend/src/flash_map_extended.c: 4 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -26,7 +26,9 @@ int flash_area_id_from_multi_image_slot(int image_index, int slot)
{
    switch (slot) {
    case 0: return FLASH_AREA_IMAGE_PRIMARY(image_index);
#ifndef MCUBOOT_SINGLE_APPLICATION_SLOT
    case 1: return FLASH_AREA_IMAGE_SECONDARY(image_index);
#endif
#if MCUBOOT_SWAP_USING_SCRATCH
    case 2: return FLASH_AREA_IMAGE_SCRATCH;
#endif
@@ -39,9 +41,11 @@ int flash_area_id_to_multi_image_slot(int image_index, int area_id)
    if (area_id == FLASH_AREA_IMAGE_PRIMARY(image_index)) {
        return 0;
    }
#ifndef MCUBOOT_SINGLE_APPLICATION_SLOT
    if (area_id == FLASH_AREA_IMAGE_SECONDARY(image_index)) {
        return 1;
    }
#endif
    return 255;
}

+3 −0
Changes for boot/mynewt/mcuboot_config/include/mcuboot_config/mcuboot_config.h: 3 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -82,6 +82,9 @@
#if MYNEWT_VAL(BOOTUTIL_OVERWRITE_ONLY_FAST)
#define MCUBOOT_OVERWRITE_ONLY_FAST 1
#endif
#if MYNEWT_VAL(BOOTUTIL_SINGLE_APPLICATION_SLOT)
#define MCUBOOT_SINGLE_APPLICATION_SLOT 1
#endif
#if MYNEWT_VAL(BOOTUTIL_HAVE_LOGGING)
#define MCUBOOT_HAVE_LOGGING 1
#endif
+3 −0
Changes for boot/mynewt/mcuboot_config/syscfg.yml: 3 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -67,6 +67,9 @@ syscfg.defs:
    BOOTUTIL_OVERWRITE_ONLY_FAST:
        description: 'Use faster copy only upgrade.'
        value: 1
    BOOTUTIL_SINGLE_APPLICATION_SLOT:
        description: 'Set to one if there is only one slot.'
        value: 0
    BOOTUTIL_IMAGE_FORMAT_V2:
        description: 'Indicates that system is using v2 of image format.'
        value: 1