Skip to content

Patch 0018: a fresh ESP-IDF clone builds the S3 again; lock at the KeDei merges - #35

Merged
bdbarnett merged 1 commit into
mainfrom
fix/esp32-missing-include-dirs
Oct 6, 2026
Merged

bdbarnett merged 1 commit into
mainfrom
fix/esp32-missing-include-dirs

Conversation

@bdbarnett

Copy link
Copy Markdown
Contributor

The second cloud run of scripts/exercise_build.sh (2026-10-06) built every target in one go, ESP-IDF fetched by build_mp.py included, except the ESP32-S3. It failed at configure: Include directory '.../esp_hw_support/mspi_timing_tuning/port/esp32s3/include' is not a directory.

The cause. ESP-IDF v5.5.4's S3 port declares that include directory but tracks no files in it, so a fresh clone never creates it. ESP-IDF itself tolerates that. MicroPython's esp32 port doesn't. usermod.cmake gathers include directories transitively from every library a user C module links, and cameraif and displayif link ESP-IDF driver components that pull in esp_hw_support. idf_component_register() then refuses the missing directory. The ESP-IDF in the workspace had once been at an older tag and still had the empty directory, which hid it. With that removed, so the checkout matches a clean v5.5.4, the failure reproduced here in 28 seconds.

The fix. Overlay patch 0018 drops non-existent directories (generator expressions are kept) from MICROPY_INC_USERMOD before idf_component_register(). It's in the series' usual form, with a justification header and its checksum in provenance.json. apply_patches.py --check: the series applies clean to v1.29.0. With it, the S3 LCD-7 --modules all build passes against the clean ESP-IDF (9 m 0 s, autosize included). It's an upstream MicroPython bug too, and the draft for upstream is a separate issue.

modules.lock moves displayif to PyDevices/displayif#48 (mipidsi non_burst/continuous_clock) and pydevices to PyDevices/pydevices#123 (the DEV-KIT + KeDei board config), both proven on Brad's bench today.

…xist (a fresh ESP-IDF v5.5.4 clone broke every S3 build with cameraif or displayif); modules.lock: displayif and pydevices at the KeDei merges
@bdbarnett
bdbarnett merged commit dd8575f into main Oct 6, 2026
@bdbarnett
bdbarnett deleted the fix/esp32-missing-include-dirs branch October 6, 2026 06:43
bdbarnett added a commit that referenced this pull request Oct 19, 2026
…35)

picodvi was the one framebuffer backend here with no fill_rect, so on an
RP2040 or RP2350 with a DVI output every displaydev.FBDisplay.fill_rect
fell off the end of the dispatch ladder onto per-row memoryview assigns
from Python. On the ESP32-P4, where the same fallback was measured on
hardware, a 400x240 fill costs 2.46 s that way against 3.5 ms through
the native fill -- a factor of 698 (#28). Nobody has measured it on an
rp2, but the ladder is the same one, and an app that clears a region
reads as a hung program rather than a slow one.

It was left out of #33 for a real reason: unlike the other five backends
this one is not fixed at 16bpp. color_depth is 1, 2, 4, 8, 16 or 32 and
defaults to 8, across two different SoC backends, so it cannot use the
shared displayif_fb_fill_rect16 and the sub-byte depths need partial-byte
masking at the left and right edges that none of the others has to think
about.

So the masking goes in the shared header as
displayif_fb_fill_rect_packed, beside the 16bpp fill, and picodvi is a
thin caller of it -- bounds through the same displayif_fb_rect_ok, so it
refuses exactly the rectangles the other five refuse.

Which end of a byte is the LEFT pixel is not a choice and the header says
where it is read from: the RP2350 HSTX command expander pops pixels by
shifting the word RIGHT, so the first pixel on the wire is the low bits.
Getting that backwards does not crash and does not look like a fill_rect
defect -- a fill comes out mirrored within each byte, which at 1bpp is a
four-pixel stagger along an edge. It is written down once so the board
bring-up has something to check rather than something to discover.

The deinit guard is not decoration either: picodvi_rp2350_deinit()
m_free()s the framebuffer and sets it NULL, so a fill after deinit would
write through freed memory. RuntimeError and the wording match
rgbmatrix's guard beside it.

Proven two ways, neither of them a DVI monitor. tests/test_fb_fill_packed.c
runs the packed fill against a naive per-pixel reference over 4908
rectangles across all six depths, walking every start and width the byte
boundaries can produce rather than sampling a few, with canary bytes
either side because writing outside the rectangle is this code's first
failure mode. Three planted faults: MSB-first packing (1615 failures),
a whole-byte write that spills past the right edge (1605), and OR
instead of replace (3 -- caught only by the fill-with-zero case, which
is why that case is there). And mod_picodvi.c compiles for rp2350 with
the real ARM toolchain, no warnings.

THE BOARD PROOF IS OWED: no rp2 board is here, nothing was flashed, and
the pixel order above has not been seen on a screen.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant