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

Parents Reply Children
  • 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

    ```

  •  

    I've also noticed that `app` and `app_image` sections are commented out...

    Sorry, just starting with nRF Connect SDK

  • So I tried to modify the pm_static.yml or my case:

    ```

    b0_container:
     address: 0x0
     end_address: 0x8000
     orig_span: &id002
     - b0
     - provision
     region: flash_primary
     size: 0x8000
     span: *id002
    b0:
     address: 0x0
     end_address: 0x7000
     placement:
     after:
     - start
     region: flash_primary
     size: 0x7000
    provision:
     address: 0x7000
     end_address: 0x8000
     placement:
     after:
     - b0
     align:
     start: 0x1000
     region: flash_primary
     size: 0x1000
    
    s0:
     address: 0x8000
     end_address: 0x14200
     orig_span: &id005
     - s0_pad
     - mcuboot
     region: flash_primary
     size: 0xc200
     span: *id005
    s0_pad:
     address: 0x8000
     end_address: 0x8200
     placement:
     after:
     - b0_container
     align:
     start: 0x1000
     region: flash_primary
     share_size:
     - mcuboot_pad
     size: 0x200
    s0_image:
     address: 0x8200
     end_address: 0x14200
     orig_span: &id006
     - mcuboot
     region: flash_primary
     size: 0xc000
     span: *id006
    mcuboot:
     address: 0x8200
     end_address: 0x14200
     placement:
     before:
     - mcuboot_primary
     region: flash_primary
     sharers: 0x1
     size: 0xc000
    
    EMPTY_0:
     address: 0x14200
     end_address: 0x15000
     placement:
     before:
     - s1_pad
     region: flash_primary
     size: 0xe00
    
    s1:
     address: 0x15000
     end_address: 0x21200
     orig_span: &id007
     - s1_pad
     - s1_image
     region: flash_primary
     size: 0xc200
     span: *id007
    s1_pad:
     address: 0x15000
     end_address: 0x15200
     placement:
     after:
     - s0
     align:
     start: 0x1000
     region: flash_primary
     share_size:
     - mcuboot_pad
     size: 0x200
    s1_image:
     address: 0x15200
     end_address: 0x21200
     placement:
     after:
     - s1_pad
     - s0
     region: flash_primary
     share_size:
     - mcuboot
     size: 0xc000
    
    EMPTY_1:
     address: 0x21200
     end_address: 0x22000
     placement:
     before:
     - mcuboot_pad
     region: flash_primary
     size: 0xe00
    
    app_image:
     address: 0x22200
     end_address: 0x80000
     orig_span: &id001
     - app
     region: flash_primary
     size: 0x5de00
     span: *id001
    mcuboot_pad:
     address: 0x22000
     end_address: 0x22200
     placement:
     align:
     start: 0x1000
     before:
     - mcuboot_primary_app
     region: flash_primary
     sharers: 0x2
     size: 0x200
    mcuboot_primary_app:
     address: 0x22200
     end_address: 0x80000
     orig_span: &id004
     - app
     region: flash_primary
     size: 0x5de00
     span: *id004
    mcuboot_primary:
     address: 0x22000
     end_address: 0x80000
     orig_span: &id003
     - app
     - mcuboot_pad
     region: flash_primary
     size: 0x5e000
     span: *id003
    app:
     address: 0x22200
     end_address: 0x80000
     region: flash_primary
     size: 0x5de00
    
    sram_primary:
     address: 0x20000000
     end_address: 0x20010000
     region: sram_primary
     size: 0x10000
    

    ```
Related