Skip to content

feat(nrf52): virtual filesystem mount points + XModem path routing#10141

Draft
benallfree wants to merge 6 commits intomeshtastic:developfrom
MeshEnvy:feat/xmodem-external-flash
Draft

feat(nrf52): virtual filesystem mount points + XModem path routing#10141
benallfree wants to merge 6 commits intomeshtastic:developfrom
MeshEnvy:feat/xmodem-external-flash

Conversation

@benallfree
Copy link
Copy Markdown

@benallfree benallfree commented Apr 12, 2026

This PR stacks on #10139 by introducing the beginnings of a virtual filesystem. I show how to use it via the XModem module, where I happen to need the feature. This allows callers to address storage by mount point rather than by direct FS reference.

Co-author: @GoatsAndMonkeys

Prerequisites

Motivation

Meshtastic currently has one filesystem (FSCom) mapped to internal flash. With external flash now optionally mountable from #10139, it would help if there were a way to address it from a single API.

I'm thinking about these:

Prefix Destination
/__int__/foo Internal flash (InternalFS / LittleFS)
/__ext__/foo External flash (extFS if mounted, else internal)
/__sd__/foo SD card (reserved for future use, falls back to internal)
/foo Internal flash — bare paths pass through unchanged

The double-underscore delimiters minimize collision risk with real file paths.

New public API:

FSRoute fsRoute(const char *path);     // resolve path → {FsMount, realPath}
File    fsOpenRead (const FSRoute &r);
File    fsOpenWrite(const FSRoute &r);
bool    fsRemove   (const FSRoute &r);
bool    fsMkdir    (const FSRoute &r);
bool    fsExists   (const FSRoute &r);

On platforms without external flash (ESP32, RP2040, STM32WL), all mount variants resolve to FSCom with the prefix stripped — identical behavior to today, zero breaking changes.

🤝 Attestations

  • I have tested that my proposed changes behave as described.
  • I have tested that my proposed changes do not cause any obvious regressions on the following devices:
    • Heltec (Lora32) V3
    • LilyGo T-Deck
    • LilyGo T-Beam
    • RAK WisBlock 4631
    • Seeed Studio T-1000E tracker card
    • Other (please specify below)

@github-actions github-actions bot added needs-review Needs human review enhancement New feature or request labels Apr 12, 2026
FILE_O_WRITE on nRF52 (Adafruit LittleFS) appends to existing files
rather than truncating. Remove the file before opening for write so
repeated XModem uploads always produce the correct file size.

Made-with: Cursor
@benallfree benallfree mentioned this pull request Apr 13, 2026
9 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request needs-review Needs human review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant