Update MicroPython to v1.29.0 - #11349
Conversation
Raises LookupError for not implemented error handlers. Improves repr() rendering for unicode. Signed-off-by: Jos Verlinde <Jos_Verlinde@hotmail.com>
Only accepts `utf-8`, `utf8` or `ascii` Fixes micropython#15849 Signed-off-by: Jos Verlinde <Jos_Verlinde@hotmail.com>
Fixes: issue 3364 Fixes: issue 13084 Signed-off-by: Jos Verlinde <jos_verlinde@hotmail.com>
Fixes Issue 17827 Signed-off-by: Jos Verlinde <Jos_Verlinde@hotmail.com>
Signed-off-by: Jos Verlinde <Jos_Verlinde@hotmail.com>
Signed-off-by: Jos Verlinde <Jos_Verlinde@hotmail.com>
Signed-off-by: Jos Verlinde <jos_verlinde@hotmail.com>
Signed-off-by: Jos Verlinde <jos_verlinde@hotmail.com>
Prevent the test from failing by not testing known unsupported characters. These will be documented in a cpydiff test. Signed-off-by: Jos Verlinde <jos_verlinde@hotmail.com>
Signed-off-by: Jos Verlinde <jos_verlinde@hotmail.com>
Signed-off-by: Jos Verlinde <Jos_Verlinde@hotmail.com>
Signed-off-by: Jos Verlinde <Jos_Verlinde@hotmail.com>
Signed-off-by: Jos Verlinde <Jos_Verlinde@hotmail.com>
Signed-off-by: Jos Verlinde <Jos_Verlinde@hotmail.com>
These are now printed as characters rather than escaped bytes. Signed-off-by: Jos Verlinde <jos_verlinde@hotmail.com>
Three tests are rewritten using unittest, so that they don't need to be run under CPython to get the expected output. Because running under CPython requires port 8000 to be available, which it may not (at least for tests in the extmod directory having a port available should not be a requirement). Signed-off-by: Damien George <damien@micropython.org>
Similar to the parent commit, this means CPython doesn't need to run to get the expected output, and means port 8000 doesn't need to be available. Signed-off-by: Damien George <damien@micropython.org>
MicroPython allows unicode to be disabled to reduce firmware size, in which case str objects are essentially the same as bytes objects when it comes to code points between 128 and 255. But that behaviour has subtle differences to when unicode is enabled, eg string lengths can be different. Since unicode strings are arguably an important feature of Python, and users would likely be tripped up with it disabled, this commit changes the default level at which unicode is enabled from "extra" down to "basic". Costs about +1600 bytes on ARM Cortex-M targets. Signed-off-by: Damien George <damien@micropython.org>
The following ports use the extra or full ROM feature level, and so implicitly enable unicode as well as bytes decode errors: alif, esp32, esp8266, mimxrt, qemu, renesas-ra, rp2, samd (SAMD51 only), stm32, unix and webassembly. (Note that the stm32 board B_L072Z_LRWAN1 explicitly uses the core feature level and so disables unicode.) The following ports use the basic ROM feature level, and so implicitly enable unicode (but now bytes decode errors): samd (SAMD21) and zephyr. The following ports use the core ROM feature level, and explicitly enable unicode: cc3200, nrf and windows. The bare-arm and minimal ports use the minimum ROM feature level and do not enable unicode (similarly for minimal unix and zephyr variants). Signed-off-by: Damien George <damien@micropython.org>
Signed-off-by: Matt Trentini <matt.trentini@gmail.com>
Signed-off-by: o-murphy <thehelixpg@gmail.com>
Can be used with QEMU. Signed-off-by: Mikhail Zakharov <mzakharo@gmail.com>
Add support for C3 target to run on QEMU emulator with LAN networking
support.
Build and run via:
make BOARD=ESP32_GENERIC_C3 BOARD_VARIANT=QEMU qemu
Signed-off-by: Mikhail Zakharov <mzakharo@gmail.com>
Initialise mDNS on IP_EVENT_ETH_GOT_IP, inside the existing eth_event_handler(). This fixes mDNS hostname resolution when WiFi is disabled and only Ethernet is used. The mdns_initialised flag is shared with network_wlan.c (made non-static there), so a single mdns_init() runs even when both interfaces are present. Signed-off-by: jetpax <jep@alphabetiq.com>
It does not build due to dependencies on the `WIFI_EVENT` symbol. Signed-off-by: Damien George <damien@micropython.org>
Some recent additions -- such as `pulse_width_us`, `pulse_width_ns`, WWDG support and improved Unicode -- have increased stm32 firmware by about 1.5k. All up, that made that the internal flash of PYBD_SF3 overflow by about 80 bytes. Following on from 702f15a, this commit moves all machine-code-based emitter functions from internal to external QSPI flash. That frees up about 13k internal flash, and shouldn't affect performance. Signed-off-by: Damien George <damien@micropython.org>
This commit fixes a regression introduced in dd476ce, that was meant to fix native modules' entry trampolines for x86/x64 when built with Clang. Unfortunately it broke things for almost every other platform, and this was not caught by the QEMU-based CI infrastructure. These changes aim to fix that situation by rearranging the way offset are calculated for all architecture. These changes also address a potential issue that may arise if there's a mismatch in trampoline length due to different opcode sequences being emitted. Signed-off-by: Alessandro Gatti <a.gatti@frob.it>
Allowing it to fit into the flash. The dropped features are available for SAMD21 boards with external flash. Affected feature: - MICROPY_PY_BUILTINS_HELP_MODULES - MICROPY_PY_HEAPQ - MICROPY_PY_GENERATOR_PEND_THROW - MICROPY_ENABLE_SOURCE_LINE Signed-off-by: robert-hh <robert@hammelrath.com>
It is the tightest on flash. Signed-off-by: robert-hh <robert@hammelrath.com>
Signed-off-by: massimosala <massimo.sala.71@gmail.com>
Follow-up to b35383b which fixed one test setup race, but seemed to introduce failures - at least intermittently on some stm32 test configs. Guessing at a root cause: the 100ms sleep may not have been enough for the host to always coordinate instances, in which case instance1 might start sending onto the bus before instance0. Fix is to add an explicit synchronisation point so instance1 doesn't try to send until after instance0 has definitely started "babbling". This work was funded through GitHub Sponsors. Signed-off-by: Angus Gratton <angus@redyak.com.au>
This commit extracts the parts in common across linkerscripts targeting Cortex-M processors after being made memory section-neutral, and adapts other linkerscripts to use the shared parts. All Cortex-M linkerscripts ended up having the same sections duplicated in their respective files, but with minimum changes. With these changes a new Cortex-M target can reuse all of the shared directives, so bring-up time is reduced. Signed-off-by: Alessandro Gatti <a.gatti@frob.it>
This commit extracts the parts in common across linkerscripts targeting RISC-V processors for QEMU's VIRT target after being made register size independent, and adapts other linkerscripts to use the shared parts. All RISC-V linkerscripts present in this port ended up having the same sections duplicated in their respective files, but with minimum changes. With these changes a new RISC-V target can reuse all of the shared directives, so bring-up time is reduced. Signed-off-by: Alessandro Gatti <a.gatti@frob.it>
Name PD6 (header pin P10) FSYNC. The camera driver normally drives this pin as a trigger output, but the sensor can also be configured to output its exposure strobe on it, in which case scripts need to attach a pin interrupt to it to timestamp when the camera actually triggers. Signed-off-by: Kwabena W. Agyeman <kwagyeman@live.com>
Name P13_0 FSYNC. The camera driver normally drives this pin as a trigger output, but the sensor can also be configured to output its exposure strobe on it. The pin is not externally accessible on this board, so naming it is the only way scripts can attach a pin interrupt to it to timestamp when the camera actually triggers. Signed-off-by: Kwabena W. Agyeman <kwagyeman@live.com>
Commit 570744d introduced a regression when using `from foo import *`: if the module used `__getattr__` and raised an `AttributeError` when doing `__getattr__("__all__")` then that exception would be raised up to the caller of the import, rather than being ignored. This commit fixes that by protecting the lookup of "__all__". Tests are added which makes sure the behaviour matches CPython. Fixes issue micropython#19265. Signed-off-by: Damien George <damien@micropython.org>
CPython specifies the return of `os.stat()` as a `os.stat_result` instance, but MicroPython allows a 10-tuple for simplicity. The latest version of micropython-lib's `os` extension module now returns a `namedtuple` for `os.stat()`. Update the vfs test to accommodate both a 10-tuple and a `namedtuple`. Signed-off-by: Damien George <damien@micropython.org>
This update to micropython-lib brings in the following changes. aioble/security: only schedule save when needed aiohttp: match response header names case-insensitively aiorepl: - fix Enter key handling in raw terminal mode - optimize sys.stdout.write calls collections-defaultdict: add items() function colorsys: add colorsys and test_colorsys from CPython copy: provide top-level documentation lora: fix CRC error IRQ bit mask for sx126x mip: add an alias for codeberg repos ntptime: use NTPv4 operator: add mul and some other operators os: provide namedtuple response for os.stat() pathlib: - fix glob/rglob to return Path objects rather than strings - add Path.expanduser() pprint: - add simple and partial implementation for depth of 1 - refactor implementation and add PrettyPrint class - implement depth recursion - add test_pprint.py - fix use of micropython.const - bump version to 0.1.0 requests: - add context manager for response object - switch to HTTP/1.1 with Content-Length and raw streaming - add support for relative redirect URLs - support unicode in json and data payloads - add support for query and anchor chars directly after domain - add tests for query and anchor in URL - add chunked response body support - test chunked response decoding - document chunked response support - match response header names case-insensitively - reuse lowerl for Content-Length matching ssd1306: add I2C protocol example for SSD1306 display uaiohttpclient: - use "utf8" encoding instead of "latin-1" - add basic test for uaiohttpclient.request umqtt.robust: - let reconnect() call the connect() method of parent class - document and add examples overriding the connect() method - ease document readability umqtt.simple: - add example for mqtt tls - close any old socket on connect - add call to main() at end of example scripts - encode subscribe Remaining Length as VBI - share subscribe/unsubscribe packet encoding - share Remaining Length VBI encoding - avoid None comparisons in _send_subunsub unittest: - remove f-strings - optimise by reusing AssertRaisesContext for assertWarns - optimise by removing support for CPython - optimise calling of _handle_test_exception - optimise by only formatting msg if needed - optimise skipUnless in terms of skipIf - optimise to only create a single nop lambda - bump minor version due to recent optimisations unix-ffi: - json: fix json.loads() of a bytes object - ffilib: extend libc versions range - signal: add alarm() and pause() functions - signal: add SIGALRM constant usb: - examples: put timeout=0 in CDCInterface constructor - usb-device-cdc: fix default timeout in CDCInterface.init() - usb-device-cdc: optimise CDCInterface constructor - usb-device-core: fix comment describing the signature of done_cb - usb-device-hid: enable configuring the bInterval on hid devices - usb-device-keyboard: add a simpler keyboard example, document releasing uuid: - provide UUID class and uuid4() implementation using os.urandom() - convert test to use unittest - use bytes.hex instead of binascii.hexlify - add UUID.bytes attribute - make UUID.__repr__ match CPython Signed-off-by: Damien George <damien@micropython.org>
Adds TinyUSB configuration and descriptor support for USB Network Control Model (NCM) interface. This provides the low-level USB infrastructure needed for USB networking. Signed-off-by: Andrew Leech <andrew.leech@planetinnovation.com.au>
Implements a USB NCM driver providing ethernet-over-USB backed by the lwIP stack. Reuses MicroPython's string hash over the MAC address to derive a deterministic link-local IP (169.254.x.1), a built-in DHCP server so the host is immediately reachable, and full lwIP netif integration including IPv6 support. Exposes a Python network.USBD_NCM class compatible with the AbstractNIC interface. Signed-off-by: Andrew Leech <andrew@alelec.net>
Signed-off-by: Damien George <damien@micropython.org>
Continues the merge-commit style used for v1.28.0 in adafruit#11334, and is based on that branch. The merge base here is therefore v1.28.0, and this replays 733 upstream commits rather than the 1350 the previous merge faced. This depends on adafruit#11334 landing first. v1.28.0 is not yet an ancestor of main, so against main as it stands the merge base would fall back to v1.25.0 and the conflict set would be far larger. Content summary: - 84 files added, 36 removed, 208 modified, 22 renamed - 58 files under py/ touched - 71 new upstream test and doc files kept - tests/frozen renamed to tests/assets, following upstream - 173 stray MicroPython files removed: ports/psoc-edge, zephyr, qemu, samd, mimxrt, stm32, nrf and esp32, plus lib/psoc-edge, docs/psoc-edge, tests/ports, tests/net_inet, tests/multi_net and tests/multi_espnow. These arrive without conflicting, because deleting a directory does not stop upstream from adding new files inside it. Notable resolutions: - py/binary.c takes upstream's structure with OVERFLOW_CHECKS defined to 1, so CircuitPython keeps raising OverflowError where MicroPython V1.x truncates. mp_binary_set_val_array is byte identical to upstream. - py/objint.c drops mp_obj_int_buffer_overflow_check, which has no callers left, and mp_small_int_buffer_overflow_check now delegates to upstream's implementation in py/objint_impl.h. Overflow messages take upstream's wording, and negative values passed to an unsigned buffer now report "can't convert negative int to unsigned", matching CPython. locale/circuitpython.pot is regenerated. - py/objstrunicode.c keeps CircuitPython's CPython compatible escaping and adds upstream's surrogate and out of range branches. - py/gc.c keeps MICROPY_ENABLE_SELECTIVE_COLLECT and takes upstream's gc_verify_ptr_get_area bounds check. - py/mkrules.mk drops the frozen content rule that upstream moved to py/manifest.mk. FROZEN_MANIFEST is restored as a prerequisite there, because CircuitPython generates its manifest into $(BUILD) during the build. - extmod/vfs_blockdev.c keeps CircuitPython's native block device signatures under upstream's new MICROPY_VFS_BLOCKDEV_NATIVE gate, enabled in py/circuitpy_mpconfig.h. - py/makeqstrdefs.py keeps every preprocessor file marker. Upstream's new filter drops the markers that CircuitPython's MP_COMPRESSED_ROM_TEXT pass needs to attribute strings found in headers. - ports/raspberrypi/sdk keeps CircuitPython's pico-sdk pin. Rename detection pairs it with upstream's lib/pico-sdk, which would otherwise bump it. - py/nlr.h gains a MICROPY_NLR_LOONG64 default and shared/libc/string0.c includes stdlib.h for the atoi prototype, both needed by CircuitPython's -Werror settings. Every CIRCUITPY-CHANGE deviation is accounted for. Two are gone because upstream adopted them, in py/emitglue.c cache flush selection and in signed int.to_bytes support. Three moved to the files the code moved to. Tested with the unix coverage build: 979 tests pass, 28782 individual test cases. Metro M4 AirLift Lite builds clean. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
…ealloc Upstream's dc0b2c7 added m_tracked_realloc using the same pointer arithmetic that m_tracked_free does 30 lines below. CircuitPython already launders that through (void *) there, because py/circuitpy_defns.mk enables -Wcast-align with -Werror. The new function arrived without it, so any board with MICROPY_TRACKED_ALLOC on fails to compile py/malloc.c. MICROPY_TRACKED_ALLOC is CIRCUITPY_SSL_MBEDTLS || CIRCUITPY_HASHLIB_MBEDTLS_ONLY, so this hits every board with mbedtls SSL or hashlib, not just espressif. Found by building ports/espressif for Metro ESP32-S2. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Upstream v1.29 centralised deriving CXXFLAGS from CFLAGS in py/mkrules.mk (c080565). Its filter-out list covers upstream's C-only flags, but CircuitPython enables more of them: -Wstrict-prototypes, -Werror-implicit-function-declaration and -Wnested-externs in py/circuitpy_defns.mk, and -Werror=missing-prototypes in each port's own Makefile. g++ reports each as valid for C but not C++, and -Werror makes them fatal. ports/raspberrypi already derived CXXFLAGS the same way in its own Makefile, so the new central line appended CFLAGS a second time and reintroduced the flags its local filter had removed. That broke common-hal/sdioio/sdfat_pio/shim.o on Metro RP2040 and Metro RP2350. Widen the central filter to cover CircuitPython's flags, and drop the now redundant derivation from ports/raspberrypi/Makefile so C++ translation units get CFLAGS once rather than twice. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Upstream v1.29 added MICROPY_PY_LWIP_SOCK_RAW (7c1f1c4) with an ifndef default of MICROPY_PY_LWIP, which is 0 here. CircuitPython has defined it to 1 in common-hal/socketpool/Socket.c since ff77314, which now redefines the macro and is fatal under -Werror during qstr preprocessing on Pico 2 W. py/mpconfig.h includes mpconfigport.h before applying its defaults, so setting it there lets upstream's guard skip. The value every use sees is unchanged. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Seven small cleanups from a pre-submission audit, no behaviour change: - ports/raspberrypi/common-hal/socketpool/Socket.c: drop the double blank line left where MICROPY_PY_LWIP_SOCK_RAW was defined before it moved to mpconfigport.h - ports/raspberrypi/mpconfigport.h, py/objint.c: cut comments that restated the commit message; the reason stays, the change history goes to git - ports/unix/variants/coverage/manifest.py: drop a trailing comment explaining an absence - tests/feature_check/target_info.py: len(message or "") cannot differ from len(message), since message is already "" when er.args is empty - py/mkrules.mk: alphabetize the filter-out list and add -Werror=old-style-definition, which eight ports set and which would break the first of them to gain a C++ source - py/circuitpy_mpconfig.h: move MICROPY_VFS_BLOCKDEV_NATIVE below MICROPY_VFS so the three defines that derive from MICROPY_VFS stay contiguous 979/979 unix coverage tests pass, unchanged. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
…gecommit # Conflicts: # py/emitglue.c
docs/index.rst: the merge resolution dropped the body of the "Indices and tables" section, leaving a truncated underline and no trailing newline. The file is byte-identical to main again. This also fixes the readthedocs build, which failed on the malformed section. tests/multi_extmod/machine_can_08_init_mode.py: codespell flags "accpeted" in a test file that is new in v1.29. Both were caught by CI on adafruit#11349. pre-commit now runs clean locally with the uncrustify build tools/ci.sh pins, micropython-uncrustify==1.0.0.post1. The Ubuntu package is a different version and rewrites files no branch touched. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
…gecommit # Conflicts: # py/emitglue.c
CircuitPython's traceback deviation in this test re-raises with a bare "raise", which is raise_varargs with no argument. The native emitter does not implement that, and run-tests.py already skips three other tests for exactly this reason. It passed before only by accident. v1.28's emit_native_raise_varargs had assert(n_args == 1) with (void)n_args, so a release build compiled the assert out and fell through. v1.29 replaced the assert with a real NotImplementedError, which is the correct behaviour and surfaced the problem. 979/979 default emit, 963/963 native emit. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
CircuitPython carries none of these directories, but each of these files is new in v1.29, so the merge added them with no CircuitPython-side deletion to conflict against. None exist on main and nothing references them. docs/library/network.USBD_NCM.rst is the one with visible fallout: it is in no toctree, and the docs build treats that warning as an error, which also failed the readthedocs build. extmod/network_usbd_ncm.h is an orphan header whose .c was correctly dropped. Also removed: drivers/esp-hosted/esp_hosted_queue.h, examples/rp2/pio_quadrature_encoder.py, docs/reference/romfs.rst, docs/reference/unicode_support.rst, and five files under tools/mpremote/tests. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
dhalbert
left a comment
There was a problem hiding this comment.
This looks good. MicroPython added optional overflow checks in certain places where only we were doing it before. They also implemented a few things themselves which we had done already, so now we can use their code.
@mikeysklar Do you have more to do? I am not marking Approved yet in case you do.
|
I found a hang on the ESP32-{s2 and s3} while doing farm testing. It is a known regression with micropython 1.29. Considering options for this one. |
|
Boards tested at the tip, 57d1239
ESP32-S2/S3 raw-REPL paste corruption. Pre-existing tinyusb race, espressif only, more frequent with each MicroPython update. Documenting here; fix is a separate PR.
Same harness, 40 tests per iteration, 50 iterations, 2000 pastes per row. A failure is a parse error at a test-specific line; byte count preserved, one 64-byte packet lost and the next repeated.
The paste path is byte-identical across the three S3 firmwares. The rate tracks timing, not a code change in this PR. |
…gecommit Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
docs/library/builtins.rst from MicroPython v1.29 contains a literal U+FFFD replacement character, which pdflatex cannot typeset, so latexpdf stopped with a fatal error. Map it in the preamble instead of changing the upstream text. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Turn off one module on each board whose ja or ru build no longer fits: MSGPACK on the M4 and nRF52840 boards, ERRNO on kicksat-sprite, and USB_MIDI on the Pixel Trinkey M0. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Merges MicroPython v1.29.0 as a real merge commit, the same way #11334 did v1.28.0.
#11334 is merged, so this is based on main.
What
733 upstream commits, 350 files, +8247/-1904. Every CIRCUITPY-CHANGE deviation preserved.
Markers go 1017 to 1014:
Hardware tested
Nine boards at 57d1239, results in this comment. Later commits touch no farm board.
Also 979/979 unix coverage tests and
make check-translate. Raw sockets verified on Pico 2 W before and after 421ac8a, which restoresMICROPY_PY_LWIP_SOCK_RAWon rp2350.Follow-up commits
main(42af95d)builtins.rsthas a literal U+FFFD, which broke the LaTeX PDF build. Mapped in theconf.pypreamblejaorru(table under Flash)One behaviour change
extmod/vfs_blockdev.cstops treating a bool return from a Python block device as success. This is upstream's own revert in 18349f2, not a dropped deviation. CircuitPython's bindings document-> None, so they are unaffected.Flash
Metro M0 Express, 253,696 byte firmware region, all 21 languages built at both commits. The merge costs 368 to 528 bytes and every language still links. Tightest five, free bytes:
plelzh_Latn_pinyinde_DEcsThese 12 boards overflowed in CI. Each turns off one module, following earlier shrink commits.
ruUSB_MIDIruERRNOjaMSGPACKjaMSGPACKjaMSGPACKjaMSGPACKjaMSGPACKjaMSGPACKjaMSGPACKjaMSGPACKjaMSGPACKjaMSGPACKPerformance
No claim. On RP2,
bm_pidigitstracks where code lands in XIP flash rather than the merge. Padding a function the benchmark never calls moves a single commit's score by up to 22%.Open items
circuitpython.potchanged. No.powas regenerated, so the 9 new msgids fall back to English in all 21 languages.py/makeqstrdefs.pykeeps every#linemarker rather than upstream'srecent_filefiltering, becauseMP_COMPRESSED_ROM_TEXTneeds markers for strings found in headers. A narrower fix would be better.pre-commit,uncrustifyandruffare not installed on my build host. Thepre-commitCI job passes.zephyr-tests / nrf5340bsimBLE tests are flaky. The same Zephyr firmware passed at 8d2e580, and the job also failed on main at b616596.AI assistance
Written with Claude Code. The hardware and benchmark numbers are mine, measured on the boards listed, not model output. Two claims I made earlier were wrong and were retracted by measurement: a v1.29 performance regression that turned out to be code layout, and a suspected cause in micropython/micropython@5f2181f938, which was tested on two boards and cleared.
🤖 Generated with Claude Code