Repository navigation
rp2 builds: --keep-fs keeps a board's filesystem through a firmware update - #386
Merged
Merged
Conversation
…pdate autosize works an rp2 filesystem's size out again in each new build folder, from the image's size plus headroom, rounded to 64 KB. Two RPI_PICO images with the same modules, 1,398,144 and 1,460,520 bytes, come out with 576 KB and 512 KB filesystems, so flashing the newer one over the older moves the filesystem and the board comes up empty, although the newer image fits beside 576 KB with 46 KB to spare. --keep-fs SIZE builds beside the filesystem the board already has, and stops with the size that would fit instead of moving it when the image doesn't. autosize's message says how to read the size on a board. Checked on a Waveshare RP2040-Touch-LCD-1.28 with a 512 KB filesystem and 28 files: an RPI_PICO build with --keep-fs 512K linked first time with a 512 KB filesystem, and after flashing it, and then the earlier image again, every file hashed the same.
# Conflicts: # tests/test_build_mp.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
An rp2 build that doesn't fit beside the board's default filesystem is autosized: the firmware gets the image's size plus headroom, rounded up to 64 KB, and the filesystem gets the rest. That figure is worked out again in every new build folder, so a newer image only a little bigger can come out with a smaller filesystem than the one on your board, and flashing it leaves the board with an empty one. Two RPI_PICO builds with the same modules show it: images of 1,398,144 and 1,460,520 bytes get 576 KB and 512 KB filesystems, although the newer image fits beside 576 KB with 46 KB to spare.
--keep-fs SIZEbuilds beside the filesystem a board already has. If the image fits, the filesystem stays where it is. If it doesn't, the build stops and says what size would fit, instead of moving it. autosize's own message now says how to ask a board for its size (rp2.Flash().ioctl(4, 0) * ioctl(5, 0)), and the guide to fitting firmware on a small flash has a section on keeping a board's files.Checked with RPI_PICO builds of
displayif,lvgl,pydevices.--keep-fs 512Klinked on the first try beside 512 KB.--keep-fs 576Klinked on the first try beside 576 KB, where a fresh build without it autosizes to 512 KB.--keep-fs 640Kstopped, saying 512 KB would fit. On a Waveshare RP2040-Touch-LCD-1.28 with a 512 KB filesystem holding 28 files, flashing the 512K image, and then the board's previous image again, left every file with the same hash. New unit tests cover the size parsing and the two autosized sizes above.MicropythonLibPatches.test_applies_oncefails here with and without this change, because the local micropython-lib checkout lacks the file it looks for.Not checked: CI, and esp32, whose app partition autosize has the same habit and isn't changed here.