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

General • Re: Pico 2MB flash - uf2 and internal filesystem

$
0
0
So what is happening to the existing filesytem when flashing new uf2 file?
A MicroPython '.uf2' will only overwrite itself, will not touch the file system at all, except when it's so large that it impinges on what file system there was.

The problem can be that various MicroPython builds expect file systems of different sizes. Load a smaller MicroPython and what was in the file system can become a hidden part of the file system that build uses. Install a MicroPython build which expects a file system as the size it was and those hidden files can reappear.

Because the file system isn't initialised when created, just its bounds are set and a header block, all sorts of weird and wonderful things can happen if MicroPython expecting different file system sizes are loaded. My recommendation is to always nuke Flash before loading MicroPython which expects a different file system size than what there is. If you don't then things may appear to be working but then odd things can happen, files disappearing or becoming corrupt.
#define MICROPY_HW_FLASH_STORAGE_BYTES (848 * 1024)

But is this an exact value based on MicroPython size or is this just an approximation and could be declared more or less?
It's usually calculated on how large MicroPython is, how much larger it may become, and how much Flash there is.

For the Pico W with 2MB Flash memory is allocated as approximately -
  • MicroPython executable : 850 KB
  • Reserved for MicroPython executable growth : 350 KB
  • File system : 848 KB
For the Pico with 2MB Flash memory is allocated as approximately -
  • MicroPython executable : 330 KB
  • Reserved for MicroPython executable growth : 310 KB
  • File system : 1,408 KB
You can safely make the file system smaller. You can often make it larger but that reduces the amount MicroPython can grow by without it then impinging on what exists if it does grow.

I would have thought MicroPython for the Pico W growing by 40%, for the Pico doubling in size, would be unlikely, but that's what MicroPython have decided to reserve.

Statistics: Posted by hippy — Thu Dec 05, 2024 10:21 am



Viewing all articles
Browse latest Browse all 8374

Trending Articles