How to Make Zephyr Coredump Module Recognize a Partition Manager Partition with Sysbuild in NCS 2.9.0?

I'm working with nRF5340 and nRF Connect SDK 2.9.0, using sysbuild and Partition Manager for my project. I want to enable Zephyr's coredump feature and store dumps in internal flash.
I understand that with sysbuild and Partition Manager enabled, flash partitions must be defined in pm_static.yml, as devicetree partition definitions are ignored for memory layout and partitioning purposes (Configuring static partitions). However, Zephyr's coredump module (and zephyr/debug/coredump.h) expects a partition to be defined in the devicetree with a specific label (e.g., coredump-partition) in order to find the flash device and offset (Zephyr coredump documentation).
This creates a problem:

  • If I define the coredump partition only in pm_static.yml, the coredump module cannot find it, since it looks for a devicetree node.
  • If I define it in both pm_static.yml and the devicetree, the devicetree definition is ignored for partitioning, and this can lead to confusion or build errors (DevZone discussion).

Is there a supported way to make Zephyr's coredump module recognize a coredump partition defined via Partition Manager when using sysbuild in NCS 2.9.0?
Or is there a recommended workaround for this integration gap, so that coredump data can be stored in a flash partition managed by Partition Manager, and the coredump module can find and use it?
Any guidance or examples would be greatly appreciated!

Parents Reply Children
  • Hi,

    I am also attempting to implement the coredump feature and store dumps in internal flash. I am defining the partition in pm_static.yml and in the device tree, however when I try writing a dump to the partition I get a Secure Fault (Attribute unit violation).



    I understand that this is related to accessing memory that one is not authorized to access, but this should all have been setup properly using the config settings I would suspect.
    I am unsure how to resolve this and any help/hints would be much appreciated.

    Definition in board file:

    &flash0 {
    	partitions {
    		compatible = "fixed-partitions";
    		#address-cells = <1>;
    		#size-cells = <1>;
    
    		boot_partition: partition@0 {
    			label = "mcuboot";
    			reg = <0x0000 DT_SIZE_K(64)>;
    		};
    
    		coredump_partition: partition@f5000 {
    			label = "coredump-partition";
    			reg = <0xf5000 DT_SIZE_K(8)>;
    		};
    	};
    };


    Definition in pm_static:
    (you might notice the storage_partition which we operate using NVS and config_factory which isn't used as of yet)

    mcuboot:
      address: 0x00000
      end_address: 0x10000
      region: flash_primary
      size: 0x10000
    app:
      address: 0x0016000
      end_address: 0x00f5000
      region: flash_primary
      size: 0xdf000
    coredump_partition:
      address: 0x00f5000
      end_address: 0x00f7000
      region: flash_primary
      size: 0x2000
    config_factory:
      address: 0x00f7000
      end_address: 0xf8000
      region: flash_primary
      size: 0x00001000
    storage_partition:
      address: 0x000f8000
      end_address: 0x100000
      region: flash_primary
      size: 0x00008000
    
    mcuboot_secondary:
      address: 0x00000000
      end_address: 0xdf000
      device: DT_CHOSEN(nordic_pm_ext_flash)
      region: external_flash
      size: 0xdf000
    config_primary:
      address: 0xdf000
      end_address: 0xe0000
      device: DT_CHOSEN(nordic_pm_ext_flash)
      region: external_flash
      size: 0x01000
    config_secondary:
      address: 0xe0000
      end_address: 0xe1000
      device: DT_CHOSEN(nordic_pm_ext_flash)
      region: external_flash
      size: 0x01000
    temp_partition:
      address: 0xe1000
      end_address: 0xe5000
      device: DT_CHOSEN(nordic_pm_ext_flash)
      region: external_flash
      size: 0x4000

  • Hi,

     

    My apologies for the long wait. I have been out of office.

    I believe you can have two potential issues:

    1. You will need to ensure that CONFIG_MPU_ALLOW_FLASH_WRITE=y is chosen.

    2. It seems that you have a non-secure/secure build, which requires certain permissions on the storage on the non-secure part. More specifically to wrap the custom partitions within "nonsecure_storage", as done in this specific thread:

     Debug external_flash and nonsecure_storage partitions in pm_static.yml (external SPI flash) 

     

    Kind regards,

    Håkon

Related