oxidecomputer / phbl

Pico Host Boot Loader
Mozilla Public License 2.0
98 stars 7 forks source link

linker: omit BSS from loadable segments #45

Closed dancrossnyc closed 6 months ago

dancrossnyc commented 6 months ago

It turns out that, when written into a ROM image, the BSS was expanded into actual zeroed bytes copied that were into flash (the BIOS loader on the PSP doesn't do any interpretation of the payload; it just copies bytes, so it kind of has to do this). This took up unnecessary space in flash.

But we already zero the BSS and map it explicitly, so just relocate it before the text segment and mark it NOLOAD in the linker script (and make some trivial corresponding adjustments in the mapping code). Et voila, we save a few megabytes of flash.

dancrossnyc commented 6 months ago

Tested on c71.