Skip to content

Commit c79397f

Browse files
committed
boards : rpi_pico : Add persistent partition for Pico and Pico_w
Add a 16 KB 'storage' partition at the end of the Pico flash. That size is sufficient to hold the two test files created by the 'littlefs' sample. The sample 'subsys/USB/mass' uses an overlay to add the same partition and it was changed to delete the one defined by this DTSI file before doing that. Signed-off-by: Andreas Wolf <awolf002@gmail.com>
1 parent 6857dca commit c79397f

File tree

2 files changed

+19
-4
lines changed

2 files changed

+19
-4
lines changed

boards/raspberrypi/rpi_pico/rpi_pico-common.dtsi

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,11 @@
6262
};
6363
};
6464

65+
#define FLASH_SIZE DT_SIZE_M(2)
66+
#define STORAGE_PARTITION_SIZE DT_SIZE_K(16)
67+
6568
&flash0 {
66-
reg = <0x10000000 DT_SIZE_M(2)>;
69+
reg = <0x10000000 FLASH_SIZE>;
6770

6871
partitions {
6972
compatible = "fixed-partitions";
@@ -78,14 +81,25 @@
7881
};
7982

8083
/*
81-
* Usable flash. Starts at 0x100, after the bootloader. The partition
82-
* size is 2MB minus the 0x100 bytes taken by the bootloader.
84+
* Usable flash. Starts at 0x100, after the bootloader. The code partition
85+
* size is flash size minus the 0x100 bytes taken by the bootloader, and
86+
* minus the size of the storage partition.
8387
*/
8488
code_partition: partition@100 {
8589
label = "code-partition";
86-
reg = <0x100 (DT_SIZE_M(2) - 0x100)>;
90+
reg = <0x100 (FLASH_SIZE - 0x100 - STORAGE_PARTITION_SIZE)>;
8791
read-only;
8892
};
93+
94+
/*
95+
* Area for placing a file system for persistent storage. Starts at the end
96+
* of the code partition. The persistent storage size is chosen to have the
97+
* capacity for a minimal 'littlefs' file system with 4 blocks.
98+
*/
99+
storage_partition: partition@1fc000 {
100+
label = "storage-partition";
101+
reg = <0x1fc000 STORAGE_PARTITION_SIZE>;
102+
};
89103
};
90104
};
91105

samples/subsys/usb/mass/boards/rpi_pico.overlay

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
*/
66

77
/delete-node/ &code_partition;
8+
/delete-node/ &storage_partition;
89

910
&flash0 {
1011
partitions {

0 commit comments

Comments
 (0)