Clarifications about partitions structure

Good morning!

I hope you will forgive my trivial question but I am a beginner.
I don't quite understand the partition structure presented in the "NVS" example. Using the devicetree gui I get the following figure:

I'm developing an application that would store GNSS coordinates in internal flash. I actually can only use 32kb (7 + 1 pages) and I would like to enlarge the storage partition.

I actually have mcoboot, image-0, image-0 non secure, image-1, image-1 non secure and storage. Which partitions can I remove to enlarge my storage partition? Can you please explain the meaning of the other partitions?

Excuse me but I tried to read the documentation but I'm very confused.

Thank you in advance!

Regards.

Cristiano

Parents
  • Hi,

    Excuse me but I tried to read the documentation but I'm very confused.

    Then you have come to the right place!
    Minus: I can inform you that this is even more confusing than what you think.
    Plus: We have resources and DevZone to help you guide you through this.

    First, read through This lesson, and specifically the partitioning information.

    Then let me know if this is still unclear and I will continue the explanation from there.

    Regards,
    Sigurd Hellesvik

  • Hi Sigurg!

    Thank you for your help! Unfortunately, despite I read the documentation you suggested, I'm still not able to enlarge my storage space. In devicetree visual editor I tried to increase storage space from 32kb to 64kb in my overlay file.

    I also get this error:

    I anyway saved it.

    If I try to use more than 8 pages in my code:

    I obviously get and error when executing my code:

    Probably I didn't understand...

    Can you please help me again? Thank you in advance!

    Cristiano

Reply
  • Hi Sigurg!

    Thank you for your help! Unfortunately, despite I read the documentation you suggested, I'm still not able to enlarge my storage space. In devicetree visual editor I tried to increase storage space from 32kb to 64kb in my overlay file.

    I also get this error:

    I anyway saved it.

    If I try to use more than 8 pages in my code:

    I obviously get and error when executing my code:

    Probably I didn't understand...

    Can you please help me again? Thank you in advance!

    Cristiano

Children
  • I will write a  more in-depth explanation on this, but it will take  some time as I am just back from our Easter vacation.

    For the quick and unexplained answer first, try to set the following in your prj.conf:

    CONFIG_BOOTLOADER_MCUBOOT=y
    CONFIG_NVS=y
    CONFIG_PM_PARTITION_SIZE_NVS_STORAGE=0x10000

  • Hi Sigurd!

    Many thanks for your "on the fly" answer! Obviously it works... Slight smile

    But, yes, I really need you to try to explain me what happens. Using your settings I successfully set

    fs.sector_count = 16U;

    and got no error when executing code. Performing a "Memory Report" I got this:

    Is it correct?

    I probably forgot to say that I've started my experiments using "NVS sample".

    This is my prj.conf file.

    CONFIG_FLASH=y
    CONFIG_FLASH_PAGE_LAYOUT=y
    
    CONFIG_NVS=y
    CONFIG_LOG=y
    CONFIG_LOG_MODE_IMMEDIATE=y
    CONFIG_NVS_LOG_LEVEL_DBG=y
    CONFIG_REBOOT=y
    CONFIG_MPU_ALLOW_FLASH_WRITE=y
    
    CONFIG_BOOTLOADER_MCUBOOT=y
    CONFIG_PM_PARTITION_SIZE_NVS_STORAGE=0x10000

    Thank you againg for your patience and help.

    Regards!

    Cristiano

  • So the nRF Connect SDK has two different ways of doing partitioning:

    DTS partitioning

    This is the one used by Zephyr, and is the one you see in the DTS viewer.
    This is used whenever the Partition Manager is not used.

    Partition Manager partitioning

    The Partition Manager is automatically enabled for some use-cases in the nRF Connect SDK, such as enabling a bootloader. Since you pretty much always want a bootloader in your project, this is the one I recommend defaulting to.
    That is also why I enabled the bootloader in my quick-fix, as it is the "most natural" method for enabling the Partiton manager.
    With the Partition Manager enabled, the DTS partitioning is ignored, so whatever you see in the DTS viewer is really not used after all. (See, I told you it was more confusing than you thought it would be).

    But now that we know that we only look at Partition Manager partitioning, we can use that.
    The Partition Manager dynamically partitions your partitions. So to change the sizes of these, we use Kconfig (prj.conf). To find relevant configuration for this search out Kconfig search for CONFIG_PM_PARTITION_SIZE.

    Then as you did you can use Partition Manager Report to see how the partitioning was set in the end.

    TheSpawn74 said:
    Is it correct?

    And yes that looks good to me.

    Bonus: If you enable external flash on your device, you can use CONFIG_PM_PARTITION_REGION_NVS_STORAGE_EXTERNAL to configure the partition to use external flash.

    Did this explanation make sense?
    Let me know if anything was unclear

  • Hi Sigurd!

    Thank you for your reply.

    I would like to ask you if there a way to better understand the meaning of all the partitions I see in memory report.

    Reading the nRF9160 memory by nRF Programmer with these settings:

    CONFIG_BOOTLOADER_MCUBOOT=y
    CONFIG_PM_PARTITION_SIZE_NVS_STORAGE=0x10000

    I see something like this:

    Instead, with these settings (I guess bootloader is not enabled),

    #CONFIG_BOOTLOADER_MCUBOOT=y                       
    CONFIG_PM_PARTITION_SIZE_NVS_STORAGE=0x10000

    I see this:

    It seems the CONFIG_PM_PARTITION_SIZE_NVS_STORAGE=0x10000 works also with bootloader not enabled. This is the memory report:

    So, in this second case, I'm not using bootloader... Do you confirm?

    Thank you again!

    Cristiano

  • In the second case you do not use a bootloader, that is correct.

    I think that TF-M (building with _ns) also enables the partition manager, which is why you still get a partition manager report without MCuboot

Related