Issue with flash definitions on nCS v2.9.0

Hello,

I have dts files defined with flash partitions which build & work fine on nCS v2.6.0

But the moment i add same definitions to dts of nCS v2.9.0 it gives me redefinition error:

-- Found BOARD.dts: /opt/nordic/ncs/v2.9.0/zephyr/boards/nordic/nrf52840dk/nrf52840dk_nrf52840.dts
devicetree error: Label 'boot_partition' appears on /soc/flash-controller@4001e000/flash@0/partitions/partition@0 and on /soc/flash-controller@4001e000/flash@0/partitions/partition@f8000
CMake Error at /opt/nordic/ncs/v2.9.0/zephyr/cmake/modules/dts.cmake:295 (execute_process):
  execute_process failed command indexes:



If i try to define flash partitions in dts it says:

You are using Partition Manager to define the partitions. Devicetree definitions are ignored for this build.

If i define in pm_static file as :

nvs_storage:
  address: 0xD7000
  end_address: 0xf7000
  placement:
    align:
      start: 0x1000
    before:
    - device_info
  region: flash_primary
  size: 0x20000

& try to fetch it anyways in code as:

// #define NVS_PARTITION_OFFSET      PM_NVS_STORAGE_ADDRESS
// #define NVS_PARTITION_SIZE        PM_NVS_STORAGE_SIZE
// #define NVS_PARTITION_DEVICE      DEVICE_DT_GET(PM_NVS_STORAGE_DEV)

// #define NVS_PARTITION_OFFSET_TEMP PM_DEVICE_INFO_ADDRESS
// #define NVS_PARTITION_SIZE_TEMP   PM_DEVICE_INFO_SIZE
// #define NVS_PARTITION_DEVICE_TEMP DEVICE_DT_GET(PM_DEVICE_INFO_DEV)

#define NVS_PARTITION_OFFSET PM_NVS_STORAGE_ADDRESS
#define NVS_PARTITION_SIZE   PM_NVS_STORAGE_SIZE
#define NVS_PARTITION_DEVICE DEVICE_DT_GET(DT_NODELABEL(flash0))

#define NVS_PARTITION_OFFSET_TEMP PM_DEVICE_INFO_ADDRESS
#define NVS_PARTITION_SIZE_TEMP   PM_DEVICE_INFO_SIZE
#define NVS_PARTITION_DEVICE_TEMP DEVICE_DT_GET(DT_NODELABEL(flash0))

	fs_temp.flash_device = NVS_PARTITION_DEVICE_TEMP;
	if (!device_is_ready(fs_temp.flash_device)) {
		printk("Flash device %s is not ready\n", fs.flash_device->name);
		return;
	}
	fs_temp.offset = NVS_PARTITION_OFFSET_TEMP;


I get errors as :
error: 'PM_NVS_STORAGE_ADDRESS' undeclared (first use in this function); did you mean 'PM_SETTINGS_STORAGE_ADDRESS'?
   28 | #define NVS_PARTITION_OFFSET PM_NVS_STORAGE_ADDRESS
   
error: 'PM_NVS_STORAGE_SIZE' undeclared (first use in this function); did you mean 'PM_SETTINGS_STORAGE_SIZE'?
   29 | #define NVS_PARTITION_SIZE   PM_NVS_STORAGE_SIZE
   
error: 'PM_DEVICE_INFO_ADDRESS' undeclared (first use in this function)
   32 | #define NVS_PARTITION_OFFSET_TEMP PM_DEVICE_INFO_ADDRESS
      |                                   ^~~~~~~~~~~~~~~~~~~~~~   

  • Hi, 

    Did you use partition manager in NCS v2.6.0 in combination with dts partitioning? If so, you still need to use both in v2.9.0 as well.

    There might also be some migrating that needs to be done w.r.t configs and naming, but you should be able to see this here https://docs.nordicsemi.com/bundle/ncs-latest/page/nrf/releases_and_maturity.html 

    Are the node-properties you're trying to set up present in the dts? Could you share the dts and/or overlay where you set up the NVS device and/or other flash devices?

    Kind regards,
    Andreas

  • Hello  ,

    Did you use partition manager in NCS v2.6.0 in combination with dts partitioning? If so, you still need to use both in v2.9.0 as well.

    Yes i did.

    Are the node-properties you're trying to set up present in the dts?

    No, because if i enable partitioning in both dts & pm_static, it throws redundant declarations error during compilation as below:

    -- Found BOARD.dts: /opt/nordic/ncs/v2.9.0/zephyr/boards/nordic/nrf52840dk/nrf52840dk_nrf52840.dts
    devicetree error: Label 'boot_partition' appears on /soc/flash-controller@4001e000/flash@0/partitions/partition@0 and on /soc/flash-controller@4001e000/flash@0/partitions/partition@f8000
    CMake Error at /opt/nordic/ncs/v2.9.0/zephyr/cmake/modules/dts.cmake:295 (execute_process):
      execute_process failed command indexes:
    
        1: "Child return code: 1"

    Could you share the dts and/or overlay where you set up the NVS device and/or other flash devices?

    Yes , as in below:
    nrf52840dk_nrf52840.dts:

    &flash0 {
    
    	partitions {
            compatible = "fixed-partitions";
            #address-cells = <1>;
            #size-cells = <1>;
            boot_partition: partition@f8000 {
                label = "mcuboot";
                reg = <0x000f8000 0x006000>;
            };
            slot0_partition: partition@1200 {
                label = "image-0";
                reg = <0x00001200 0x0007ae00>;
            };
            slot1_partition: partition@7c000 {
                label = "image-1";
                reg = <0x0007c000 0x00078000>;
            };
            scratch_partition: partition@f7000 {
                label = "image-scratch";
                reg = <0x000f7000 0x00001000>;
            };
            /*
             * 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@f4000 {
                label = "storage";
                reg = <0x000f4000 0x00003000>;
            };
        };
    };

    pm_static_nrf52840dk_nrf52840.yml:

    app:
      address: 0x1200
      end_address: 0x7B000
      region: flash_primary
      size: 0x7AE00
    mcuboot:
      address: 0xF8000
      end_address: 0xFE000
      placement:
        after:
        - mcuboot_secondary
      region: flash_primary
      size: 0x6000
    mcuboot_pad:
      address: 0x1000
      end_address: 0x1200
      placement:
        before:
        - mcuboot_primary_app
      region: flash_primary
      size: 0x200
    mcuboot_primary:
      address: 0x1000
      end_address: 0x7C000
      orig_span: &id001
      - app
      - mcuboot_pad
      region: flash_primary
      sharers: 0x1
      size: 0x7B000
      span: *id001
    mcuboot_primary_app:
      address: 0x1200
      end_address: 0x7C000
      orig_span: &id002
      - app
      region: flash_primary
      size: 0x7AE00
      span: *id002
    mcuboot_secondary:
      address: 0x7C000
      end_address: 0xF8000
      placement:
        after:
        - mcuboot_primary
        align:
          start: 0x1000
      region: flash_primary
      share_size:
      - mcuboot_primary
      size: 0x7B000
    nvs_storage:
      address: 0xD7000
      end_address: 0xf7000
      placement:
        align:
          start: 0x1000
        before:
        - device_info
      region: flash_primary
      size: 0x20000
    device_info:
      address: 0xf5000
      end_address: 0xf7000
      placement:
        align:
          start: 0x1000
        before:
        - unused_page
      region: flash_primary
      size: 0x2000  
    unused_page:
      address: 0xf7000
      placement:
        after:
        - device_info
      size: 0x1000
    nrf5_mbr:
      address: 0x0
      end_address: 0x1000
      placement:
        after:
        - start
      region: flash_primary
      size: 0x1000
    settings_storage:
      address: 0xfe000
      end_address: 0x100000
      placement:
        align:
          start: 0x1000
        before:
        - end
      region: flash_primary
      size: 0x2000
    sram_primary:
      address: 0x20000000
      end_address: 0x20040000
      region: sram_primary
      size: 0x40000

  • Also,

    There might also be some migrating that needs to be done w.r.t configs and naming, but you should be able to see this here https://docs.nordicsemi.com/bundle/ncs-latest/page/nrf/releases_and_maturity.html 

    https://docs.nordicsemi.com/bundle/ncs-latest/page/nrf/releases_and_maturity/migration/migration_guide_2.9.html , This shows nothing as Required Change, and i see no impact of required changes for flash partition definition v2.6.0 onwards:
    docs.nordicsemi.com/.../migration_guide_2.7.html

  • I couldn't find any samples in nCS v2.9.0 demonstrating a partition creation in pm_static.yml and usage of that partition in code.
    I tried to create one, even that fails to build as attached.

    PM_Stat_Sample.zip

Related