Skip to content

added lvgl build instructions#1

Open
peterzuger wants to merge 1700 commits intooliver-joos:knx_visionfrom
peterzuger:knx_vision_ltdc
Open

added lvgl build instructions#1
peterzuger wants to merge 1700 commits intooliver-joos:knx_visionfrom
peterzuger:knx_vision_ltdc

Conversation

@peterzuger
Copy link

No description provided.

agatti and others added 30 commits November 3, 2025 13:21
This commit shortens register-indexed load/store emitter functions, by
reusing integer-indexed equivalent operations as part of the sequence
generation process.

Before these changes, register-indexed load/store emitters would follow
two steps to generate the sequence: generate opcodes to fix up the
register offset to make it point to the exact position in memory where
the operation should take place, and then perform the load/store
operation itself using 0 as an offset from the recalculated address
register.

Since there is already a generic optimised emitter for integer-indexed
load/stores, that bit of code can be reused rather than having an ad-hoc
implementation that is tailored to operate on an offset of 0.  Removing
the custom emitter code in favour of calling the general integer-indexed
emitter saves around 150 bytes without any changes in the emitter
behaviour (generating the same opcode sequence and making use of future
improvement in that emitter too).

Signed-off-by: Alessandro Gatti <a.gatti@frob.it>
This commit changes the sequences generated for not-equal and
less-than-or-equal comparisons, in favour of better replacements.

The new not-equal comparison generates a sequence of equal size but
without the burden of a jump to set the output value, this also had
the effect of reducing the size of the code generator as only two
opcodes need to be generated instead of three.

The less-than-or-equal sequence, on the other hand, is actually two
bytes shorter and does not contain any jumps.  If Zcb opcodes can be
used for performing the final XOR operation then two more bytes could be
saved on each comparison.  The same remarks about having a shorter
generator due to two opcodes being generated instead of three still
applies here.

Signed-off-by: Alessandro Gatti <a.gatti@frob.it>
This field exists to cache the lnotab field removed from v2 in micropython#17639 by
ddf2c3a, and is now unused.

Signed-off-by: Anson Mansfield <amansfield@mantaro.com>
This commit lets the native emitter generate shorter code when clearing
exception objects on RV32.

Since there are no direct generic ASM functions to set a specific
immediate to a local variable, the native emitter usually generates an
immediate assignment to a temporary register and then a store of that
register into the chosen local variable.  This pattern is also followed
when clearing certain local variables related to exception handling,
using MP_OBJ_NULL as the immediate value to set.

Given that at the moment MP_OBJ_NULL is defined to be 0 (with some other
spots in the native emitter that leverage that fact when checking the
state of the variables mentioned earlier), and that the RV32 CPU has a
dedicated register that is hardwired to read 0, a new method to set
local variables to MP_OBJ_NULL is introduced.

When generating RV32 code, the new macro will skip the intermediate
register assignment and directly uses the X0/ZERO register to set the
chosen local variable to MP_OBJ_NULL.  Other platforms will still
generate the same code sequence as before this change.

This is a followup to 40585ea.

Signed-off-by: Alessandro Gatti <a.gatti@frob.it>
This adds type casting to avoid build errors on certain systems.

Signed-off-by: Yanfeng Liu <yfliu2008@qq.com>
Add abort setup code `nlr_set_abort` to the standard runtime executor.
This makes the standard runtime respond to abort signal without any further
modifications.

- When aborted, the program exits with 137 exit code (configurable, same as
  posix sig abort), to differentiate from a normal shutdown.

- When exited by exception/crash, the program will exit with exit code 1
  (configurable).

- When exited by exception KeyboardInterrupt, the program will exit with
  exit code 130 (configurable, same as posix sig int).

- When exited with a exit code (from Python environment), this code is
  propagated.  When a different object is passed, exit code is set to 1 and
  the value printed, to be consistent with Python docs:
  https://python.readthedocs.io/en/latest/library/exceptions.html#SystemExit

Signed-off-by: John Smith <jsmith@jsmith.cz>
Running `ruff format tools/cc1` picks up `tools/cc1` which is a Python file
that does not have a .py file extension.

Signed-off-by: Christian Clauss <cclauss@me.com>
Signed-off-by: Damien George <damien@micropython.org>
Signed-off-by: Damien George <damien@micropython.org>
So that pre-commit and CI will check formatting and linting.

Signed-off-by: Damien George <damien@micropython.org>
Only a problem when UART TX is also enabled and goes first (i.e. esp32
port) as sending 16384 bytes in one go triggers the timeout.

This work was funded through GitHub Sponsors.

Signed-off-by: Angus Gratton <angus@redyak.com.au>
Some boards support waking up via GPIO pins, but this is not currently
supported by MicroPython.  This commit adds support for waking with GPIO in
a similar interface to waking with ext0, ext1, touch and ulp.  This commit
adds documentation for this new function as well.

