zephyr,mapped-partition

Description

Memory-mapped partition of a flash (or other non-volatile storage) memory.

The `zephyr,mapped-partition` node should be (descendant) children of the NVM memory node, either
directly or through intermediatory grouping child nodes or through parent
`zephyr,mapped-partition` nodes. Note that the NVM memory node and NVM controller nodes must have
`ranges` properties to indicate that they are all part of the SoC's address space which specify
the full range of the NVM area (usually the same as the `reg` property with a 0x0 prepended
before the offset value). Nested `zephyr,mapped-partition` nodes are supported, and should have
`ranges` properties set to indicate their range to their child nodes.

Examples

/*
 * The NVM controller node defines the ranges which map the NVM memory nodes to the CPU address
 * space.
 */
flash_controller: flash-controller@4001e000 {
        compatible = "vnd,flash-controller"
        reg = <0x4001e000 0x1000>
        ranges;
        #address-cells = <1>;
        #size-cells = <1>;

        /*
         * An NVM memory node describes a consecutive block of non volatile physical memory.
         * Partitions are added to the this node, adhering to physical limitations like
         * write-block-size. An empty `ranges;` property is required to ensure any partition
         * added to the NVM memory is mapped correctly to the CPU address space, and a
         * nodelabel should be defined make it easier for applications to add add partitions
         * to the NVM memory node.
         */
        flash0: flash@0 {
                compatible = "soc-nv-flash"
                reg = <0x0 DT_SIZE_K(1024)>;
                ranges = <0x0 0x0 DT_SIZE_K(1024)>
                #address-cells = <1>;
                #size-cells = <1>;

                /*
                 * The 'partitions' grouping is optional, it allows for clearing all partitions
                 * in a device (e.g. using a dtc overlay file) but is not required. If used,
                 * then it needs a `ranges;` property and to specify the #address-cells and
                 * #size-cells properties
                 */
                partitions {
                        ranges;
                        #address-cells = <1>;
                        #size-cells = <1>;

                        /*
                         * Offsets are relative to the flash0 node, if flash0 had an address of
                         * 0x10000000 then the below offset of 0x0 means address 0x10000000
                         */
                        boot_partition: partition@0 {
                                compatible = "zephyr,mapped-partition";
                                label = "mcuboot";
                                reg = <0x0 0xc000>;
                        };

                        slot0_partition: partition@c000 {
                                compatible = "zephyr,mapped-partition";
                                label = "image-0";
                                reg = <0xc000 0x76000>;
                        };

                        slot1_partition: partition@82000 {
                                compatible = "zephyr,mapped-partition";
                                label = "image-1";
                                reg = <0x82000 0x76000>;
                        };

                        /*
                         * Below example disables an NVM partition, if using the flash map
                         * subsystem with the default mappings then the below partition will
                         * not be present in the flash map
                         */
                        storage_partition: partition@f8000 {
                                compatible = "zephyr,mapped-partition";
                                label = "storage";
                                reg = <0xf8000 0x8000>;
                                status = "disabled";
                         };
                };
        };

        flash1: flash@10000000 {
                compatible = "soc-nv-flash"
                reg = <0x10000000 DT_SIZE_K(256)>;
                ranges = <0x0 0x10000000 DT_SIZE_K(256)>;
                #address-cells = <1>;
                #size-cells = <1>;

                /*
                 * Below demonstrates usage without partitions {}; grouping, and demos
                 * partitions inside of a parent partition
                 */
                external_partition: partition@0 {
                        compatible = "zephyr,mapped-partition";
                        reg = <0x0 0x10000>;
                        ranges = <0x0 0x0 0x10000>;
                        #address-cells = <1>;
                        #size-cells = <1>;

                        external_inner_a_partition: partition@0 {
                                compatible = "zephyr,mapped-partition";
                                reg = <0x0 0x6000>;
                        };

                        external_inner_b_partition: partition@6000 {
                                compatible = "zephyr,mapped-partition";
                                reg = <0x6000 0xa000>;
                        };
                };
        };
};

Properties

Properties not inherited from the base binding file.

Name

Type

Details

read-only

boolean

Set this property if the partition is read-only