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
      |                                   ^~~~~~~~~~~~~~~~~~~~~~   

Parents Reply Children
  •  ,

    I observed. that nCS v2.9.0 has no flash0 bindings in any of its dts definitions.
    Hence cannot access flash device as 

    DEVICE_DT_GET(DT_NODELABEL(flash0))

    Now i need to understand how to define & access it from pm_static.yml
    My sample pm_static.yml looks like:

    app:
      address: 0x0
      size: 0xD7000
      region: flash_primary
    
    nvs_storage:
      address: 0xD7000
      size: 0x20000
      region: flash_primary
    
    dummy_partition:
      address: 0xF7000
      size: 0x7000
      region: flash_primary
    
    settings_storage:
      address: 0xFE000
      size: 0x2000
      region: flash_primary

    Now if i get to access any dummy partition say:

    #define PARTITION_DEVICE_DUMMY DEVICE_DT_GET(DT_CHOSEN(zephyr_flash_controller))
    // OR
    #define PARTITION_DEVICE_DUMMY DEVICE_DT_GET(DT_NODELABEL(flash0))
    
    const struct device *dev = PARTITION_DEVICE_DUMMY;
    
    printk("Dummy Partition Device: %s\n", dev->name);
    
    I get the same error as :
    undefined reference to `__device_dts_ord_125'

    How to access a partition & flash0 from pm_static.yml into code.?

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

    Noted

    Mohammed Ubaid said:
    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.

    The Matter samples (for instance light bulb) uses pm static

    Mohammed Ubaid said:
    So far was able to work around most issues, now just stuck with the final one which is getting flash0 label:

    Great!

    Mohammed Ubaid said:
    Have attached the sample project as in below, kindly help me resolve the same:

    Which board have you used here? I only see an overlay for the 54L15DK within the boards folder. Are you using the 52840 here as well as in your tags or is this sample for the 54L15DK?

    Mohammed Ubaid said:
    that nCS v2.9.0 has no flash0 bindings in any of its dts definitions.

    flash0 is mentioned in for instance zephyr\dts\arm\nordic in nrf52840.dtsi, but it its not present within the board files. How have you set the flash0 device in your board files?

    Kind regards,
    Andreas

  • Which board have you used here? I only see an overlay for the 54L15DK within the boards folder. Are you using the 52840 here as well as in your tags or is this sample for the 54L15DK?

    I am using a nrf5340dk  .

    Could you please help me define and fetch "flash0" & "dummy_partition" defined in pm_static.yml file to this sample project. 

    8130.PM_Stat_Sample.zip

    flash0 is mentioned in for instance zephyr\dts\arm\nordic in nrf52840.dtsi, but it its not present within the board files. How have you set the flash0 device in your board files?

    No I havent, in earlier sdks it was in nrf5340dk_nrf5340.dts, but now i couldn't find it in nCS v2.9.0.

    This is where I am stuck at, just need your help to understand:

    1. How to define flash0 partitions in overlay / pm_static.yml and read in code.?
    2. How to get "dummy_partition" from pm_static.yml in my sample project into c code as device.?

    Thanks, 

  • Thank you for clarifying it all. I now understand your issue. I will have to look through some samples (which you also can do while waiting), such as for instance the NVS sample. I will get back to you regarding that.

    Mohammed Ubaid said:
    I am using a nrf5340dk AHaug .

    Could you verify that you're getting the first error you described also with the nRF5340DK? 

    Kind regards,
    Andreas

Related