Signed-off-by: Meir Armon <meirarmon@gmail.com>
New board planned to be launched on Crowd Supply in late 2025.  ESP32-based
core module with IEEE 802.3cg 10BASE-T1S Single Pair Ethernet networking
and power distribution over data lines.

Signed-off-by: Patrick Van Oosterwijck <patrick@silicognition.com>
The current `esp32.RMT` class uses a legacy API from ESP-IDF 4.x.  The
ESP-IDF 5.x offers a new API, which is overall better, and easier to
implement the RX side in the future.  This commit updates the module and
the documentation, preserving the current MicroPython RMT API as much as
possible.

The bitstream RMT implementation was updated as well, since ESP-IDF does
not allow firmware to reference legacy and new APIs at the same time (it
resets right after boot with an error message, even if neither module is
imported).

The documentation is updated accordingly.

Signed-off-by: Elvis Pfutzenreuter <elvis.pfutzenreuter@gmail.com>
Signed-off-by: yuan_mo <2286087148@qq.com>
Signed-off-by: Damien George <damien@micropython.org>
Signed-off-by: yuan_mo <2286087148@qq.com>
Signed-off-by: Damien George <damien@micropython.org>
Signed-off-by: Daniël van de Giessen <daniel@dvdgiessen.nl>
Not a functional change, but makes it easier to see that mp_usbd_init() is
available regardless of whether MICROPY_HW_ENABLE_USB_RUNTIME_DEVICE is
set.

Also adds a no-op inline mp_usbd_deinit() implementation, which means both
a port's calls to mp_usbd_init()/deinit() can both be guarded on the same
MICROPY_HW_ENABLE_USBDEV.

This work was funded through GitHub Sponsors.

Signed-off-by: Angus Gratton <angus@redyak.com.au>
Fixes problems with USB-CDC state after soft reset if USBDevice has been
active with the default USB-CDC driver also enabled.

This also brings ESP32 behaviour in line with RP2 and other ports, where
boot.py is executed before the runtime USB device is initialised. This
allows setting up a custom USB device in boot.py.

There is still a bug here, because calling tud_disconnect() doesn't cause
any UNPLUG or BUS_RESET events to arrive from TinyUSB - which means the USB
device state stays out of sync until we call mp_usbd_init() again...

This work was funded through GitHub Sponsors.

Signed-off-by: Angus Gratton <angus@redyak.com.au>
Signed-off-by: Angus Gratton <angus@redyak.com.au>
This is necessary so the ESP-IDF TinyUSB component can include
py/mpconfig.h, but is also a good design goal (less creep of symbols
into unrelated parts of the code).

This work was funded through GitHub Sponsors.

Signed-off-by: Angus Gratton <angus@redyak.com.au>
Instead, depend directly on espressif/tinyusb component
(which is otherwise transitively included via esp_tinyusb).

Turns out esp_tinyusb builds a bunch of source files with
symbols that conflict with our tinyusb symbols (i.e.
descriptors_control.c).

This only works because nothing in MicroPython causes the linker to include
the esp_tinyusb.a library, however in order to override the dcd_int_handler
(in following commit) this caused the linker to pull this library in and
break the build.

There's also a problematic header skew - TinyUSB component was building
with the tusb_config.h file from esp_tinyusb component, but we have our own
tusb_config.h file in shared/tinyusb. The changes in parent commit allow
us to build the TinyUSB component with our tusb_config.h header.

User-facing impacts are:

- Can no longer override USB VID & PID via sdkconfig, have to set
  MICROPY_HW_USB_VID/PID instead (changes applied in this commit).

- esp32 boards will have the same USB serial number as other ports
  (i.e. based on the hardware MAC address, not hard-coded).

Side effects include:

- CFG_TUD_DWC2_SLAVE_ENABLE is now set, DMA mode is disabled.

Signed-off-by: Angus Gratton <angus@redyak.com.au>
Temporarily switch from the espressif TinyUSB component to
a MicroPython fork where this fix has been cherry-picked:
hathach/tinyusb#3293

This work was funded through GitHub Sponsors.

Signed-off-by: Angus Gratton <angus@redyak.com.au>
Changed the pin numbers used for the I2S rate testing as the pin numbers
used were incompatible with the limited GPIO pins availalbe on the
ESP32-C3, causing the tests to fail.

Signed-off-by: Jos Verlinde <jos_verlinde@hotmail.com>
Signed-off-by: Damien George <damien@micropython.org>
Signed-off-by: Damien George <damien@micropython.org>
ESP32 requires initial high levels of the channels before starting the
count, in order to have 4 pulse for the first rotation.

Also add tests for encoder phases x2 and x4.

