MCUboot sign image: possible wrong slot size

I encountered the problem trying a Matter OTA-update and and asking myself why the bootloader wouldn't apply the image:

I am using the partition manager and defining the mcuboot_pad and mcuboot_primary_app partition both in the mcuboot_primary partition. MCUboot uses the mcuboot_primary_app partition value as definition of the maximum allowed partition size. However, both the sign function in nrf/modules/mcuboot/CMakeLists.txt as well as Zephyr use mcuboot_primary as available size for the image.

This leads to the problem that for an app, which exceeds the size of mcuboot_primary_app but is smaller than mcuboot_primary thebuild works fine, signing works as expected, but after the update file is send MCUboot does not apply the image.

I suggest setting

SLOT_SIZE $<TARGET_PROPERTY:partition_manager,PM_MCUBOOT_PRIMARY_APP_SIZE>

instead of

SLOT_SIZE $<TARGET_PROPERTY:partition_manager,PM_MCUBOOT_PRIMARY_SIZE>

Sadly, I haven't figured out where the app size in Zephyr is set, this may also need to be updated.

Parents
  • Our developers do not think the line you change is a good fix for this.
    Instead, we have another internal ticket on MCUboot and partitioning that we suspect is the cause of this.
    MCUboot uses the last part of the secondary slot(I think it is there) to swap images. This means that if the application is too large there may be issues with swapping.
    Hopefully when we fix that, this issue will also be solved by the same fix.

Reply
  • Our developers do not think the line you change is a good fix for this.
    Instead, we have another internal ticket on MCUboot and partitioning that we suspect is the cause of this.
    MCUboot uses the last part of the secondary slot(I think it is there) to swap images. This means that if the application is too large there may be issues with swapping.
    Hopefully when we fix that, this issue will also be solved by the same fix.

Children
Related