mcuboot can't find bootable image when multi-image configuration is used

Hi, I am looking to use mcuboot to manage 2 separate images. The idea is that under certain conditions, image 1 would jump to image 2.

To test the idea, I am using the zephyr hello_world sample with minimal modifications:

prj.conf:

CONFIG_BOOTLOADER_MCUBOOT=y

CONFIG_FLASH=y
CONFIG_IMG_MANAGER=y
CONFIG_UPDATEABLE_IMAGE_NUMBER=2

CONFIG_NRF53_UPGRADE_NETWORK_CORE=n

child_image/mcuboot.conf:

CONFIG_UPDATEABLE_IMAGE_NUMBER=2

pm_static.yml:

app:
  address: 0x10200
  region: flash_primary
  size: 0x1fe00
mcuboot:
  address: 0x0
  region: flash_primary
  size: 0x10000
mcuboot_pad:
  address: 0x10000
  region: flash_primary
  size: 0x200

mcuboot_primary:
  address: 0x10000
  orig_span: &id001
  - mcuboot_pad
  - app
  region: flash_primary
  size: 0x20000
  span: *id001
  
mcuboot_primary_app:
  address: 0x10200
  orig_span: &id002
  - app
  region: flash_primary
  size: 0x1fe00
  span: *id002

mcuboot_primary_1:
  address: 0x30000
  size: 0x20000
  region: flash_primary
mcuboot_secondary:
  address: 0x50000
  size: 0x20000
  region: flash_primary
mcuboot_secondary_1:
  address: 0x70000
  size: 0x20000
  region: flash_primary
EMPTY_0:
  address: 0x90000
  size: 0x70000
  region: flash_primary

On boot, I get the following logs from mcuboot:

*** Booting Zephyr OS build v3.1.99-ncs1  ***
I: Starting bootloader
I: Primary image: magic=unset, swap_type=0x1, copy_done=0x3, image_ok=0x3
I: Secondary image: magic=unset, swap_type=0x1, copy_done=0x3, image_ok=0x3
I: Boot source: none
W: Failed reading image headers; Image=0
I: Primary image: magic=unset, swap_type=0x1, copy_done=0x3, image_ok=0x3
I: Secondary image: magic=unset, swap_type=0x1, copy_done=0x3, image_ok=0x3
I: Boot source: none
W: Failed reading image headers; Image=1
E: Image in the primary slot is not valid!
E: Unable to find bootable image

And my application does not boot.

I am using NCS v2.1.0 and nRF5340 DK, along with the nRF Connect VSCode extension for building and flashing.

Related