BUG: MCUBoot network core update sometimes fails to update

When uploading a network core image though MCUBoot and confirming the image, sometimes it fails to accept and on other builds it accepts the update.

I have narrowed this down to the check in zephyr flash simulator flash_sim_write which checks if the offset and length are multiples of the flash sim prog unit.

https://github.com/nrfconnect/sdk-zephyr/blob/main/drivers/flash/flash_simulator.c#L227

My build environment generates ipc_radio.bin images that vary in length anywhere from 132236, 132235, to 132234 bytes. Only the 132236 confirms as it is a multiple of 4.

My understanding is the nrf5340 uses the flash simulator as a zephyr built in way to map the shared memory to a fake flash api so the built in loader.c code copies the data over to shared memory automatically, then nrf53_hooks.c takes over and performs a network core update.

This value of 4 comes from the flash_sim.overlay write-block-size property which is set to 4.

https://github.com/nrfconnect/sdk-nrf/blob/main/modules/mcuboot/flash_sim.overlay#L36

Since the flash simulator is mapped to sram, it does not need word aligned writes. Setting this value to 1 allows byte level writes to memory and the problem is resolved.

Parents Reply Children
No Data
Related