Signed-off-by: Ihor Nehrutsa <Ihor.Nehrutsa@gmail.com>
Signed-off-by: Ihor Nehrutsa <Ihor.Nehrutsa@gmail.com>
If MICROPY_PY_THREAD is set, PendSV_Handler acquires a mutex and calls the
dispatch functions. If pendsv_schedule_dispatch is called by a higher
priority interrupt while the mutex is acquired by PendSV_Handler it's
possible for the dispatch to not be triggered.

Add a check for dispatch calls at the end of PendSV_Handler once the mutex
has been released.

Fixes issue micropython#18365.

Signed-off-by: Peter Harper <peter.harper@raspberrypi.com>
To allow these features to be properly disabled.
The full Alif license texit is available in
`lib/alif_ensemble-cmsis-dfp/License.txt` if it's needed.

Signed-off-by: iabdalkader <i.abdalkader@gmail.com>
dpgeorge and others added 29 commits January 27, 2026 00:45
This should be equivalent logic, and is a bit simpler and clearer now.

Signed-off-by: Damien George <damien@micropython.org>
Reduces code size by about 60 bytes.

Signed-off-by: Damien George <damien@micropython.org>
This commit fixes a long standing bug/deficiency in the lwIP socket code,
whereby it would abandon all incoming TCP data if the remote sent a TCP
RST.

This behaviour it tested by the existing
`tests/multi_net/tcp_client_rst.py` and
`tests/multi_net/asyncio_tcp_client_rst.py` tests, and they both fail on
boards like PYBD_SFx and RPI_PICO_W due to the deficiency.

With the fix here, both of those tests now pass on lwIP targets, along with
all existing socket tests.

Signed-off-by: Damien George <damien@micropython.org>
These changes test a few more things related to TCP RST:
- add a second iteration to drain incoming data after TCP RST
- read data after closing socket

Signed-off-by: Damien George <damien@micropython.org>
When `MICROPY_PY_FUNCTION_ATTRS_CODE` is enabled, constructing a function
instance through `fun_bc_make_new()` can call
`mp_make_function_from_proto_fun()` with pure bytecode as the proto-fun.

Signed-off-by: Damien George <damien@micropython.org>
In case `MICROPY_PY_MARSHAL` is enabled manually.  Otherwise the marshal
module is not very usable.

Signed-off-by: Damien George <damien@micropython.org>
This adds support to `mp_raw_code_save_fun_to_bytes()` so that it can
handle saving functions that have children.  It does this by inspecting
the MP_BC_MAKE_FUNCTION/etc opcodes to work out how many children there
are, and creating a tree of simplified raw code information.

Signed-off-by: Damien George <damien@micropython.org>
If a function has children then the code object returned from __code__ must
contain an `mp_raw_code_t` (actually `mp_raw_code_truncated_t` is enough)
that points to the child table.

Signed-off-by: Damien George <damien@micropython.org>
This commit adds support to the `marshal` module to be able to dump
functions that have child functions.  For example:

    import marshal

    def f():
        def child():
            return 1
        return child

    marshal.dumps(f.__code__)

It also covers the case of marshalling functions that use list
comprehensions, because a list comprehension uses a child function.

This is made possible by the newly enhanced
`mp_raw_code_save_fun_to_bytes()` that can now handle nested functions.

Unmarshalling via `marshal.loads()` already supports nested functions
because it uses the standard `mp_raw_code_load_mem()` function which is
used to import mpy files (and hence can handle all possibilities).

Signed-off-by: Damien George <damien@micropython.org>
Pins may be on the LPADC2 peripheral.

Signed-off-by: Alon Bar-Lev <alon.barlev@gmail.com>
The rt117x uses the LPADC peripheral which supports both A-side and B-side
channel inputs, e.g. ADC1_CH1A and ADC1_CH1B.

Previously, only `kLPADC_SampleChannelSingleEndSideA` was being used during
capture, while the pin may be in side B.  The fix in this commit detects
the side based on the pin configuration and sets `sampleChannelMode`
appropriately.

Signed-off-by: Alon Bar-Lev <alon.barlev@gmail.com>
Adds new PHY driver for TI DP83867 Gigabit Ethernet PHY.

Signed-off-by: Andrew Leech <andrew.leech@planetinnovation.com.au>
The definitions from pins.csv are used directly in mimxrt/eth.c

Signed-off-by: Andrew Leech <andrew.leech@planetinnovation.com.au>
Signed-off-by: Andrew Leech <andrew.leech@planetinnovation.com.au>
This adds support for the ALT11 alternate function mode on MIMXRT1176
MCUs, enabling FLEXPWM channels on GPIO_AD pins that were previously
unavailable for PWM use.

Changes:
- Add PIN_AF_MODE_ALT11 enum to pin.h
- Add ALT11 column to MIMXRT1176_af.csv with FLEXPWM mappings
- Enables FLEXPWM1-4 on GPIO_AD_06 through GPIO_AD_21

