Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 8609

General • How to use pico-littlefs on a secondary data partition with an A/B firmware setup on RP2350?

$
0
0
I'm trying to set up my RP2350 with 3 partitions on the flash: an A and B partition for firmware and a third partition for Data. The Data partition should be accessible to either of the firmware images and should contain a LittleFS filesystem.

I've verified that the LittleFS system works great if I don't use partitions. I just put it at `blockdevice_flash_create(PICO_FLASH_SIZE_BYTES - PICO_FS_DEFAULT_SIZE, 0);` and everything is fine across firmware upgrades etc.

Also, I've verified that with my current partition json the device alternates nicely between the A and B partition when uploading with `picotool`.

The problem is my application hangs whenever it tries to read or write to the Data partition's flash space. It slows down tremendously, only producing a single character on the serial output once every few _minutes_.

What I've Found So Far:
1. I can get the physical offset of the "Data" partition at runtime using rom_get_partition_table_info(). The offset is 0x202002.
2. I understand that the standard XIP mapping at 0x10000000 is restricted by the bootrom to only map the booted partition.
3. I'm aware of the special XIP_NOCACHE_NOALLOC_NOTRANSLATE_BASE window at 0x1c000000 which should provide direct access to the entire flash.

What is the canonical way to initialize pico-littlefs on a data partition that is outside the booted A/B slot? Am I overlooking something trivial?

partitions.json

Code:

{  "version": [1, 0],  "unpartitioned": {    "families": ["absolute"],    "permissions": {      "secure": "rw",      "nonsecure": "rw",       "bootloader": "rw"    }  },  "partitions": [    {      "name": "Firmware A",      "id": 0,      "size": "1024K",      "families": ["rp2350-arm-s", "rp2350-riscv"],      "permissions": {        "secure": "rw",        "nonsecure": "rw",        "bootloader": "rw"      }    },    {      "name": "Firmware B",      "id": 1,      "size": "1024K",      "families": ["rp2350-arm-s", "rp2350-riscv"],      "permissions": {        "secure": "rw",        "nonsecure": "rw",        "bootloader": "rw"      },      "link": ["a", 0]    },    {      "name": "Data",      "id": 2,       "size": "4096K",      "families": ["data"],      "permissions": {        "secure": "rw",        "nonsecure": "rw",        "bootloader": "rw"      },      "ignored_during_arm_boot": true,      "ignored_during_riscv_boot": true    }  ]}
picotool partition info

Code:

  0(A)       00002000->00102000 S(rw) NSBOOT(rw) NS(rw), id=0000000000000000, "Firmware A", uf2 { 'rp2350-arm-s', 'rp2350-riscv' }, arm_boot 1, riscv_boot 1  1(B w/ 0)  00102000->00202000 S(rw) NSBOOT(rw) NS(rw), id=0000000000000001, "Firmware B", uf2 { 'rp2350-arm-s', 'rp2350-riscv' }, arm_boot 1, riscv_boot 1  2(A)       00202000->00602000 S(rw) NSBOOT(rw) NS(rw), id=0000000000000002, "Data", uf2 { 'data' }, arm_boot 0, riscv_boot 0 
Thanks in advance for any guidance

Statistics: Posted by DatoDavid — Mon Sep 01, 2025 11:45 am



Viewing all articles
Browse latest Browse all 8609

Trending Articles