MCUBoot runtime error: "Cannot upgrade: not a compatible amount of sectors" with external flash on nrf9160

Hi,

I am using NCS 2.1.2 with the [email protected] (but I have tested with 2.2.0-rc1 and it doesn't change anything). I have attached a simple example which should just place the MCUBoot secondary partition in the external flash with pm_static.yml. I am using the firmware here: https://github.com/simon-iversen/sdk-nrf/tree/d1a11f2c39e3b8fb0af7652e7e720626f0e1298e/samples/nrf9160/http_update/application_update to connect the NOR flash to the nrf91.

This appears to compile fine, but, on bootup I get the following errors printed by the bootloader:

W: Failed reading sectors; BOOT_MAX_IMG_SECTORS=256 - too small?
W: Cannot upgrade: not a compatible amount of sectors

On stepping through the code, it appears that the flash_area_get_sectors function is returning -22 (EINVAL) for the secondary partition on the external flash because flash_area_open is failing with -19 (ENODEV). However, I know that the flash is working fine because (in the second example attached) littlefs on the external flash formats and mounts correctly.

I found in another thread this fix for a similar problem: https://github.com/nrfconnect/sdk-nrf/pull/9169/files# (I unfortunately cannot find the thread again) but I have applied this patch and it does not seem to change anything.

Could you please help me understand what the problem is here?

Thanks,

Jeremy

8156.nrf9160dk_extflash_mcuboot.zip

  • Hi Jeremy.

    jeremyherbert said:
    Thanks! I have it working now. It seems that there were a few issues here:

    Sweet!

    jeremyherbert said:
    t seems point 1 is already fixed. For point 2, can I suggest adding something to the documentation about this? For point 3, even though it is incorrect to have different partition sizes, I do think it is a bug that compilation is successful, seeing as it can never work anyway, and this problem can be checked at compile time. What does the "share_size" directive in pm_static.yml do if not require them to be the same?

    I have forwarded it to our developers. And for what it's worth: I agree on both things.
    So hopefully we will be able to improve this in future releases.
    Thanks for pointing things out, it helps us do better!

    Regards,
    Sigurd Hellesvik

Related