This change only affects MIMXRT1176-based boards (MIMXRT1170_EVK and
PHYBOARD_RT1170). Other MIMXRT family chips use alternate function
modes ALT0-ALT9 and are not affected.

Tested on MIMXRT1176 hardware with PWM output on GPIO_AD_14
(FLEXPWM3_PWM0_X).

Signed-off-by: Algy Tynan <algy@tynan.io>
Currently the mimxrt port has a resolution of only 1 second for
`machine.RTC().datetime()` and `time.time_ns()`.  This means (among other
things) that it fails the `tests/extmod/time_time_ns.py` test, which
requires requires at least 5ms of resolution.

The underlying RTC hardware is just a 64-bit counter, and the HAL functions
`SNVS_LP_SRTC_GetDatetime()` and `SNVS_LP_SRTC_SetDatetime()` do
conversions between y/m/d/h/m/s and this 64-bit value, which counts at a
rate of 32kHz.

This commit changes the RTC code to access the 64-bit counter directly and
therefore improve resolution of all RTC functions to 1/32768 seconds.

That makes things much simpler because it a lot of places the code wants to
know the number of seconds since the Epoch.  Currently it uses a
combination of `SNVS_LP_SRTC_GetDatetime()` and
`timeutils_seconds_since_epoch()` which converts the 64-bit counter to
date-time and then back to seconds.  Those operations are computationally
expensive.

With this commit, getting the number of seconds since the Epoch is as
simple as reading the 64-bit counter and dividing by 32768.  We can
leverage a lot of the timeutils functions to simplify everything, and make
it similar to other ports like rp2.

Benefits of this change:
- simpler, more efficient code to get/set RTC
- `machine.RTC().datetime()` now has a non-zero value in the last slot,
  being the number of microseconds, and has a resolution of 1/32768 seconds
- `time.time_ns()` now has a resolution of 1/32768 seconds
- the `test/extmod/time_time_ns.py` test now passes

Signed-off-by: Damien George <damien@micropython.org>
This adds docs for the `mimxrt` module and the `mimxrt.Flash` class, the
implementation for which was first added in
dfd4324

The docs are simple, following the conventions used for similar classes in
the rp2 and stm32 ports.

Signed-off-by: Andrew Leech <andrew.leech@planetinnovation.com.au>
(Can be overridden by setting STFLASH variable.)

Generalises the change from 6b13e6c to all
stm32 boards. As we're resetting the target to flash it anyway, it
shouldn't hurt to put the target into reset before trying to connect.

This work was funded through GitHub Sponsors.

Signed-off-by: Angus Gratton <angus@redyak.com.au>
The test runners have evolved over time and become more and more complex.
In particular `tests/run-tests.py` is rather large now.  The test runners
also duplicate some functionality amongst themselves.

As a start to improving this situation, this commit factors out the helper
functions from `run-tests.py` into a new `test_utils.py` file, and uses
that new module in all test runners.

There should be no functional change here.

Signed-off-by: Damien George <damien@micropython.org>
This is a workaround for the faulty LSE quartz circuit on µGatewayV2 boards Revision 02 or older.

Signed-off-by: Oliver Joos <oliver.joos@hispeed.ch>
Signed-off-by: Oliver Joos <oliver.joos@hispeed.ch>
FF_FS_TINY is still enabled by default. But this commit allows a board to disable it using #define MICROPY_FATFS_TINY 0

Disabling FF_FS_TINY on stm32 takes 204 bytes more flash memory for code, but not more heap memory. Writing many 64 byte strings to a file in a non-tiny FAT FS is >3 times faster than with FF_FS_TINY enabled.

Signed-off-by: Oliver Joos <oliver.joos@hispeed.ch>
See micropython issue micropython#13471 and the related PR micropython#13717 for an explanation
of a similar issue in the SPI DMA driver.

Signed-off-by: Peter Züger <zueger.peter@icloud.com>
DMA transfers for SDMMC1 fail on an STM32H7 if an LTDC display is using DMA to read from AXI RAM at the same time. It seems to work if both use AXI RAM.

MAX_NUM_BLOCKS is set to 128 because this is the maximum using a FAT filesystem (see extmod/vfs_fat_diskio.c). LitteFS uses much less.

Signed-off-by: Oliver Joos <oliver.joos@hispeed.ch>
Signed-off-by: Oliver Joos <oliver.joos@hispeed.ch>
Signed-off-by: Oliver Joos <oliver.joos@hispeed.ch>
Signed-off-by: Oliver Joos <oliver.joos@hispeed.ch>
Signed-off-by: Oliver Joos <oliver.joos@hispeed.ch>
build the lvgl submodule with all the required MPY settings
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.