pimoroni-pico icon indicating copy to clipboard operation
pimoroni-pico copied to clipboard

CI: Better build size debugging

Open Gadgetoid opened this issue 1 year ago • 2 comments

This is a little bit of a redux of the issue I raised here: https://github.com/micropython/micropython/issues/8680

And the PR here: https://github.com/micropython/micropython/pull/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 in memmap_mp.ld.

The general idea is to split FLASH into APP and FILESYSTEM 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 from mpconfigboard.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 be ACTUAL_FLASH_SIZE - MICROPY_HW_FLASH_STORAGE_BYTES. Eg: For Pico this is 2048 (2MB) - 1408 (1.4MB) = 640k.

Gadgetoid avatar Apr 08 '24 16:04 Gadgetoid

Judging by the before and after of Tiny 2040 (8MB) the ulab module - as configured - weighs in at about 92k.

Gadgetoid avatar Apr 08 '24 16:04 Gadgetoid

Having a long, hard think about how much appetite I have to babysit Yet Another Patch 😆

Gadgetoid avatar Apr 11 '24 15:04 Gadgetoid