Partition Manager Error w/ Direct XIP and MCUboot enabled

Hello,

I am looking to utilize direct xip w/ MCUboot and am observing an error from the partition manager relating to placement of the mcuboot_secondary_pad. I am able to reproduce this error w/ the zephyr hello_world sample by adding the following configurations:

prj.conf

CONFIG_BOOTLOADER_MCUBOOT=y
CONFIG_BOOT_BUILD_DIRECT_XIP_VARIANT=y

child_image/mcuboot.conf

CONFIG_BOOT_DIRECT_XIP=y

Running $ west build -b nrf5340dk_nrf5340_cpuapp --pristine

yields the following error:


Partition manager failed: Error when inspecting mcuboot_secondary_pad, invalid address 0x84000, expected 0x84001,
Failed to partition region flash_primary, size of region: 1048576
Partition Configuration:
mcuboot:
placement:
before:
- mcuboot_primary
size: 49152
mcuboot_pad:
placement:
align:
start: 16384
before:
- mcuboot_primary_app
size: 512
mcuboot_secondary_app:
placement:
after:
- mcuboot_secondary_pad
size: 491009
mcuboot_secondary_pad:
placement:
after:
- mcuboot_primary
align:
start: 16384
size: 512

If I comment out the alignment directive in the mcuboot_secondary_pad partition from $NCS_DIR/bootloader/mcuboot/boot/zephyr/pm.yml I am able to build successfully.

Parents Reply Children
  • Hello, sorry for the late reply. 

    During the summer season, our workforce is currently operating with reduced staff levels throughout the company, which may lead to slight delays in our response time as we await additional resources. Rest assured, we are actively addressing all issues and working diligently to resolve them promptly.


    There is a sample for Direct-XIP found here: nrf\tests\modules\mcuboot\direct_xip

    This configures the PM partition size of MCUboot in the mcuboot child image. Please test this and see how that works for your application. 
    Using MCUboot in nRF Connect SDK

    Kind regards,
    Øyvind

  • Hello,

    Thanks for the response. I looked at this direct_xip sample and saw the only thing I was missing was having CONFIG_PM_PARTITION_SIZE_MCUBOOT=0x10000 in child_image/mcuboot.conf. Once I updated this kconfig, the hello_world sample built for me w/ direct_xip enabled. However, I still believe there is likely a bug in the partition manager script as dropping the mcuboot partition size down from 64 kB to 48 kB shouldn't cause the partition manager to attempt to locate the mcuboot_secondary_pad partition on an unaligned address of 0x84001.

    Thanks,
    Evan

  • Thank you for the reply  I'm working on this project with Evan. 

    I can compile the stock sample code for nrf5340dk_nrf5430_cpuapp, but we are enabling an nvs settings partition and a littlefs storage partition.

    Adding in these config options into prj.conf will reproduce the error

    CONFIG_FLASH=y
    CONFIG_FLASH_MAP=y
    CONFIG_SETTINGS=y
    CONFIG_NVS=y
    CONFIG_SETTINGS_NVS=y
    CONFIG_FILE_SYSTEM=y
    CONFIG_FILE_SYSTEM_LITTLEFS=y
    CONFIG_PM_PARTITION_SIZE_LITTLEFS=0x8000

    Update:  I can get this code to build with the following steps

    1.  In mcuboot.conf, comment out CONFIG_PM_PARTITION_SIZE_MCUBOOT=0x10000

    2.  create a partition manager report and use the generated file as a static partition file

    west build -b nrf5340dk_nrf5340_cpuapp -t partition_manager_report --pristine
    cp build/partitions.yml pm_static.yml

  • Hello, sorry for the late reply. 

    Evan Hosseini said:
    However, I still believe there is likely a bug in the partition manager script as dropping the mcuboot partition size down from 64 kB to 48 kB shouldn't cause the partition manager to attempt to locate the mcuboot_secondary_pad partition on an unaligned address of 0x84001.

    This seems to be a know bug which they are working on. I have no timeline on fix unfortunately. 

    Roedy said:
    Update:  I can get this code to build with the following steps

    Does it work as intended for you now?

  • Hello, sorry for the late reply. 

    Evan Hosseini said:
    However, I still believe there is likely a bug in the partition manager script as dropping the mcuboot partition size down from 64 kB to 48 kB shouldn't cause the partition manager to attempt to locate the mcuboot_secondary_pad partition on an unaligned address of 0x84001.

    This seems to be a know bug which they are working on. I have no timeline on fix unfortunately. 

    Roedy said:
    Update:  I can get this code to build with the following steps

    Does it work as intended for you now?

Related