nRF52832 b0+mcuboot+app

Hi,

Trying to structure image in the following way:

b0

mcuboot 1

mcuboot 2

app

With the following setup:

App prj.conf:

```

CONFIG_BOOTLOADER_MCUBOOT=y

CONFIG_SECURE_BOOT=y
CONFIG_SB_SIGNING_KEY_FILE="nsib_priv.pem"

```

./child_image/mcuboot.conf:

```

CONFIG_SIZE_OPTIMIZATIONS=y
CONFIG_SINGLE_APPLICATION_SLOT=y

CONFIG_MCUBOOT_SERIAL=y
CONFIG_UART_CONSOLE=n

CONFIG_MCUBOOT_INDICATION_LED=y

``

building return error:

```

warning: UPDATEABLE_IMAGE_NUMBER (defined at
/home/ab/ncs/v2.6.0/bootloader/mcuboot/boot/zephyr/Kconfig:596,
/home/ab/ncs/v2.6.0/nrf/samples/common/mcumgr_bt_ota_dfu/Kconfig:89, subsys/dfu/Kconfig:88) was
assigned the value '2' but got the value '1'. See
docs.zephyrproject.org/.../kconfig.html and/or look up
UPDATEABLE_IMAGE_NUMBER in the menuconfig/guiconfig interface. The Application Development Primer,
Setting Configuration Values, and Kconfig - Tips and Best Practices sections of the manual might be
helpful too.


warning: user value 2 on the int symbol UPDATEABLE_IMAGE_NUMBER (defined at /home/ab/ncs/v2.6.0/bootloader/mcuboot/boot/zephyr/Kconfig:596, /home/ab/ncs/v2.6.0/nrf/samples/common/mcumgr_bt_ota_dfu/Kconfig:89, subsys/dfu/Kconfig:88) ignored due to being outside the active range ([1, 1]) -- falling back on defaults

error: Aborting due to Kconfig warnings

```

Please help to resolve the issue

  • Forget to mention that without `CONFIG_SINGLE_APPLICATION_SLOT=y` everything is building fine, but dual-slot solution is not that i'm looking for. Only interested in serial recovery model cause wanna safe more space for app

     

  • Hi,

    I would recommend that you have a look at the bootloader and DFU/FOTA lesson in the new course on our academy pages: https://academy.nordicsemi.com/courses/nrf-connect-sdk-intermediate/lessons/lesson-8-bootloaders-and-dfu-fota/. The first exercise there showcases how to do serial recovery. The author of the lesson has also this repository which might be of help w.r.t implementing a single image serial recovery solution for your application https://github.com/hellesvik-nordic/samples_for_nrf_connect_sdk/tree/main/bootloader_samples/serial_recovery

    Do note that if you intend to implement a serial recovery solution you will miss out on some of fallback mechanics that comes with regular FOTA with a secondary application slot

    Kind regards,
    Andreas

  • Hi,

    Saw the lesson, it covers only simply one-stage scheme, not including b0 first-stage bootloader.

    Author also has an example of how to update bootloader here:

    https://github.com/hellesvik-nordic/samples_for_nrf_connect_sdk/tree/main/bootloader_samples/updatable_bootloader

    but this example implements dual-slot solution, I need dual-slot for bootloader and single-slot for application

    Please help

  • Wups, I was a bit too quick when reading your case. I see now what you want. If I remember correct from when I created this sample, I think this one should cover what you're looking for https://github.com/aHaugl/samples_for_NCS/tree/main/DFU/serial_recovery_nsib

    You should be able to configure the static partitioning to fit what you need, and the readme description (albeit a bit rough in the edges) should showcase how to do this. Remember that the secondary MCUBoot partition needs to be atleast as large as the MCUboot (bootloader) partition

    Let me know if you're able to get it working by following my sample instead

    Kind regards,
    Andreas

  • Thank you for the quick response.

    Tried to build serial_recovery_nsib project with nrf52dk_nrf52832 configuration, getting this error:

    ```

    -- Found partition manager static configuration: ./samples_for_NCS/DFU/serial_recovery_nsib/pm_static.yml
    Partition 'b0' is not included in the dynamic resolving since it is statically defined.
    Partition 'b0_container' is not included in the dynamic resolving since it is statically defined.
    Partition 'mcuboot' is not included in the dynamic resolving since it is statically defined.
    Partition 'mcuboot_pad' is not included in the dynamic resolving since it is statically defined.
    Partition 'mcuboot_primary' is not included in the dynamic resolving since it is statically defined.
    Partition 'mcuboot_primary_app' is not included in the dynamic resolving since it is statically defined.
    Partition 'mcuboot_secondary' is not included in the dynamic resolving since it is statically defined.
    Partition 'provision' is not included in the dynamic resolving since it is statically defined.
    Partition 's0' is not included in the dynamic resolving since it is statically defined.
    Partition 's0_image' is not included in the dynamic resolving since it is statically defined.
    Partition 's0_pad' is not included in the dynamic resolving since it is statically defined.
    Partition 's1' is not included in the dynamic resolving since it is statically defined.
    Partition 's1_image' is not included in the dynamic resolving since it is statically defined.
    Partition 's1_pad' is not included in the dynamic resolving since it is statically defined.
    Partition manager failed: Incorrect amount of gaps found in static configuration. There must be exactly one gap in the static configuration to support placing the dynamic partitions (such as 'app'). Gaps found (2):0x23200-0x80000 0x100000-0xa0000 The most common solution to this problem is to fill the smallest of these gaps with statically defined partition(s) until there is only one gap left. Alternatively re-order the already defined static partitions so that only one gap remains.
    Failed to partition region flash_primary, size of region: 524288
    Partition Configuration:
    EMPTY_0:
      placement:
        before:
        - s1_pad
      size: 3584
    EMPTY_1:
      placement:
        before:
        - mcuboot_pad
      size: 3584
    EMPTY_2:
      placement:
        after:
        - mcuboot_secondary
      size: 4096
    b0:
      placement:
        after:
        - start
      size: 32768
    b0_container:
      size: 36864
    mcuboot:
      placement:
        before:
        - mcuboot_primary
      size: 49152
    mcuboot_pad:
      placement:
        align:
          start: 4096
        before:
        - mcuboot_primary_app
      size: 512
    mcuboot_primary:
      size: 512000
    mcuboot_primary_app:
      size: 511488
    mcuboot_secondary:
      placement:
        after:
        - mcuboot_primary
        align:
          start: 4096
        align_next: 4096
      size: 389120
    provision:
      placement:
        after:
        - b0
        align:
          start: 4096
      size: 4096
    s0:
      size: 49664
    s0_image:
      size: 49152
    s0_pad:
      placement:
        after:
        - b0_container
        align:
          start: 4096
      size: 512
    s1:
      size: 49664
    s1_image:
      placement:
        after:
        - s1_pad
        - s0
      size: 49152
    s1_pad:
      placement:
        after:
        - s0
        align:
          start: 4096
      size: 512

    ```

Related