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

Other RP2040 boards • Re: RP2350 internal filesystem accidentally erased by USB host?

$
0
0
@hippy @katak255 Many thanks to both of your for going above and beyond to help explain this.
No problem. Beyond the satisfaction of helping others, I enjoy thought experiments and solving mysteries when I can, having adventures I may not have otherwise undertaken, learning new things, and gaining a better understanding. I imagine katak255 is similarly inclined.

A thought on protection which arose while I was trying to figure out how one could diagnose the issue -

Assuming all writes to Flash go through 'rp2_flash_writeblocks' in 'rp2_flash.c' it would be possible to ignore all writes, report them for debugging or when looking for erroneous writes.

Modules would need to be frozen because you won't be able to upload them post-build. Though you could concoct a process of creating a UF2 with MicroPython and a pre-loaded file-system which was read-only.

Implementing proper handling of a read-only filesystem would require more extensive changes and MicroPython doesn't appear to support that itself. USB MSD can be read-only but that relies on telling the host it's read-only and ignoring what comes in over USB.

None of this will help catch writes which go behind MicroPython's back and write directly to Flash. You would need to hack Pico SDK to not erase nor program, report erroneous writes. The Pico SDK does not appear to support software enforced read-only Flash.

But, with everything frozen, as it seems you won't care if the file system then gets erased, freezing should be enough. Good luck with your venture.

Statistics: Posted by hippy — Sat Aug 30, 2025 4:13 pm



Viewing all articles
Browse latest Browse all 8041

Trending Articles