Why does the factory_data partition needs to be in front the settings partition?

I just ran into the issue that the settings_storage partition needs to be after the factory_data partition, and I asked myself why.

The problem is that, in case you need to expand the settings_storage partition in field, you would run into the problem that you need to move 2 partitions (factory_data and settings_storage), but if the settings_storage could be placed in front of the factory_data partition I would just need to redefine the start address. This restriction feels arbitrary.

  • Hi,

    According to the developers, moving the factory data and settings storage partitions should be allowed as long as they are aligned to a proper size, so the fact that this is not possible could be a bug. They will look into it and provide a fix, but I cannot comment on the schedule for when this will be fixed since this needs to be prioritized against other tasks.

    The developers would normally not recommend bypassing the assert. Still, since the assert is checking the incorrect thing and causing an assert to happen for something that should be allowed, they have stated that if this is a blocker, then a possible workaround is to remove the assert from FactoryDataProvider.h as long as you make sure that the partitions are consistent with the requirements that they are aligned with the fprotect block size.

    Best regards,
    Marte

  • So I figured out that this was working in nrfconnect-sdk v2.2.0.

    The change was introduced in 4c7f38d6427436f47c603dce67a1acd63ab7106a. It adds the lines

    constexpr size_t kFactoryDataBlockEnd =
    (PM_FACTORY_DATA_ADDRESS + PM_FACTORY_DATA_SIZE + CONFIG_FPROTECT_BLOCK_SIZE - 1) & (-CONFIG_FPROTECT_BLOCK_SIZE);
    static_assert(kFactoryDataBlockEnd <= PM_SETTINGS_STORAGE_ADDRESS,
    "FPROTECT memory block, which contains factory data"
    "partition overlaps with the settings partition."
    "Probably your settings partition size is not a multiple"
    "of the atomic FPROTECT block size of " TO_STR(CONFIG_FPROTECT_BLOCK_SIZE) "kB");

    As you may see, the test ist simply if the end of the factory data is in front of the PM_SETTINGS_STORAGE_ADDRESS address. Maybe the developers can fix this approach for the next nrfconnect-sdk version.

    Best regards,
    Juliane

  • Hi Juliane,

    The developers are aware of this and it is registered as a bug internally. I cannot comment on the schedule for when this will be fixed since this needs to be prioritized against other tasks.

    Best regards,
    Marte

  • Hi Juliane,

    I just wanted to update you that there is a pull request for the fix now: https://github.com/nrfconnect/sdk-connectedhomeip/pull/499.

    Best regards,
    Marte

Related