Configuring external flash and internal flash for MCU Boot, Little FS, and for settings with a custom board

I am trying to set up a w25q128 using SPI with a nrf5340 on a custom board and had a few questions. I have used DevAcademy as a reference as I do eventually want to set up MCUBoot but right now I want to get the fiile system and settings up and running. 

  • Is there any change to the need for pm_static.yml when using toolchains 2.9.x or 3.x?
  • Is there a reason why one would use the boot, slot0, and slot1 partitions for mcuboot on external flash vs internal flash? Could I use the 1MB of internal flash for this?
  • Do I need to create a seperate partition when using the Zephyr settings infrastructure?
  • Are the instructions to use pm manager until things are set applicable when using littlefs? Doesn't that also cause me to "freeze" the partitions (see reference below)?
  • Does SRAM needs to be configured as well?
  • I have seen multiple entries for secure and non-secure, do I need to create paritions for each? When does one get used vs another?

I've watched this Nordic video on DFU/FOTA which was great and I hope you do more of these. The use of pm manager and memory report to show the memory:

In it he recommends using dynamic partitioning for development and then freeze the partitioning. I've also listened to Zephyr 101 - Device Settings Using nRF9160 Feather External Flash which is also very helpful but would like to drill deeper into some of the specific topics I'm interested in and would like more coverage of the basics as well. For example:

When I have this code:

//start filesystem config
#define PARTITION_NODE DT_NODELABEL(lfs)
FS_FSTAB_DECLARE_ENTRY(PARTITION_NODE);
struct fs_mount_t *mp = &FS_FSTAB_ENTRY(PARTITION_NODE);

It references a fstab entry which in another example I have looks like this:

	fstab {
		compatible = "zephyr,fstab";
		lfs: lfs {
			compatible = "zephyr,fstab,littlefs";
			mount-point = "/lfs";
			partition = <&littlefs_storage>;
			automount;
            read-size = <16>;
			prog-size = <16>;
			cache-size = <64>;
			lookahead-size = <32>;
			block-cycles = <512>;
		};
	};

I believe that also has to be references in the device tree as well. In the case of the dk I am trying to adapt to my custom board that would look like:

&mx25r64 {
	partitions {
		compatible = "fixed-partitions";
		#address-cells = <1>;
		#size-cells = <1>;

		littlefs_storage: partition@0 {
			label = "littlefs_storage";
			reg = <0x00000000 0x00200000>;
		};
		lvgl_raw_partition: partition@200000 {
			label = "lvgl_raw_partition";
			reg = <0x00200000 0x00200000>;
		};
        settings_partition: partition@400000 {
            label = "settings_partition";
            reg = <0x400000 0x100000 >;
        };
	};
};


I don't really need all those partitions, but the example I was using had them. I don't know if I need to keep settings in a different partition from the littlefs_storage or not. I guess this is the part I need to mirror in the pm_static.yml, is that correct? Do I only need to have a subset of the entries from the pm_static.yml in here? Do the values (such as reg) need to match those in the pm_static.yml?

I've had even very seasoned Zephry/Nordic people mention "It's not super easy to get it up and running, took me some fiddling around until I got it to work...", so it may be worth while to cover. I've seen

I have seen the comments in here which brings up the quetion of trust zone and sram.

I see the documentation for partition manager and 

Regarding posts I've read:

I've looked in git and seen:

  • sdk-nrf which seems to also include sram entries
