zephyr-cp: do not rerun the sysbuild configure for every language build - #11424
Conversation
The Makefile gave west cmake arguments on every build, and west reruns the whole sysbuild configure whenever it gets any. The release build does that 17 times per board, once per language, for a change that only affects `build_circuitpython.py`. Pass `TRANSLATION` to `build_circuitpython.py` in the environment instead of as a cmake variable, and run the configure only when the build directory is new or the west arguments differ from the ones recorded at the last configure. ninja still reconfigures on its own when a Kconfig, overlay or CMake file changes. The record is written before west runs and removed if it fails, so a failed configure cannot leave the directory configured with arguments the record does not show. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
mikeysklar
left a comment
There was a problem hiding this comment.
Turning DEBUG=1 off again does not work on the 8 boards with no board.conf: make DEBUG=1 then plain make stays a debug build until make clean. Main does the same, so it is not from this PR. Passing the argument every time, even empty, fixed it for me, in place of the ifneq/endif around it:
WEST_CMAKE_ARGS += -Dzephyr-cp_EXTRA_CONF_FILE=$(CP_BOARD_CONF)| Step | main and this PR | with the change |
|---|---|---|
| fresh | normal | normal |
DEBUG=1 |
debug | debug |
no DEBUG |
debug (wrong) | normal |
Checked by elf md5 and .config on raspberrypi_rpi_pico_zephyr, Linux, make 4.3. The repeat build still skips the configure with the change (3 s).
The PR itself works as described here. The inline suggestions only shorten comments.
Co-authored-by: Mikey Sklar <mikeysklar@gmail.com>
rm -rf autoapi rm -rf circuitpython-stubs dist *.egg-info
…/circuitpython into zephyr-skip-reconfigure
I did this in a new commit; could you re-check that? Thanks. |
|
Claude wrote this: Re-checked the branch at 027d6ff, which carries @mikeysklar's always-pass-the-fragment change (cce234f) and #11423.
Dropping |
mikeysklar
left a comment
There was a problem hiding this comment.
Re-checked 027d6ff on rpi_pico_zephyr. DEBUG=1 then plain make now goes back to the normal build, and the repeat build still skips the configure. Looks good, approved.
Claude found and fixed this, reviewed by @dhalbert.
Problem
ports/zephyr-cp/Makefilegiveswest buildcmake arguments on every invocation, and west reruns the full two-pass sysbuild configure whenever it gets any. The release build does that 17 times per board, once per language, although the language only affects thebuild_circuitpython.pystep;TRANSLATIONis not used anywhere else in cmake. On the 4-core runner that is an estimated 10-20 s of each language build after #11416, roughly 80-150 runner-minutes per main build across the 30 boards.Changes
build_circuitpython.pytakes the translation from aTRANSLATIONenvironment variable when set, then from the cmake argument, then en_US.TRANSLATIONto the recipe and records the west arguments (board, shields, cmake arguments) in<build>/west_configure_args.txt. It runs the configuringwest build -b ... --sysbuild -- ...only when the build directory is new or the recorded arguments differ; otherwise it runswest build -d <build>, which is ninja only. ninja still reconfigures by itself when a Kconfig, overlay or CMake file changes, so the record only has to cover argument changes such asDEBUG=1or a differentSHIELD.Together with #11416, this makes the zephyr-cp builds work like the make-based ports: building another language regenerates the translation data, recompiles the few files that use it and relinks, with no configure step.
Verification
Feather RP2040 build, locally, with #11422 and #11423 applied.
DEBUG=1debug.confmerged, record updatedDEBUG=1againDEBUGThe incremental de_DE binary is byte-identical to a clean de_DE build at the same path. cptools tests pass.
Depends on #11423 for
DEBUG=1to work at all; independent of it otherwise.