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
  • Hi,

     

    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.

    I can confirm your observation here. It will not pick up the partition, as it not defined in device tree and will throw a compiler error on this line:

    https://github.com/nrfconnect/sdk-zephyr/blob/v4.0.99-ncs1-branch/subsys/debug/coredump/coredump_backend_flash_partition.c#L44 

    Referencing a user-defined section in pm_static.yml is done like this (storage partition in this case):

    https://github.com/nrfconnect/sdk-zephyr/blob/v4.0.99-ncs1-branch/samples/subsys/settings/src/main.c#L20-L21

    which does not seem to fail in this case. The problem is not the partition itself, but the resolving up to the flash node.

     

    I believe that your solution here, ie. define in both pm_static.yml and in device tree:

    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 the only option unless you want to change the sources.

     

    Kind regards,

    Håkon

  • 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

Reply
  • 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

Children
No Data
Related