I am using the Thingy91 and want a larger flash partition to use for non-volatile storage ("storage" is only 0x6000 in size). I am building for nonsecure ("west build -b thingy91_nrf9160_ns") and am not performing firmware upgrades, so it is my understanding that I could use "image-1" or "image-1-nonsecure" for my storage purposes.
I have been looking at these lines in nrf/boards/arm/thingy91_nrf9160/thingy91_nrf9160_common.dts for reference:
&flash0 {
/*
* For more information, see:
* http://docs.zephyrproject.org/devices/dts/flash_partitions.html
*/
partitions {
compatible = "fixed-partitions";
#address-cells = <1>;
#size-cells = <1>;
boot_partition: partition@0 {
label = "mcuboot";
reg = <0x00000000 0x10000>;
};
slot0_partition: partition@10000 {
label = "image-0";
};
slot0_ns_partition: partition@40000 {
label = "image-0-nonsecure";
};
slot1_partition: partition@80000 {
label = "image-1";
};
slot1_ns_partition: partition@b0000 {
label = "image-1-nonsecure";
};
scratch_partition: partition@f0000 {
label = "image-scratch";
reg = <0x000f0000 0xa000>;
};
storage_partition: partition@fa000 {
label = "storage";
reg = <0x000fa000 0x00006000>;
};
};
};
Is my proposed use of "image-1" or "image-1-nonsecure" correct and safe?
If so, I would then do something like this in my application:
//Do necessary #include's
#define STORAGE_NODE_LABEL image_1
static struct nvs_fs fs;
void main(void)
{
fs.flash_device = FLASH_AREA_DEVICE(STORAGE_NODE_LABEL);
fs.offset = FLASH_AREA_OFFSET(image_1);
//Define sector size and count, then mount and use NVS here...
}
Or should I reduce the sizes of "image-0" and "image-1" in the .dts file and increase the size of "storage" instead?
