Merge upstream micropython master (for m_tracked_realloc and other 1.25-1.29 changes)#106
Merge upstream micropython master (for m_tracked_realloc and other 1.25-1.29 changes)#106andrewleech wants to merge 2099 commits into
Conversation
Simplifies the pattern of an optional arg which can be a list of at least a certain length, otherwise one is lazily initialised. Modify pyb.CAN and ESP-NOW APIs to use the helper. Note this changes the return type of pyb.CAN.recv() from tuple to list. This work was funded through GitHub Sponsors. Signed-off-by: Angus Gratton <angus@redyak.com.au>
This work was funded through GitHub Sponsors. Signed-off-by: Angus Gratton <angus@redyak.com.au>
API is different to the original machine.CAN proposal, as numerous shortcomings were found during initial implementation. This work was funded through GitHub Sponsors. Signed-off-by: Angus Gratton <angus@redyak.com.au>
These are oddly missing from the STM32G4 HAL, but the reference manual describes being able to use them and the implementations seem to work as expected. Note that unlike STM32H7 it doesn't seem like we must use this approach, because HAL_FDCAN_AddMessageToTxFifoQ() does seem to not have the issues with priority inversion seen on the H7. However it's simpler to use the same API for both... Signed-off-by: Angus Gratton <angus@redyak.com.au> Signed-off-by: Angus Gratton <angus@redyak.com.au>
Implemented according to API docs in a parent comment. Adds new multi_extmod/machine_can_* tests which pass when testing between NUCLEO_G474RE, NUCLEO_H723ZG and PYBDV11. This work was mostly funded through GitHub Sponsors. Signed-off-by: Angus Gratton <angus@redyak.com.au>
The DAR register field is for auto-retransmit, FDCAN doesn't support automatic restart to clear Bus Off. This work was funded through GitHub Sponsors. Signed-off-by: Angus Gratton <angus@redyak.com.au>
Some MCUs (eg N6) have more timers which are 32-bit, and it's best to use this macro to work that out. Signed-off-by: Damien George <damien@micropython.org>
This functionality already exists in the TIM code, and can be reused by the upcoming PWM implementation. Signed-off-by: Damien George <damien@micropython.org>
This commit implements the standard `machine.PWM` class on stm32, using the common bindings in `extmod/machine_pwm.c`. Features implemented are: - construct a PWM object from a pin, with automatic selection of TIM instance and channel; - get and set freq, duty_u16 and duty_ns; - optionally invert the output. The PWM objects are static objects (partly in ROM, partly in RAM) so creating a PWM instance on the same pin will return exactly the same object. That's consistent with other peripherals in the stm32 port, and consistent with other PWM implementations (eg rp2). When creating a PWM object on a pin, if that pin has multiple TIM instances then only the first will be selected. A future extension could allow selecting the TIM/channel (eg similar to how ADCBlock allows selecting an ADC). Signed-off-by: Damien George <damien@micropython.org>
When assigning a TIMx_CHy to a pin, the second available alternate function is chosen (or the first if there is only one). This gives better overall static allocation of TIM's to pins. On most MCUs (eg F4, F7, H5, H7) picking the second gives TIM5_CH[1-4] for PA0-PA3, and TIM5 is a 32-bit timer. That leaves TIM2 (also usually on PA0-PA3) for other pins that only have TIM2. For STM32G0, STM32L432 and STM32L452 the heuristic is to simply use the first available alternate function because that gives TIM2 (a 32-bit timer) on PA0-PA3. The above heuristic guarantees that PA0-PA3 always get a 32-bit timer on all supported MCUs. Signed-off-by: Damien George <damien@micropython.org>
To be slightly more accurate computing the expected low/high times for the PWM output. Signed-off-by: Damien George <damien@micropython.org>
Signed-off-by: Damien George <damien@micropython.org>
Signed-off-by: Damien George <damien@micropython.org>
This allows the newly-added `machine.PWM` class to fit on these boards, which is arguably more useful than the features disabled in this commit. Signed-off-by: Damien George <damien@micropython.org>
So that TIM2_CH1 can be used. Signed-off-by: Damien George <damien@micropython.org>
Signed-off-by: Damien George <damien@micropython.org>
Signed-off-by: Damien George <damien@micropython.org>
Signed-off-by: Damien George <damien@micropython.org>
Signed-off-by: Damien George <damien@micropython.org>
Intended to catch problems where new features don't build in old ESP-IDF. Includes major refactor to the GitHub Actions Workflow for esp32 port, including making a reusable workflow for both Code Size and ESP32 build jobs. This work was funded through GitHub Sponsors. Signed-off-by: Angus Gratton <angus@redyak.com.au>
Signed-off-by: Damien George <damien@micropython.org>
This commit updates the listed limitations of the native emitter in the documentation related to how to increase speed of python code. Context managers are supported, as in functions marked as native can use the `with` statement in regular code. Generators can be used in native functions both on the emitting (ie. `yield <whatever>`) and on the receiving end. Signed-off-by: Alessandro Gatti <a.gatti@frob.it>
This commit fixes an issue related to the NimBLE initialisation procedure in low memory environments on ESP32 boards. MicroPython uses at least two different NimBLE stacks across the supported ports, mynewt (imported as an external library), and the one provided by Espressif in their own SDKs. The problem is that these two ports differ in the signature for `nimble_port_init(void)`, with mynewt returning `void`, and Espressif's returning a status code on failure. On ESP32 boards, allocating almost all the available heap and then turning on the Bluetooth stack would trigger a failure in the NimBLE initialisation function that is not handled by the NimBLE integration code, as there's no expectation of a recoverable condition. Since the stack initialisation would progress, then uninitialised memory accesses crash the board. Since we cannot really modify neither mynewt nor Espressif SDKs, the next best thing is to provide two conditional initialisation paths depending on a configuration setting. This would make Espressif ports recover from a failed initialisation whilst retaining the existing behaviour on other ports. This fixes micropython#14293. Signed-off-by: Alessandro Gatti <a.gatti@frob.it>
Because socket objects have a finaliser they must be created carefully, in case an exception is raised during the population of their members, eg invalid input argument or out-of-memory when allocating additional arrays. Prior to the fix in this commit, the finaliser would crash due to `incoming.udp_raw.array` being an invalid pointer in the following cases: - if a SOCK_RAW was created with a proto argument that was not an integer - if a SOCK_DGRAM or SOCK_RAW was created where the allocation of `lwip_incoming_packet_t` failed - if an integer was passed in for the socket type but it was not one of SOCK_STREAM, SOCK_DGRAM or SOCK_RAW Furthermore, if the allocation of `lwip_incoming_packet_t` failed then it may have led to corruption within lwIP when freeing `socket->pcb.raw` because that PCB was not fully set up with its callbacks. This commit fixes all of these issues by ensuring: - `pcb.tcp` and `incoming.udp_raw.array` are initialised to NULL early on - the proto argument is parsed before allocating the PCB - the allocation of `lwip_incoming_packet_t` occurs befor allocating the PCB - `incoming.udp_raw.array` is checked for NULL in the finaliser code The corresponding test (which already checked most of these causes of failure) has been updated to include a previously-uncovered scenario. Signed-off-by: Damien George <damien@micropython.org>
User callbacks allow code to respond to incoming messages without blocking or polling. User callbacks are optional, and if no callback is registered the code has no effect. The mechanism is the same as for TCP: when a connection is accepted or a TCP packet is received, a user callback is executed. Fixes issue micropython#3594. Signed-off-by: Jack Whitham <jack.d.whitham@gmail.com>
Add DMA, NPU and PDM IRQ priorities to irq.h. Signed-off-by: iabdalkader <i.abdalkader@gmail.com>
2.25k Seems necessary so it doesn't crash `thread/thread_stacksize1.py`. But 2.5k gives a little extra headroom to make that test actually pass. Signed-off-by: Damien George <damien@micropython.org>
With the recent addition of `machine.PWM` and `machine.CAN`, the internal flash of PYBD_SF3 overflows by about 300 bytes. This commit moves the inline assembler compiler functions from internal to external QSPI flash. That frees up about 3k internal flash, and shouldn't affect performance. Signed-off-by: Damien George <damien@micropython.org>
qstr literals are of type qstr_short_t (aka uint16_t) for efficiency, but when the type is passed to `mp_printf` it must be cast explicitly to type `qstr`. These locations were found using an experimental gcc plugin for `mp_printf` error checking. Signed-off-by: Jeff Epler <jepler@unpythonic.net>
This adds support for the standard `weakref` module, to make weak references to Python objects and have callbacks for when an object is reclaimed by the GC. This feature was requested by PyScript, to allow control over the lifetime of external proxy objects (distinct from JS<->Python proxies). Addresses issue micropython#646 (that's nearly a 12 year old issue!). Functionality added here: - `weakref.ref(object [, callback])` create a simple weak reference with optional callback to be called when the object is reclaimed by the GC - `weakref.finalize(object, callback, /, *args, **kwargs)` create a finalize object that holds a weak reference to an object and allows more convenient callback usage and state change The new module is enabled at the "everything" level. The implementation aims to be as efficient as possible, by adding another bit-per-block to the garbage collector, the WTB (weak table). Similar to the finalizer bit (FTB), if a GC block has its corresponding WTB bit set then a weak reference to that block is held. The details of that weak reference are stored in a global map, `mp_weakref_map`, which maps weak reference to ref/finalize objects, allowing the callbacks to be efficiently found when the object is reclaimed. With this feature enabled the overhead is: - 1/128th of the available memory is used for the new WTB table (eg a 128k heap now needs an extra 1k for the WTB). - Code size is increased. - At garbage collection time, there is a small overhead to check if the collected objects had weak references. This check is the same as the existing FTB finaliser scan, so shouldn't add much overhead. If there are weak reference objects alive (ref/finalize objects) then additional time is taken to call the callbacks and do some accounting to clean up the used weak reference. Signed-off-by: Damien George <damien@micropython.org>
Has been the default forever (or, at least, for a decade) and was removed entirely in a recent esptool release. This work was funded through GitHub Sponsors. Signed-off-by: Angus Gratton <angus@redyak.com.au>
This commit adds mode, pull, drive parameters to the Pin repr function. This allows to serialize Pin object to str and restore the Pin object from the string. Signed-off-by: IhorNehrutsa <Ihor.Nehrutsa@gmail.com>
When waking from deep sleep, it could be helpful to know what pins triggered the wake up since the wake pins could be configured to multiple pins. Signed-off-by: Meir Armon <meirarmon@gmail.com>
A board can #define MICROPY_HW_SDMMC_LDO_CHAN_ID in mpconfigboard.h for an internal LDO to control power to the SDMMC GPIO pins. This is needed to use SDIO 3.0, because the IO level has to switch between 3.3V and 1.8V. Signed-off-by: Dryw Wade <dryw.wade@sparkfun.com>
The ESP32-P4-Function-EV-Board uses LDO 4 for controlling SDMMC GPIO power. This is required to use SD cards with this board. Signed-off-by: Dryw Wade <dryw.wade@sparkfun.com>
Can now call machine.SDCard(ldo=...) to specify LDO channel. Channel defaults to MICROPY_HW_SDMMC_LDO_CHAN_ID if defined, otherwise None (disabled). Signed-off-by: Dryw Wade <dryw.wade@sparkfun.com>
Signed-off-by: Dryw Wade <dryw.wade@sparkfun.com>
Also enable MICROPY_PY_NETWORK_LAN if SOC_EMAC_SUPPORTED is defined, which enables on ESP32-P4. Signed-off-by: Dryw Wade <dryw.wade@sparkfun.com>
Fixes micropython#19035. Signed-off-by: Dryw Wade <dryw.wade@sparkfun.com>
Prevent WiFi IP events from corrupting Ethernet status. Signed-off-by: Mo Nazemi <moh.nazemi@gmail.com>
To disable `machine.SoftI2C` set zero
#define MICROPY_PY_MACHINE_SOFTI2C (0)
in `ports/esp32/mpconfigport.h`.
Signed-off-by: Ihor Nehrutsa <Ihor.Nehrutsa@gmail.com>
To disable `machine.SoftSPI` set zero in line
#define MICROPY_PY_MACHINE_SOFTSPI (0)
in file `ports/esp32/mpconfigport.h`.
Signed-off-by: Ihor Nehrutsa <Ihor.Nehrutsa@gmail.com>
Fixes bug where SPI can freeze if another DMA channel is tranferring to/from PSRAM. Fixes issue micropython#18471. Signed-off-by: Dryw Wade <dryw.wade@sparkfun.com>
This commit reduces the instruction count for the inline assembler sequence used in `mp_hal_ticks_cpu` when building the firmware in RISC-V mode. The code used a two instruction sequence to set the value of the `mcountinhibit` CSR to a fixed bit pattern, in order to have the cycle counter always enabled. Whilst this works, it also has the side-effect of always inhibiting the instructions counter, which may not be wanted in certain applications. Since all we need to do is to clear one bit, rather than setting the whole register we can just use the `CSRRCI` opcode to clear bit 0 of the CSR instead. This is done in a single instruction and leaves other register bits alone. Signed-off-by: Alessandro Gatti <a.gatti@frob.it>
This commit reduces the instructions count for the bitstream module's time-critical function setup procedure, when the firmware is built for RISC-V. The original code used a separate function with three opcodes to make sure the hardware cycle counter is turned on. However, all of that could be condensed in a single opcode placed in lieu of the function call. An instance of the `CSRRCI` opcode is placed in the function opcode stream to clear bit 0 of the `mcountinhibit` CSR. `CSRRCI` is supposed to also store the original value of the CSR into a register, but luckily `zero`/`x0` is a valid target so the opcode can be placed safely without disrupting the existing registers' state. Signed-off-by: Alessandro Gatti <a.gatti@frob.it>
Signed-off-by: Daniël van de Giessen <daniel@dvdgiessen.nl>
This prevents Python code from accidentally performing an operation that resizes the buffer. However, in the case that the build excludes memoryview, the crash is still possible. Closes: micropython#17848 Signed-off-by: Jeff Epler <jepler@unpythonic.net>
This commit adds `.deinit()` to the `machine.I2C` class, bringing it in line with both the target I2C class variant and the rest of the peripheral classes. Ports that want to allocate I²C bus entries dynamically can implement the `self.deinit()` method to add deallocation/cleanup code, otherwise this method is entirely optional to have. If no method is found in the port-provided object structure then calling `deinit()` on the object will do nothing, following what the `machine.SPI` object does. This addresses micropython#19096. Signed-off-by: Alessandro Gatti <a.gatti@frob.it>
Without this, the register address is not copied into the single buffer, and so the requested register address is garbage when the driver reads it. Signed-off-by: Julia Vassiliki <julia.vassiliki@unsw.edu.au>
USB 2.0 requires high-speed capable devices to provide a Device Qualifier descriptor. Signed-off-by: iabdalkader <i.abdalkader@gmail.com>
Refactor the byte length calculation in the wr_bytes and read methods to use a new `buffer_nbytes` function. This change corrects the accuracy of byte length determination for various buffer types. Closes: micropython#17665 Signed-off-by: Jos Verlinde <Jos_Verlinde@hotmail.com>
Signed-off-by: Jos Verlinde <Jos_Verlinde@hotmail.com>
This commit introduces an alias to access codeberg repos from within mpremote's package manager. Right now packages hosted on codeberg could only be referenced by their full URL, unlike other packages hosted on either GitHub or GitLab. To make access those packages easier, now they can be referenced as "codeberg:org/repo@branch". Signed-off-by: Alessandro Gatti <a.gatti@frob.it>
This commit makes it possible to disable the `dir` built-in function from being included in the interpreter image. The function in question is rarely used outside of interactive contexts, and in production code the main use of this function is to implement interactive debug/management consoles over a serial port. However, outside of that scope, the space taken by such function could probably be better used elsewhere. This feature inherits the same configuration level as `enumerate`, since it performs the same operation but on class members rather than data elements. This should be enabled by default on all ports except for `nrf` (for which it is now explicitly enabled) and the `minimal` variants of the `unix` and `zephyr` ports. The latter two ports are meant to also run with the smallest available feature set, so `tests/basics/builtin_dir.py` had to be made optional to make CI run cleanly for those two ports' test runs in their minimal configuration. Signed-off-by: Alessandro Gatti <a.gatti@frob.it>
Ths fixes the following type of diagnostic: "runtime error: left shift of 14 by 28 places cannot be represented in type 'int'" and ensures the resulting 32-bit value is correct. Signed-off-by: Jeff Epler <jepler@gmail.com>
This fixes the diagnostic "runtime error: left shift of negative value -1" and ensures the correct instruction is assembled. Signed-off-by: Jeff Epler <jepler@gmail.com>
Signed-off-by: Jeff Epler <jepler@gmail.com>
…tream features Merge upstream/master (8ecd995) into lv_micropython master. The primary motivation is to pick up m_tracked_realloc (upstream commit 18735dd), which an open PR against lvgl/lvgl (#10106) needs. It landed in upstream after v1.29.0-preview was cut, so a tag-based sync is not available. Conflicts resolved: - .gitmodules: kept upstream's added alif submodules (alif_ensemble-cmsis-dfp, alif-security-toolkit), kept the local lv_binding_micropython user_module, and adopted upstream's micropython/nxp_driver URL (previous hathach/nxp_driver URL was drift from before upstream's rename in v1.27.0). - .gitignore: kept both lv_micropython's local ignores and upstream's zephyr/esp8266 CI cache ignores. - .github/workflows/ruff.yml: kept the local lv_binding init step, adopted upstream's checkout@v6 and ruff==0.11.6 pins. - extmod/network_cyw43.c: took upstream's added STA-disconnect block; the cherry-picked WLAN fixes already present on both sides converged cleanly. - ports/esp32/mpconfigport.h: kept the local LVGL defines (MICROPY_ENABLE_SCHEDULER, MICROPY_MODULE_BUILTIN_INIT, MICROPY_PY_SYS_SETTRACE=0) and added upstream's MICROPY_ESP_IDF_ENTRY override. - py/misc.h: kept the local XC16 branch, adopted upstream's MP_INT_MAX- based clz dispatch in the #else branch. - py/mpconfig.h: took upstream's version (1.29.0-pre). - ports/esp32/machine_pwm.c, machine_touchpad.c: took upstream entirely. Upstream dropped ESP-IDF <v5.2 / <v5.3 support and rewrote these files; the lv_micropython local fixes were cherry-picks of the same fixes that landed upstream first and were then superseded by the rewrite. - ESP32 partition CSVs: upstream restructured to auto-detect flash size (commit 6201e77), deleting most partitions-*.csv files and removing 'vfs' entries from the survivors. Adopted the upstream layout. The lv_micropython local CSVs that resized partitions for LVGL firmware are no longer needed under auto-detect, but ESP32 LVGL board configs may need updating to fit the new app-partition sizes.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #106 +/- ##
=========================================
Coverage 98.47% 98.47%
=========================================
Files 153 176 +23
Lines 20139 22831 +2692
=========================================
+ Hits 19832 22483 +2651
- Misses 307 348 +41 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
5 issues found across 2672 files
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="docs/develop/porting.rst">
<violation number="1" location="docs/develop/porting.rst:53">
P2: The porting example calls `mp_cstack_init_with_sp_here()` without including the header that declares it, so the documented `main.c` can fail to compile.</violation>
</file>
<file name="docs/library/network.PPP.rst">
<violation number="1" location="docs/library/network.PPP.rst:81">
P2: PPP.config example uses class-level call instead of instance-level call</violation>
</file>
<file name="docs/library/micropython.rst">
<violation number="1" location="docs/library/micropython.rst:70">
P3: Verbose mem_info docs hard-code a 16-byte GC block and 1KiB line size, but both depend on port/architecture and are incorrect on non-32-bit builds.</violation>
</file>
<file name=".github/actions/setup_esp32/action.yml">
<violation number="1" location=".github/actions/setup_esp32/action.yml:22">
P2: Third-party GitHub Actions are pinned to mutable tags instead of immutable SHAs.</violation>
</file>
<file name="docs/library/machine.Timer.rst">
<violation number="1" location="docs/library/machine.Timer.rst:52">
P2: Timer.init signature hard-codes `hard=True` but documentation text says default is port-specific, creating a contradiction.</violation>
</file>
Note: This PR contains a large number of files. cubic only reviews up to 75 files per PR, so some files may not have been reviewed. cubic prioritizes the most important files to review.
On a pro plan you can use ultrareview for larger PRs.
| int main(int argc, char **argv) { | ||
| // Initialise the MicroPython runtime. | ||
| mp_stack_ctrl_init(); | ||
| mp_cstack_init_with_sp_here(2048); |
There was a problem hiding this comment.
P2: The porting example calls mp_cstack_init_with_sp_here() without including the header that declares it, so the documented main.c can fail to compile.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At docs/develop/porting.rst, line 53:
<comment>The porting example calls `mp_cstack_init_with_sp_here()` without including the header that declares it, so the documented `main.c` can fail to compile.</comment>
<file context>
@@ -51,7 +50,7 @@ The basic MicroPython firmware is implemented in the main port file, e.g ``main.
int main(int argc, char **argv) {
// Initialise the MicroPython runtime.
- mp_stack_ctrl_init();
+ mp_cstack_init_with_sp_here(2048);
gc_init(heap, heap + sizeof(heap));
mp_init();
</file context>
| stream = PPP.config("stream") | ||
| PPP.config(stream=stream) |
There was a problem hiding this comment.
P2: PPP.config example uses class-level call instead of instance-level call
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At docs/library/network.PPP.rst, line 81:
<comment>PPP.config example uses class-level call instead of instance-level call</comment>
<file context>
@@ -70,8 +75,11 @@ Methods
+ Sets or gets parameters of the PPP interface. The only parameter that can be
+ retrieved and set is the underlying stream, using::
+
+ stream = PPP.config("stream")
+ PPP.config(stream=stream)
</file context>
| stream = PPP.config("stream") | |
| PPP.config(stream=stream) | |
| stream = ppp.config("stream") | |
| ppp.config(stream=stream) |
| @@ -0,0 +1,47 @@ | |||
| name: Setup ESP-IDF for CI | |||
There was a problem hiding this comment.
P2: Third-party GitHub Actions are pinned to mutable tags instead of immutable SHAs.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At .github/actions/setup_esp32/action.yml, line 22:
<comment>Third-party GitHub Actions are pinned to mutable tags instead of immutable SHAs.</comment>
<file context>
@@ -0,0 +1,47 @@
+
+ - name: Cached ESP-IDF install
+ id: cache_esp_idf
+ uses: actions/cache@v5
+ with:
+ path: |
</file context>
| ------- | ||
|
|
||
| .. method:: Timer.init(*, mode=Timer.PERIODIC, freq=-1, period=-1, callback=None) | ||
| .. method:: Timer.init(*, mode=Timer.PERIODIC, freq=-1, period=-1, callback=None, hard=True) |
There was a problem hiding this comment.
P2: Timer.init signature hard-codes hard=True but documentation text says default is port-specific, creating a contradiction.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At docs/library/machine.Timer.rst, line 52:
<comment>Timer.init signature hard-codes `hard=True` but documentation text says default is port-specific, creating a contradiction.</comment>
<file context>
@@ -4,41 +4,52 @@
-------
-.. method:: Timer.init(*, mode=Timer.PERIODIC, freq=-1, period=-1, callback=None)
+.. method:: Timer.init(*, mode=Timer.PERIODIC, freq=-1, period=-1, callback=None, hard=True)
Initialise the timer. Example::
</file context>
| letter represents a single 16 byte block of memory. Each line of | ||
| output represents 0x400 bytes or 1KiB of RAM. |
There was a problem hiding this comment.
P3: Verbose mem_info docs hard-code a 16-byte GC block and 1KiB line size, but both depend on port/architecture and are incorrect on non-32-bit builds.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At docs/library/micropython.rst, line 70:
<comment>Verbose mem_info docs hard-code a 16-byte GC block and 1KiB line size, but both depend on port/architecture and are incorrect on non-32-bit builds.</comment>
<file context>
@@ -62,8 +62,33 @@ Functions
+ free.
+
+ The exact output of verbose mode varies between ports, but in general each
+ letter represents a single 16 byte block of memory. Each line of
+ output represents 0x400 bytes or 1KiB of RAM.
+
</file context>
| letter represents a single 16 byte block of memory. Each line of | |
| output represents 0x400 bytes or 1KiB of RAM. | |
| letter represents a single GC block of memory. Each line of | |
| output represents 64 GC blocks (the exact byte count depends on the port). |
Why now
An open PR against
lvgl/lvgl(lvgl/lvgl#10106) needs MicroPython'sm_tracked_realloc, which landed upstream as commit18735dde3becfee023f3ecf33ff36cfe1c7f5cc3on 2026-04-08, afterv1.29.0-previewwas cut. The most recent tag therefore doesn't cover it, so this sync usesupstream/master(8ecd995041c2c65fd1d69f9f4b0bb763272d8f83) directly rather than a tag.What's included
Merges
micropython/micropythonmaster at8ecd995041c2c65fd1d69f9f4b0bb763272d8f83intolv_micropythonmaster. That's 2098 upstream commits since the last sync (v1.24.1, commit06ebf74c1), spanning 1.25, 1.26, 1.27, 1.28 and the in-development 1.29.The version bump is reflected in
py/mpconfig.h: 1.24.1 → 1.29.0-pre.Why master instead of a tag
m_tracked_reallocis not in any tag yet. Waiting for 1.29 to be cut is open-ended. The PR follows the historical pattern (merge upstream, no cherry-pick, no rebase) — just againstmasterrather than a tag.Conflict resolutions
15 files had conflicts. Trivial ones (additive blocks in different parts of the same file) were merged by taking both sides. The non-trivial ones:
.gitmodules— kept upstream's added alif submodules (alif_ensemble-cmsis-dfp,alif-security-toolkit), kept theuser_modules/lv_binding_micropythonentry, and adopted upstream'smicropython/nxp_driverURL. The previoushathach/nxp_driverURL was drift from before upstream's rename in v1.27.0 (commitbd7342d9e), not a deliberate local change..gitignore,.github/workflows/ruff.yml,ports/esp32/mpconfigport.h,py/misc.h— additive merges. The local LVGL define block inmpconfigport.h(MICROPY_ENABLE_SCHEDULER,MICROPY_MODULE_BUILTIN_INIT,MICROPY_PY_SYS_SETTRACE=0) and the local XC16 branch inmisc.hwere preserved alongside the upstream changes.extmod/network_cyw43.c— pure upstream addition (STA disconnect on inactive). Other recent cyw43 fixes were cherry-picked into both sides and converged cleanly.py/mpconfig.h— took upstream's version (1.29.0-pre).ports/esp32/machine_pwm.c,machine_touchpad.c— took upstream entirely. Upstream dropped ESP-IDF <v5.2 / <v5.3 support and rewrote both files. The lv_micropython local fixes were cherry-picks of fixes that landed upstream first and are now superseded.6201e77999), deleting mostpartitions-*.csvfiles and removingvfsentries from the survivors. Adopted upstream's layout. The lv_micropython local CSV adjustments (which enlarged app partitions for LVGL firmware) are obsolete under auto-detect. Follow-up needed: ESP32 LVGL board configs may need partition tweaks to fit the LVGL firmware size in the new layout.Testing
Built
ports/unixwithVARIANT=lvgl(this variant exists specifically to exercise the binding under the unix port). Build succeeds:Smoke test:
micropython -c 'import lvgl as lv; print(len(dir(lv)))'reports 560 attributes on thelvglmodule — module loads, binding exposes the LVGL API surface, no missing-symbol errors.Other ports were not built. ESP32 needs sdkconfig fix-ups for the new partition layout before its CI will be green; that's the main known regression to address as a follow-up.
Summary by cubic
Syncs this fork with upstream MicroPython master to bring in
m_tracked_reallocand all changes up to 1.29.0-pre, unblocking the LVGL binding work and modernizing CI/docs. Conflicts were resolved to keep LVGL-specific config anduser_modules/lv_binding_micropython; unixVARIANT=lvglbuilds and loadslvglsuccessfully.Dependencies
lib/nxp_drivertomicropython/nxp_driver; keptuser_modules/lv_binding_micropython.actions/*@v6; Windows matrix simplified; code style tools updated (ruff, codespell).Migration
partitions-*.csvand VFS entries. Update LVGL ESP32 board configs/partitions as needed to fit firmware.Written for commit 995cc14. Summary will update on new commits.