nRF5340-DK: Partition Manager for external flash

Hi Support Team,

I'm using nRF5340-DK and the netCore was used for the BLE controller only, the appCore was used for the BLE host and my application.

The below cmake arguments were added for building:
-Dhci_rpmsg_OVERLAY_CONFIG="C:/02_dataLogger/IOTDL/child_image/hci_rpmsg.conf;C:/ncs/v2.5.2/nrf/subsys/partition_manager/partition_manager_enabled.conf"
We can see the partition_manager was enabled and a multi-image build was used.

Now, I need to create two partitions on the external flash mx25r6435f for application data storage(sensor-monitored data), but failed.

1. Firstly I added the below code in the overlay, but I found the partitions were not created in \build\partitions.yml.

&qspi {
    mx25r64: mx25r6435f@0 {

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

            stats_partition: partition@0 {
                label = "log_stats_parti";
                reg = <0x00000000 0x00001000>; /* Start at 0, size 4KB */
            };
            log_partition: partition@1000 {
                label = "log_data_parti";
                reg = <0x00001000 0x001FF000>; /* Start at 4KB, size just under 2MB */
            };
        };
    };
};

2. In Partition Manager mentioned: "When you build a multi-image application using the Partition Manager, the devicetree source flash partitions are ignored.". I thought I needed to define a pm.yml file to create these partitions, but the link also mentioned "pm.yml is only used for child images. The root application does not need to define a pm.yml file, because its partition size and placement is implied by the size and placement of the child image partitions. If a root application defines a pm.yml file, it is silently ignored.". How can I create partitions for my root application on the external flash?

3. In External flash memory partitions mentioned: "To store partitions in the external flash memory, you can either choose a value for the nordic,pm-ext-flash property in the devicetree, or directly use an external flash DTS node label as DEVICE. "
When I added the below code in the overlay,

/ {
	chosen {
		nordic,pm-ext-flash = &mx25r64;
	};
};

I can see there is an 8M region created in \build\regions.yml,

external_flash:
  base_address: 0x0
  default_driver_kconfig: CONFIG_PM_EXTERNAL_FLASH_HAS_DRIVER
  device: DT_CHOSEN(nordic_pm_ext_flash)
  dynamic_partition: null
  name: external_flash
  placement_strategy: start_to_end
  size: 0x800000

and a partition was created in \build\partitions.yml:

external_flash:
  address: 0x0
  end_address: 0x800000
  region: external_flash
  size: 0x800000

How can I add my partitions to the external_flash region? And what does the "or directly use an external flash DTS node label as DEVICE." mean, if I do not choose a value for the nordic,pm-ext-flash property?

4. Someone said can add a pm_static.yml file in the root folder.
I created it as below:

log_stats_parti:
  address: 0x00000000
  region: external_flash
  size: 0x00001000
  placement:
    before: log_data_parti

log_data_parti:
  address: 0x00001000
  region: external_flash
  size: 0x001FF000
  placement:
    after: log_stats_parti

But it did not work, should I add something in CMakeLists.txt?

I read a lot of documentation, but really confused. Could you help me? Thank you very much.

Best regards,
Yanpeng Wu

Related