From 8221ed620c5c5db5f6e231c00c625369d72c1455 Mon Sep 17 00:00:00 2001 From: Andreas Wolf Date: Sat, 29 Mar 2025 11:51:30 -0400 Subject: [PATCH] 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 --- .../raspberrypi/rpi_pico/rpi_pico-common.dtsi | 17 ++++++++++++++--- samples/subsys/usb/mass/boards/rpi_pico.overlay | 1 + 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/boards/raspberrypi/rpi_pico/rpi_pico-common.dtsi b/boards/raspberrypi/rpi_pico/rpi_pico-common.dtsi index 811dafcdf773..8fb86906111e 100644 --- a/boards/raspberrypi/rpi_pico/rpi_pico-common.dtsi +++ b/boards/raspberrypi/rpi_pico/rpi_pico-common.dtsi @@ -78,14 +78,25 @@ }; /* - * Usable flash. Starts at 0x100, after the bootloader. The partition - * size is 2MB minus the 0x100 bytes taken by the bootloader. + * Usable flash. Starts at 0x100, after the bootloader. The code partition + * size is flash size minus the 0x100 bytes taken by the bootloader, and + * minus the size of the storage partition. */ code_partition: partition@100 { label = "code-partition"; - reg = <0x100 (DT_SIZE_M(2) - 0x100)>; + reg = <0x100 (DT_SIZE_M(2) - 0x100 - DT_SIZE_K(16))>; read-only; }; + + /* + * Area for placing a file system for persistent storage. Starts at the end + * of the code partition. The persistent storage size is chosen to have the + * capacity for a minimal 'littlefs' file system with 4 blocks. + */ + storage_partition: partition@1fc000 { + label = "storage-partition"; + reg = <0x1fc000 DT_SIZE_K(16)>; + }; }; }; diff --git a/samples/subsys/usb/mass/boards/rpi_pico.overlay b/samples/subsys/usb/mass/boards/rpi_pico.overlay index bdafdd3c2596..7e544238c163 100644 --- a/samples/subsys/usb/mass/boards/rpi_pico.overlay +++ b/samples/subsys/usb/mass/boards/rpi_pico.overlay @@ -5,6 +5,7 @@ */ /delete-node/ &code_partition; +/delete-node/ &storage_partition; &flash0 { partitions {