[Zephyr Settings NVS] 2 settings, one in internal flash, one in external flash

Hi,

I am working on a Homekit project and the nRF Homekit SDK uses NVS settings to store data in the internal flash.
Is it possible that I can add another partition in the external flash and still use Zephyr NVS Settings to store data there for my application and not change the original Homekit SDK/NVS settings in the internal flash?  And how to modify dts and pm to do that?

update: I checked zephyr/subsys/settings/src/settings_nvs.c and it defined FLASH_AREA_ID(storage), seems settings NVS only handles one partition. Any workaround I can use?

&flash0 {

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

        boot_partition: partition@0 {
            label = "mcuboot";
            reg = <0x00000000 0x0000C000>;
        };

        slot0_partition: partition@c000 {
            label = "image-0";
            reg = <0x0000C000 0x00067000>;
        };

        slot1_partition: partition@73000 {
            label = "image-1";
            reg = <0x00073000 0x00067000>;
        };

        scratch_partition: partition@da000 {
            label = "image-scratch";
            reg = <0x000da000 0x0001e000>;
        };

        /*
         * The flash starting at 0x000f8000 and ending at
         * 0x000fffff is reserved for use by the application.
         */

        /*
         * Storage partition will be used by FCB/LittleFS/NVS
         * if enabled.
         */

        storage_partition: partition@f8000 {
            label = "storage";
            reg = <0x000f8000 0x00008000>;
        };
    };
};


mcuboot:
  address: 0x0
  region: flash_primary
  size: 0x9000
mcuboot_pad:
  address: 0x9000
  region: flash_primary
  size: 0x200
app:
  address: 0x9200
  size: 0xf4e00
mcuboot_primary:
  orig_span: &id001
  - mcuboot_pad
  - app
  span: *id001
  address: 0x9000
  size: 0xf5000
  region: flash_primary
mcuboot_primary_app:
  orig_span: &id002
  - app
  span: *id002
  address: 0x9200
  size: 0xf4e00
settings_storage:
  address: 0xfe000
  size: 0x2000
  region: flash_primary
mcuboot_secondary:
  address: 0x0
  size: 0xf5000
  device: MX25R64
  region: external_flash
external_flash:
  address: 0xf5000
  size: 0x70b000
  device: MX25R64
  region: external_flash



Parents Reply Children
No Data
Related