Skip to content

build_memory_info: take the region size from the linker map - #1

Open
lynt-smitka wants to merge 2 commits into
mainfrom
map-size.x
Open

lynt-smitka wants to merge 2 commits into
mainfrom
map-size.x

Conversation

@lynt-smitka

Copy link
Copy Markdown

Test run only, not for upstream in this shape.

Seven ports never write firmware.size.json, so every pull request builds all 17
languages for every board of those ports. The linker map has the region sizes with
the symbols already resolved, which is what the linker script route cannot give on
raspberrypi, and it exists on the ports whose linker script lives in a submodule or
an SDK.

The push run (34059253091) showed the producer works: raspberrypi 976828/1044480,
zephyr-cp 502136/1040128, mimxrt10xx 620920/2048000, renode 218316/524288, silabs
670988/1564672. cxd56 and broadcom have no flash region at all (ram and RAM, READONLY) — they link into RAM and boot from SD — so the step comes back out of
those two.

This PR exists to exercise the other half: the language skip only runs when
GITHUB_EVENT_NAME is pull_request.

Seven ports never write firmware.size.json, so build_release_files.py cannot
tell whether the en_US build left room and builds all 17 languages for every
board of those ports on every pull request.

They cannot use this script as it stands: it reads the region size out of a
linker script, which needs the size to be a literal there. raspberrypi writes
LENGTH = firmware_size, a symbol the board can override; broadcom, cxd56 and
silabs link a script from a submodule or an SDK; zephyr-cp has no script of its
own at all.

The linker map has the same numbers with the symbols already resolved, and
every one of these ports either writes a map already or is one flag away from
it. So read the Memory Configuration table when the file has one, and keep the
linker script path for the ports that pass one. The region name is FLASH_FIRMWARE
or FLASH, or --region for anything else.

Wired into raspberrypi, renode, mimxrt10xx, broadcom, cxd56 and silabs, which
only needed -Wl,-Map added. A missing map or an unknown region name prints what
was found and writes nothing, so the language skip falls back to today's
behaviour instead of failing the build.

zephyr-cp still needs doing; its Makefile has none of the toolchain variables.
Its makefile has none of the toolchain variables the other ports get from
circuitpy_mkenv.mk, so there is no size(1) to pipe in. There does not need to
be: what the image occupies in flash is the size of the binary, which is how
ports/espressif has always measured it. Pass --image and the region still comes
from the map.

Measured on rpi_pico: 502256 bytes used of a 1040128 byte region, against the
502000 and 1040128 Zephyr prints itself -- the difference is the 256 byte
second stage, which the .bin includes and the FLASH region does not.
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

Successfully merging this pull request may close these issues.

1 participant