Parents
  • Hi,

    Is there any change to the need for pm_static.yml when using toolchains 2.9.x or 3.x?

    No. Same as before: Don't need for development, but required for release.

    Is there a reason why one would use the boot, slot0, and slot1 partitions for mcuboot on external flash vs internal flash? Could I use the 1MB of internal flash for this?

    boot and slot0 must be on internal flash. slot1 is typically on external flash if you got external flash, but it can be on internal flash if you want to.

    Do I need to create a seperate partition when using the Zephyr settings infrastructure?

    A settings partition will be created automatically for you if use dynamic partitioning and enable settings. If you use static partitioning, then yes.

    Does SRAM needs to be configured as well?

    This will be done dynamically, so I recommend to not do that manually.

    I have seen multiple entries for secure and non-secure, do I need to create paritions for each? When does one get used vs another?

    This will be done dynamically if you use TF-M. Will you use TF-M in your project?

    I've watched this Nordic video on DFU/FOTA which was great and I hope you do more of these.

    Im glad you liked it!

    In it he recommends using dynamic partitioning for development and then freeze the partitioning.

    I still stand by this!

    n the case of the dk I am trying to adapt to my custom board that would look like:

    This is a bit complicated, but:
    If you use the Partition Manager, the partitions in DTS will be ignored. So you can keep them there, but use the one from the partition manager instead.

    I don't really need all those partitions, but the example I was using had them. I don't know if I need to keep settings in a different partition from the littlefs_storage or not. I guess this is the part I need to mirror in the pm_static.yml, is that correct? Do I only need to have a subset of the entries from the pm_static.yml in here? Do the values (such as reg) need to match those in the pm_static.yml?

    The easiest would be to use dynamic partitioning, and then make sure that the DTS partitioning matches the partition report from VS Code after the build. Then build again. 
    Or if you use pm_static.yml, then make the DTS and pm_static.yml match. This is kinda not needed, since DTS partitions are ignored, but I think keeping them aligned will help for tidyness.

    I've had even very seasoned Zephry/Nordic people mention "It's not super easy to get it up and running, took me some fiddling around until I got it to work...", so it may be worth while to cover. I've seen

    But hey, we do have a support team that are doing our best to help you learn this!

    Regards,
    Sigurd Hellesvik

Reply
  • Hi,

    Is there any change to the need for pm_static.yml when using toolchains 2.9.x or 3.x?

    No. Same as before: Don't need for development, but required for release.

    Is there a reason why one would use the boot, slot0, and slot1 partitions for mcuboot on external flash vs internal flash? Could I use the 1MB of internal flash for this?

    boot and slot0 must be on internal flash. slot1 is typically on external flash if you got external flash, but it can be on internal flash if you want to.

    Do I need to create a seperate partition when using the Zephyr settings infrastructure?

    A settings partition will be created automatically for you if use dynamic partitioning and enable settings. If you use static partitioning, then yes.

    Does SRAM needs to be configured as well?

    This will be done dynamically, so I recommend to not do that manually.

    I have seen multiple entries for secure and non-secure, do I need to create paritions for each? When does one get used vs another?

    This will be done dynamically if you use TF-M. Will you use TF-M in your project?

    I've watched this Nordic video on DFU/FOTA which was great and I hope you do more of these.

    Im glad you liked it!

    In it he recommends using dynamic partitioning for development and then freeze the partitioning.

    I still stand by this!

    n the case of the dk I am trying to adapt to my custom board that would look like:

    This is a bit complicated, but:
    If you use the Partition Manager, the partitions in DTS will be ignored. So you can keep them there, but use the one from the partition manager instead.

    I don't really need all those partitions, but the example I was using had them. I don't know if I need to keep settings in a different partition from the littlefs_storage or not. I guess this is the part I need to mirror in the pm_static.yml, is that correct? Do I only need to have a subset of the entries from the pm_static.yml in here? Do the values (such as reg) need to match those in the pm_static.yml?

    The easiest would be to use dynamic partitioning, and then make sure that the DTS partitioning matches the partition report from VS Code after the build. Then build again. 
    Or if you use pm_static.yml, then make the DTS and pm_static.yml match. This is kinda not needed, since DTS partitions are ignored, but I think keeping them aligned will help for tidyness.

    I've had even very seasoned Zephry/Nordic people mention "It's not super easy to get it up and running, took me some fiddling around until I got it to work...", so it may be worth while to cover. I've seen

    But hey, we do have a support team that are doing our best to help you learn this!

    Regards,
    Sigurd Hellesvik

Children
No Data
Related