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

  •  

    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
    

    ```
  • Getting:

    ```

    FAILED: zephyr/subsys/mgmt/mcumgr/grp/img_mgmt/CMakeFiles/subsys__mgmt__mcumgr__grp__img_mgmt.dir/src/img_mgmt.c.obj
    
    /home/ab/ncs/v2.6.0/zephyr/subsys/mgmt/mcumgr/grp/img_mgmt/src/img_mgmt.c: In function 'img_mgmt_active_slot':
    /home/ab/ncs/v2.6.0/nrf/include/flash_map_pm.h:52:18: error: 'PM_PM_PM_mcuboot_secondary_ID_LABEL_OFFSET' undeclared (first use in this function)
       52 |         UTIL_CAT(PM_, UTIL_CAT(UTIL_CAT(PM_, UTIL_CAT(PM_ID(label), _LABEL)), x))
          |                  ^~~
    /home/ab/ncs/v2.6.0/zephyr/include/zephyr/sys/util_internal.h:105:36: note: in definition of macro 'UTIL_PRIMITIVE_CAT'
      105 | #define UTIL_PRIMITIVE_CAT(a, ...) a##__VA_ARGS__
          |                                    ^
    /home/ab/ncs/v2.6.0/nrf/include/flash_map_pm.h:52:9: note: in expansion of macro 'UTIL_CAT'
       52 |         UTIL_CAT(PM_, UTIL_CAT(UTIL_CAT(PM_, UTIL_CAT(PM_ID(label), _LABEL)), x))
          |         ^~~~~~~~
    /home/ab/ncs/v2.6.0/nrf/include/flash_map_pm.h:55:39: note: in expansion of macro 'FIXED_PARTITION_DATA_FIELD'
       55 | #define FIXED_PARTITION_OFFSET(label) FIXED_PARTITION_DATA_FIELD(label, _OFFSET)
          |                                       ^~~~~~~~~~~~~~~~~~~~~~~~~~
    /home/ab/ncs/v2.6.0/zephyr/subsys/mgmt/mcumgr/grp/img_mgmt/src/img_mgmt.c:50:10: note: in expansion of macro 'FIXED_PARTITION_OFFSET'
       50 |         (FIXED_PARTITION_OFFSET(label) == (PM_ADDRESS - PM_ADDRESS_OFFSET))
          |          ^~~~~~~~~~~~~~~~~~~~~~
    /home/ab/ncs/v2.6.0/zephyr/subsys/mgmt/mcumgr/grp/img_mgmt/src/img_mgmt.c:164:13: note: in expansion of macro 'FIXED_PARTITION_IS_RUNNING_APP_PARTITION'
      164 |         if (FIXED_PARTITION_IS_RUNNING_APP_PARTITION(slot1_partition)) {
          |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    /home/ab/ncs/v2.6.0/nrf/include/flash_map_pm.h:52:18: note: each undeclared identifier is reported only once for each function it appears in
       52 |         UTIL_CAT(PM_, UTIL_CAT(UTIL_CAT(PM_, UTIL_CAT(PM_ID(label), _LABEL)), x))
          |                  ^~~
    /home/ab/ncs/v2.6.0/zephyr/include/zephyr/sys/util_internal.h:105:36: note: in definition of macro 'UTIL_PRIMITIVE_CAT'
      105 | #define UTIL_PRIMITIVE_CAT(a, ...) a##__VA_ARGS__
          |                                    ^
    /home/ab/ncs/v2.6.0/nrf/include/flash_map_pm.h:52:9: note: in expansion of macro 'UTIL_CAT'
       52 |         UTIL_CAT(PM_, UTIL_CAT(UTIL_CAT(PM_, UTIL_CAT(PM_ID(label), _LABEL)), x))
          |         ^~~~~~~~
    /home/ab/ncs/v2.6.0/nrf/include/flash_map_pm.h:55:39: note: in expansion of macro 'FIXED_PARTITION_DATA_FIELD'
       55 | #define FIXED_PARTITION_OFFSET(label) FIXED_PARTITION_DATA_FIELD(label, _OFFSET)
          |                                       ^~~~~~~~~~~~~~~~~~~~~~~~~~
    /home/ab/ncs/v2.6.0/zephyr/subsys/mgmt/mcumgr/grp/img_mgmt/src/img_mgmt.c:50:10: note: in expansion of macro 'FIXED_PARTITION_OFFSET'
       50 |         (FIXED_PARTITION_OFFSET(label) == (PM_ADDRESS - PM_ADDRESS_OFFSET))
          |          ^~~~~~~~~~~~~~~~~~~~~~
    /home/ab/ncs/v2.6.0/zephyr/subsys/mgmt/mcumgr/grp/img_mgmt/src/img_mgmt.c:164:13: note: in expansion of macro 'FIXED_PARTITION_IS_RUNNING_APP_PARTITION'
      164 |         if (FIXED_PARTITION_IS_RUNNING_APP_PARTITION(slot1_partition)) {
    ```

  • Hi,

    Alex D said:
     AHaug Hi, any updates?

    Working day in Norway is weekdays between 8 and 16 Central European Standard Time, so outside of this window you will have to be patient for a reply

    If possible, it would be nice if you could post logs and code using the insert -> Code function to increase readability

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

    As it is stated in the requirements of the unofficial sample I've created it is only supported for the nRF52840DK, and no other boards. If you wish to port the board you will have to go through the academy courses in detail as well as the partition manager documentation to learn how static partitioning works. Specially lesson 8 in the academy course I referred to yesterday should be a good resource 

    1. https://academy.nordicsemi.com/courses/nrf-connect-sdk-intermediate/lessons/lesson-8-bootloaders-and-dfu-fota/
      1. https://academy.nordicsemi.com/courses/nrf-connect-sdk-intermediate/lessons/lesson-8-bootloaders-and-dfu-fota/topic/multi-image-builds-and-the-partition-manager/
    2. Partition manager https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/nrf/scripts/partition_manager/partition_manager.html 
      1. Static partitioning https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/nrf/scripts/partition_manager/partition_manager.html#adding-a-static-partition 

    You can compile it for the 52DK, but I give you no guarantee that it works by following the same steps. To do this, you can simply remove the static partition that has been used there and it should compile using the dynamic partitioning instead. The default partition manager report should look like shown below. 

    Next you can copy the partitioning that has been generated (located in \build\partitions.yml) and copy the contents into your on pm_static.yml and make the modifications to suit your applications needs. Follow the rules that is written in the partition manager documentation w.r.t locations of partitions, naming conventions and paddings. This is what I did when I created the static partitioning for the 52840DK

    serial_recovery_nsib\build>ninja partition_manager_report
    [1/1] cmd.exe /C "cd /D C:\Nordic\SDKs\ncs\my_projects\2.5..._projects/2.5.0/serial_recovery_nsib/build/partitions.yml"
    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 (0x2f000 - 188kB)-----+
    | 0x22000: mcuboot_pad (0x200 - 512B) |
    +---0x22200: app_image (0x2ee00 - 187kB)-----------+
    +---0x22200: mcuboot_primary_app (0x2ee00 - 187kB)-+
    | 0x22200: app (0x2ee00 - 187kB) |
    +--------------------------------------------------+
    | 0x51000: mcuboot_secondary (0x2f000 - 188kB) |
    +--------------------------------------------------+

    sram_primary (0x10000 - 64kB):
    +-------------------------------------------+
    | 0x20000000: sram_primary (0x10000 - 64kB) |
    +-------------------------------------------+

    I will repeat once more: If you wish to understand how this works, it will require that you read the documentation I've sent you and go through the courses properly

    Kind regards,
    Andreas

Related