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.So what is happening to the existing filesytem when flashing new uf2 file?
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.
It's usually calculated on how large MicroPython is, how much larger it may become, and how much Flash there is.#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?
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
- MicroPython executable : 330 KB
- Reserved for MicroPython executable growth : 310 KB
- File system : 1,408 KB
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