Skip to content

zephyr-cp: build ulab, and let boards opt out - #11245

Merged
tannewt merged 2 commits into
adafruit:mainfrom
mikeysklar:zephyr-cp/ulab-opt-in
Aug 26, 2026
Merged

zephyr-cp: build ulab, and let boards opt out#11245
tannewt merged 2 commits into
adafruit:mainfrom
mikeysklar:zephyr-cp/ulab-opt-in

Conversation

@mikeysklar

@mikeysklar mikeysklar commented Aug 25, 2026

Copy link
Copy Markdown
Collaborator

What

Builds ulab on zephyr-cp and adds CIRCUITPY_ULAB so boards that cannot spare the flash can turn it off. On by default; two boards opt out.

Why

zephyr-cp builds without py/circuitpy_mpconfig.mk, so the ulab wiring every other port gets from py/py.mk does not exist here and ulab could not be built at all. This adds the flags and sources the same way py.mk does.

It costs roughly 90 KB, so the two boards without room set CIRCUITPY_ULAB = false in their circuitpython.toml:

  • nordic_nrf7002dk is at 99.73% of flash, under 3 KB free.
  • st_nucleo_n657x0_q has no internal user flash and executes from RAM, which is already 93% full. CI caught this one; ulab overflowed it by 56520 bytes.

Every other board has at least 135 KB of headroom in whichever region holds code.

Hardware tested

Build only, which is the whole surface of this change. On silabs_siwx917_dk2605a:

build flash
main 799136 B, 76.21%
this PR, ulab off 799136 B, byte-identical to baseline
this PR, ulab on 890168 B, 84.89%, +91032 B, 163 ulab sources

Both opt-out boards were built locally to confirm they link, and the full CI matrix is green.

Not tested: importing ulab on hardware.

Scope

Build plumbing and two board opt-outs. No docs change.

AI assistance

Written with Claude Code. I ran the builds and compared the figures myself.

@tannewt tannewt left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please do include some changes in the circuitpython.tomls to show how it looks.

Comment thread ports/zephyr-cp/cptools/build_circuitpython.py Outdated
zephyr-cp builds without py/circuitpy_mpconfig.mk, so the ulab wiring every
other port gets from py/py.mk does not exist here and ulab cannot be built at
all. This adds the flags and sources the way py.mk does.

ulab is on by default. Boards that cannot spare the flash set
CIRCUITPY_ULAB = false in their circuitpython.toml, which nordic_nrf7002dk
does here: it has under 3 KB of headroom before this change and ulab costs
about 90 KB.

Flash cost measured on silabs_siwx917_dk2605a: 799136 to 890168 bytes,
76.21% to 84.89% of 1 MB, with 163 ulab sources compiled.

Headroom on the other zephyr-cp boards that report a flash figure is at least
135 KB, so nrf7002dk is the only one that has to opt out.
@mikeysklar
mikeysklar force-pushed the zephyr-cp/ulab-opt-in branch from 3b653fe to b7cdd2f Compare August 25, 2026 17:17
@mikeysklar

Copy link
Copy Markdown
Collaborator Author

Defaults on now, and bool() is gone, TOML gives a real bool.

Added the opt-out to nordic_nrf7002dk to show how it looks. It is the only board that needs one. Flash headroom before ulab, from the last green run:

nordic_nrf7002dk      2584 B      99.73% used
nordic_nrf54l15dk   135524 B      81.41% used
everything else     more

ulab costs about 91 KB, measured on siwx917_dk2605a, 799136 to 890168 bytes. That is headroom from the logs rather than a build with ulab on, so CI on this push is the real check.

CI caught this one. The STM32N6 has no internal user flash and executes from
RAM, which is already 93% full at 486984 of 523264 bytes, so the roughly 90 KB
ulab adds overflows it by 56520 bytes.

My earlier headroom survey only looked at FLASH figures and this board reports
none, so it was missing from it. Rechecked both regions for every board: this
is the only other one that cannot fit, and nordic_nrf7002dk stays out on flash.
@mikeysklar mikeysklar changed the title zephyr-cp: allow boards to opt in to ulab zephyr-cp: build ulab, and let boards opt out Aug 26, 2026

@tannewt tannewt left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

@tannewt
tannewt merged commit 93fb91e into adafruit:main Aug 26, 2026
15 checks passed
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.

2 participants