Skip to content

RP2350 Partition Support #65

@DavidMenting

Description

@DavidMenting

Feature Request: RP2350 partition support with XIP_NOCACHE_NOALLOC_NOTRANSLATE_BASE for cross-partition access

Problem Description

The current flash block device implementation uses XIP_BASE (0x10000000) for reads, which works perfectly for RP2040 and single-partition RP2350 setups. However, on RP2350 with partitioned flash, the bootrom restricts XIP_BASE to only map the currently booted partition. This prevents applications from accessing data stored in other partitions.

Technical Background

On RP2350, when using A/B firmware partitions with a separate data partition:

  • Partition 0: Firmware A (0x002000-0x102000)
  • Partition 1: Firmware B (0x102000-0x202000)
  • Partition 2: Data (0x202000-0x602000)

The bootrom configures XIP_BASE to only map the active firmware partition. Attempting to read from the Data partition via XIP_BASE + data_partition_offset results in bus faults and system hangs.

Proposed Solution

Add support for XIP_NOCACHE_NOALLOC_NOTRANSLATE_BASE (0x1c000000) as an alternative read method for accessing the entire flash, regardless of partition restrictions.

Implementation Approach

  1. Detection Logic: Add runtime detection for RP2350 and partitioned flash
  2. Address Selection: Use XIP_NOCACHE_NOALLOC_NOTRANSLATE_BASE when accessing flash outside the booted partition
  3. Backward Compatibility: Maintain existing behavior for RP2040 and non-partitioned RP2350

Use Cases

  • Cross-partition file systems (e.g., LittleFS on dedicated data partition)
  • Configuration storage in separate partition from firmware
  • A/B firmware updates with persistent data storage
  • Multi-partition applications requiring access to shared data

Alternative Workaround

We successfully implemented a custom block device that uses XIP_NOCACHE_NOALLOC_NOTRANSLATE_BASE for reads while maintaining compatibility with the existing pico-vfs API. This could serve as reference implementation for the upstream fix.

References

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions