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.
This is a little bit of a redux of the issue I raised here: micropython/micropython#8680
And the PR here: micropython/micropython#8761
Neither of these have had any traction for a while, due to an impasse with the way flash sizes are declared with Pico's
bi_decl
being incompatible with how we might want to supply (or retrieve from) flash sizes inmemmap_mp.ld
.The general idea is to split
FLASH
intoAPP
andFILESYSTEM
so we have an early failure if the two happen to overlap.Without a linker error to catch this, a MicroPython build will generate a filesystem at runtime and overwrite itself in potentially catastrophic ways.
Making this tooling work requires adding an
memmap_mp.ld
to each board directory. Since this does not inherit the flash size frommpconfigboard.h
it removes the previous "single source of truth" for flash size and... this can easily catch you out.In all cases the linker variable
_flash_app_size
should beACTUAL_FLASH_SIZE - MICROPY_HW_FLASH_STORAGE_BYTES
. Eg: For Pico this is2048 (2MB) - 1408 (1.4MB) = 640k
.