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 again,

    I found the time to do the work I described for you:

    https://github.com/aHaugl/samples_for_NCS/tree/main/DFU/serial_recover_nsib/serial_recovery_nsib_52832

    To repeat what I described previously and what I did:

    1. I took the sample in https://github.com/aHaugl/samples_for_NCS/tree/main/DFU/serial_recover_nsib/serial_recovery_nsib_52840, which is the same I linked earlier 
    2. Deleted the pm_static.yml 
    3. Built for nrf52dk_nrf52832 with dynamic partitioning
    4. Opened the generated partitions.yml located in the build folder and copied it to a pm_static.yml
    5. Calculated how large mcuboot_primary needed to be to to fill the remaining gap after I've set the mcuboot_secondary partition size to be equal to the size of MCUboot:

      MCUboot secondary application slot ends at 0x80000 and which means that when matching the size of MCUboot (48kB) it will have to start at 0x74000.

      mcuboot_secondary:
        address: 0x74000
        end_address: 0x80000
        placement:
          after:
          - mcuboot_primary
          align:
            start: 0x1000
          align_next: 0x1000
        region: flash_primary
        share_size:
        - mcuboot_primary
        size: 0xc000
    6. This means that Mcuboot_primary (and app image and app) has to end at 0x740000 and the size changes from 0x2ee00 to 0x51e00
    7. Rebuild the firmware with static configuration and you will get something like this

        flash_primary (0x80000 - 512kB):
      +--------------------------------------------------+
      +---0x0: b0_container (0x8000 - 32kB)--------------+
      | 0x0: b0 (0x7000 - 28kB)                          |
      | 0x7000: provision (0x1000 - 4kB)                 |
      +---0x8000: s0 (0xc200 - 48kB)---------------------+
      | 0x8000: s0_pad (0x200 - 512B)                    |
      +---0x8200: s0_image (0xc000 - 48kB)---------------+
      | 0x8200: mcuboot (0xc000 - 48kB)                  |
      +--------------------------------------------------+
      | 0x14200: EMPTY_0 (0xe00 - 3kB)                   |
      +---0x15000: s1 (0xc200 - 48kB)--------------------+
      | 0x15000: s1_pad (0x200 - 512B)                   |
      | 0x15200: s1_image (0xc000 - 48kB)                |
      +--------------------------------------------------+
      | 0x21200: EMPTY_1 (0xe00 - 3kB)                   |
      +---0x22000: mcuboot_primary (0x51e00 - 327kB)-----+
      | 0x22000: mcuboot_pad (0x200 - 512B)              |
      +---0x22200: app_image (0x51e00 - 327kB)-----------+
      +---0x22200: mcuboot_primary_app (0x51e00 - 327kB)-+
      | 0x22200: app (0x51e00 - 327kB)                   |
      +--------------------------------------------------+
      | 0x74000: mcuboot_secondary (0xc000 - 48kB)       |
      +--------------------------------------------------+
      
        sram_primary (0x10000 - 64kB):
      +-------------------------------------------+
      | 0x20000000: sram_primary (0x10000 - 64kB) |
      +-------------------------------------------+

    It might not be perfect, but it shows what I previously explained and illustrates how you can implement a dual slot secondary bootloader update + single slot application update solution in your firmware for a nRF52832dk

    Let me know if this is enough to keep you going!

    Kind regards,
    Andreas

Related