DTS snippets mainly targetting RP2040-based boards

Expanded flash variants

Aliexpress is flooded with cheap RPi Pico clones/variants with additional features like USB-C or expanded flash (4MB, 8MB & 16 MB vs the original 2 MB).

With this overlay for your 16 Mb board you endup with the following layout:

/ {
	chosen {
		zephyr,flash = &flash0;
		zephyr,code-partition = &code_partition;
	};
};



&flash0 {
    compatible = "soc-nv-flash";
    write-block-size = < 0x1 >;
    erase-block-size = < 0x1000 >;
    #address-cells = < 0x1 >;
    #size-cells = < 0x1 >;
    reg = <0x10000000 DT_SIZE_M(16)>;
    ranges = <0x0 0x10000000 DT_SIZE_M(16)>;

        partitions {
        compatible = "fixed-partitions";
        #address-cells = <1>;
        #size-cells = <1>;

            /* Reserved memory for the second stage bootloader */
            second_stage_bootloader: partition@0 {
                label = "second_stage_bootloader";
                reg = <0x00000000 0x100>;
                read-only;
            };

            /*
            * Usable flash. Starts at 0x100, after the bootloader. The partition
            * size is 8MB minus the 0x100 bytes taken by the bootloader.
            */
            code_partition: partition@100 {
                label = "code-partition";
                reg = <0x100 (DT_SIZE_M(8) - 0x100)>;
                read-only;
            };

            /*
            * Flash usable for storing small scale data
            * The Partition starts at 8mb and is 8mb big
            */
            storage_partition: partition@800000 {
                label = "save-partition";
                reg = <DT_SIZE_M(8) DT_SIZE_M(8)>;
            };
        };
};