Skip to content

windows pydevices variant: run built-in module __init__ on import - #18

Merged
bdbarnett merged 1 commit into
mainfrom
windows-builtin-init
Sep 25, 2026
Merged

bdbarnett merged 1 commit into
mainfrom
windows-builtin-init

Conversation

@bdbarnett

Copy link
Copy Markdown
Contributor

For PyDevices/displayif#41.

With this, micropython.exe registers jpegio's LVGL decoder on import jpegio the way unix does. The windows port is at the core ROM level, where MICROPY_MODULE_BUILTIN_INIT is off, so jpegio's __init__ never ran there. The pydevices windows variant now turns it on. That's one line in variants/windows/pydevices/mpconfigvariant.h, and the vst3-engine variant is unchanged.

I built it with upstream's make, cross-compiled, into its own build directory (ports/windows/build-desk-jpegio, the kitchen-sink manifest, under the build lock), and ran the same script on each interpreter:

import lvgl as lv; lv.init(); import jpegio; print(jpegio.lvgl_decoders())
this build            win32  ('jpegio', 'LODEPNG', 'BIN')
bin/micropython.exe   win32  ('LODEPNG', 'BIN')
bin/micropython       linux  ('jpegio', 'LODEPNG', 'BIN')

displayif's tests/jpegio/test_jpegio_lvgl.py passes in full on this build: 3 exact digests, the file source, memory, and the deinit/init cycle. PyDevices/displayif#43 makes that test require import-time registration on win32. It fails on the current bin/micropython.exe, so it catches the missing hook.

After this merges, tools/build_interpreters.sh --only mp-windows in the anchor puts it in bin/micropython.exe. I didn't rebuild the shared binaries.

The windows port sits at the core ROM level, where
MICROPY_MODULE_BUILTIN_INIT is off, so micropython.exe never ran jpegio's
__init__ and `import jpegio` after lv.init() left LVGL without the jpegio
decoder (PyDevices/displayif#41). Unix gets it from the extra-features level;
the windows variant now sets it directly.
bdbarnett added a commit to PyDevices/displayif that referenced this pull request Sep 25, 2026
…41) (#43)

test_jpegio_lvgl.py now fails when `import jpegio` after lv.init() registers
nothing on linux, darwin or win32, naming MICROPY_MODULE_BUILTIN_INIT. The
windows half needs PyDevices/micropython-pydevices#18, which turns the hook on
in the PyDevices windows variant; the README says so and tells other windows
builds to call register_lvgl_decoder().
@bdbarnett
bdbarnett merged commit 6cc9959 into main Sep 25, 2026
@bdbarnett
bdbarnett deleted the windows-builtin-init branch September 25, 2026 23:57
bdbarnett added a commit that referenced this pull request Oct 19, 2026
The sentence counted usbif third after displayif and the DSP repo, which has
been audiodsp since 2026-09-21 and was never a hardware layer. audioif is one
now -- the audio pump's platform drivers, public at v0.1.0.
bdbarnett added a commit that referenced this pull request Oct 19, 2026
Finish CircuitPython constructor parity (no spi_bus)
bdbarnett added a commit that referenced this pull request Oct 19, 2026
* docs: add audioif newcomer guide

* newcomers: describe the probes tests/ actually holds
bdbarnett added a commit that referenced this pull request Oct 19, 2026
… matrix, gamma) (#18)

* OV5647: every mode in the P4 builds; the ISP takes the sensor's Bayer order as flip and mirror leave it (bayer=, bayer())

* OV5647 opens upright: write flip and mirror at open, colour order from the mode table's own mirror

* Colour from the ISP: auto white balance from its statistics, and the OV5647's colour matrix and gamma (awb=, awb(), wb_gains())
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