Problem with custom signed images and mcuboot swap


We are using a custom board with nrf52840 and just started using our own generated keys to sign images with NRF SDK v1.9.1.

We ran into issues when trying to swap images using mcuboot with our generated keys.

When using the default keys everything works fine, the image in mcuboot_secondary slot gets swapped and CPU boots as expected.

But when using our own generated keys the CPU gets stuck after swap type: test, see below.

1. We request and upgrade using shell: mcuboot request_upgrade

primary area (3):
version: 1.0.0+29
image size: 429564
magic: unset
swap type: none
copy done: unset
image ok: unset

secondary area (1):
version: 2.0.0+29
image size: 429564
magic: good
swap type: test
copy done: unset
image ok: unset

2. We reboot the processor using shell: kernel reboot cold.

cold*** Booting Zephyr OS build v2.7.99-ncs1-1 ***
I: Starting bootloader
I: Primary image: magic=unset, swap_type=0x1, copy_done=0x3, image_ok=0x3
I: Secondary image: magic=good, swap_type=0x2, copy_done=0x3, image_ok=0x3
I: Boot source: none
I: Swap type: test

3. The CPU is stuck in this case and a boot of the image never occurs.

Resetting the CPU will return to mcuboot getting stuck again, and the flash needs to be erased to recover.

We inspected the flash when the CPU is stuck using nrfjprog and the images have been swapped by looking at the version number in the MCUBOOT header. mcuboot_secondary is not deleted, which indicates that the image is not invalid.

We have tested images signed with different keys and mcuboot work as expected in this case; Preventing a swap and removing the image in mcuboot_secondary slot.

We have also tested swapping using MCUMgr, but the same problem occurs.

The mcuboot_secondary slot is located on a external flash, MX24R64.

We have another custom board that is using NRF52840 with the exact same flash which works with our own generated keys, also built using the same SDK with mcuboot_secondary on external flash aswell.

Appreciate some pointers as of what could be wrong.


Parents Reply Children