partition manager: how to define a region with multiple partitions and use it in application code.

Maybe someone can help ...


Context:
We are in the process of migrating a project from Stm32F to nrf5340 using Zephyr.
Our firmware is functional (currently without a possibility to perform a firmware update over Bluetooth (using DFU).

Now we want to add DeviceFirmwareUpdate, since this is a requirement.
- we tested the SimpleMessageProtocol example, which includes the MCUBootloader, which works fine).

We have update our code using the experience from above mentioned SMP example.
The problem we now have is, that we want to define flash area for DATAStorage in our application and dont know how to add this to the memory map.

We dont' want to use the NVS (since the DATAStorage contains a huge block of 148kB of data which is optimized for memory storage).

- i read the partition_manager documentation.
- I am stuck at the point where to define a new region? (since this seems to be done in nordicsemi\v2.0.0\nrf\cmake\partition_manager.cmake).
- can any one point me to an example or to a direction how to :
   - define the region and partition(s) for usage by the partition manager
   - access the defined region partition in code, so that we can read/write to it from within the application code

Thanks in advance,
René

  • this is, by far, the most elegant solution I've seen for littlefs. Thanks, man!

    Always a gem lurking on this forum :)

    /delete-node/ &slot1_ns_partition;
    
    &flash0 {
    	partitions {
    		nvs_partition: partition@f8000 {
    			reg = <0xc0000 0x38000>;
    			label = "section";
    		};
    	};
    };
    
    / {
    	fstab {
    		compatible = "zephyr,fstab";
    		lfs1: lfs1 {
    			compatible = "zephyr,fstab,littlefs";
    			mount-point = "/lfs1";
    			partition = <&nvs_partition>;
    			automount;
    			read-size = <16>;
    			prog-size = <16>;
    			cache-size = <64>;
    			lookahead-size = <32>;
    			block-cycles = <512>;
    		};
    	};
    };

    And you can always chain it with another defined partition for easy access.

Related