Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reduce filesystem overhead of UF2 #98

Open
ace-dent opened this issue Aug 16, 2023 · 1 comment
Open

Reduce filesystem overhead of UF2 #98

ace-dent opened this issue Aug 16, 2023 · 1 comment

Comments

@ace-dent
Copy link
Contributor

ace-dent commented Aug 16, 2023

From #73 (comment)

Investigate how bundling an FS with picotool might be optimized, to reduce the overall size of the UF2 for flashing.


Current process noted here:

  1. Load a Thumby with everything that is needed for shipping (MicroPython, games, libs, etc.).
  2. Use picotool (https://github.com/raspberrypi/picotool) to clone a UF2 from the Thumby. I use Linux and this command: sudo ./picotool save -r 0x10000000 0x10200000 ThumbyFirmware.uf2.

This specifies an address range of 2,097,152 bytes / 2048 KiB / 2 MiB.
Using picotool info -a will give the actual end address - so it may be possible to avoid copying empty 256 byte blocks?... but this may be required to keep the filesystem intact?


See also documentation on the format: https://github.com/microsoft/uf2

@ace-dent
Copy link
Contributor Author

Note the deliberate low efficiency of the UF2 format:

  • One UF2 block is fixed as 512 bytes (36 bytes overhead, up to 476 bytes of data).
  • Flash chips normally have a minimum page size of ~ 256 bytes (4 x 64 bytes).
  • It is expected that only one 256B flash page will fit per 512B block- with the remaining space padded (zero filled).
  • With this default setup, each block is ~57% data / ~43% blank.

It may be possible to configure the RP2040 / flash storage to use a different page size for improved packing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant