summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2025-07-23esp32: Update to use ESP-IDF v5.4.2.Damien George
This is a patch release of the IDF. Comparing with 5.4.1, firmware size is up by about 1.5k on ESP32 and 9k on ESP32-S3. But IRAM usage (of the IDF) is down by about 500 byte on ESP32 and DRAM usage is down by about 20k on ESP32 and 10k on ESP32-S3. Testing on ESP32, ESP32-S2, ESP32-S3 and ESP32-C3 shows no regressions, except in BLE MTU ordering (the MTU exchange event occuring before the connect event). Signed-off-by: Damien George <damien@micropython.org>
2025-07-23tests/extmod_hardware/machine_uart_irq_break.py: Remove send_uart.Damien George
This is no longer needed, the esp32 port can now pass this test using just a single UART. Signed-off-by: Damien George <damien@micropython.org>
2025-07-23esp32/machine_uart: Improve sendbreak so it doesn't reconfig the UART.Damien George
Currently, `UART.sendbreak()` on esp32 will reconfigure the UART to a slower baudrate and send out a null byte, to synthesise a break condition. That's not great because it changes the baudrate of the RX path as well, which could miss incoming bytes while sending the break. This commit changes the sendbreak implementation to just reconfigure the TX pin as GPIO in output mode, and hold the pin low for the required duration. Signed-off-by: Damien George <damien@micropython.org>
2025-07-23tests/run-tests.py: Use TEST_TIMEOUT as timeout for bare-metal tests.Damien George
This parameter is already used for PC-based tests (eg unix and webassembly ports), and it makes sense for it to be used for bare-metal ports as well. That way the timeout is configurable for all targets. Because this increases the default timeout from 10s to 30s, this fixes some long-running tests that would previously fail due to a timeout such as `thread/stress_aes.py` on ESP32. Signed-off-by: Damien George <damien@micropython.org>
2025-07-23tools/pyboard.py: Add timeout argument to Pyboard.exec_/exec.Damien George
Signed-off-by: Damien George <damien@micropython.org>
2025-07-23tests/net_inet: Update micropython.org certificate for SSL tests.Damien George
Signed-off-by: Damien George <damien@micropython.org>
2025-07-23tools/ci.sh: Change averaging to 1 for run-perfbench.py test.Damien George
The `run-perfbench.py` test is run as part of CI, but the actual performance results are not used. Rather, the test is just testing that all the performance tests run correctly. So there's no need to run with the default averaging of 8 (which runs each test 8 times and takes the average time for the performance result) which can take a lot of time for slower builds, eg unix sanitize, settrace and stackless builds. This commit changes the averaging to just 1. Signed-off-by: Damien George <damien@micropython.org>
2025-07-23docs/reference/speed_python: Document schedule/GIL limitation of native.Damien George
Signed-off-by: Damien George <damien@micropython.org>
2025-07-23tests/thread: Allow thread tests to pass with the native emitter.Damien George
The native emitter will not release/bounce the GIL when running code, so if it runs tight loops then no other threads get a chance to run (if the GIL is enabled). So for the thread tests, explicitly include a call to `time.sleep(0)` (or equivalent) to bounce the GIL and give other threads a chance to run. For some tests (eg `thread_coop.py`) the whole point of the test is to test that the GIL is correctly bounced. So for those cases force the use of the bytecode emitter for the busy functions. Signed-off-by: Damien George <damien@micropython.org>
2025-07-23github/workflows: Add new CI job to test unix port with GIL enabled.Damien George
Signed-off-by: Damien George <damien@micropython.org>
2025-07-23unix: Allow the GIL to be enabled.Damien George
The unix port can now be built with the GIL enabled, by passing MICROPY_PY_THREAD_GIL=1 on the make command line. Signed-off-by: Damien George <damien@micropython.org>
2025-07-23tools/ci.sh: Skip thread/stress_recurse.py on unix qemu test runs.Damien George
This test passes sometimes and fails other times. Eventually that should be fixed, but for now just skip this test. Signed-off-by: Damien George <damien@micropython.org>
2025-07-23tools/ci.sh: Skip thread/stress_heap.py test on macOS test run.Damien George
This test passes sometimes and fails other times. Eventually that should be fixed, but for now just skip this test. Signed-off-by: Damien George <damien@micropython.org>
2025-07-23tools/ci.sh: Increase timeout for stackless clang test runs.Damien George
Stackless mode makes `tests/thread/stress_aes.py` slow, around 75 seconds for this CI job (probably due to contention among the many threads for the GC lock, to allocate frames for function calls). So increase the timeout to allow this test to pass. Signed-off-by: Damien George <damien@micropython.org>
2025-07-23tools/ci.sh: Increase timeout for unix qemu test runs.Damien George
The qemu emulation introduces enough overhead that the `tests/thread/stress_aes.py` test overruns the default timeout. So increase it to allow this test to pass. Signed-off-by: Damien George <damien@micropython.org>
2025-07-23tests/run-tests.py: Detect threading and automatically run thread tests.Damien George
When detecting the target platform, also check if it has threading and whether the GIL is enabled or not (using the new attribute `sys.implementation._thread`). If threading is available, add the thread tests to the set of tests to run (unless the set of tests is explicitly given). With this change, the unix port no longer needs to explicitly run the set of thread tests, so that line has been removed from the Makefile. This change will make sure thread tests are run with other testing combinations. In particular, thread tests are now run: - on the unix port with the native emitter - on macOS builds - on unix qemu, the architectures MIPS, ARM and RISCV-64 Signed-off-by: Damien George <damien@micropython.org>
2025-07-23tests/thread/stress_aes.py: Reduce test time on PC targets.Damien George
This thread stress test is quite intensive and can run for a long time on certain targets. For example, builds with stackless enabled are slower than non-stackless, and this test in stackless mode takes around 2 minutes on the unix port of MicroPython with the existing parameters of `n_thread=20` and `n_loop=5`. It's not really necessary to test 20 threads at once, that's not really going to test anything more than 10 at once. So reduce the parameters to keep the running time reasonable. Signed-off-by: Damien George <damien@micropython.org>
2025-07-22tests/extmod/select_poll_eintr.py: Pre-allocate global variables.Damien George
This is a workaround for the case where threading is enabled without a GIL. In such a configuration, creating a new global variable is not atomic and threads have race conditions resizing/accessing the global dict. Signed-off-by: Damien George <damien@micropython.org>
2025-07-22py/modsys: Add sys.implementation._thread attribute.Damien George
This is useful to distinguish between GIL and non-GIL builds. Signed-off-by: Damien George <damien@micropython.org>
2025-07-20docs/develop/natmod: Add notes on Picolibc and natmods.Alessandro Gatti
This commit adds some documentation on what are the limitations of using Picolibc as a standard C library for native modules. This also contains a reference to the "errno" issue when building natmods on RV32 that the PR this commit is part of, as it is not obvious how to approach this issue when encountered for the first time. Signed-off-by: Alessandro Gatti <a.gatti@frob.it>
2025-07-20examples/natmod/btree: Fix build on RV32 with Picolibc.Alessandro Gatti
This commit fixes building the "btree" example natmod on RV32 when Picolibc is being used and uses thread-local storage for storing the errno variable. The fix is surprisingly simple: Picolibc allows overriding the function that will provide a pointer to the "errno" variable, and the btree natmod integration code already has all of this machinery set up as part of its library integration. Redirecting Picolibc to the already existing pointer provider function via a compile-time definition is enough to let the module compile and pass QEMU tests. This workaround will work on any Picolibc versions (Arm, RV32, Xtensa, etc.) even if TLS support was not enabled to begin with, and will effectively do nothing if the toolchain used will rely on Newlib to provide standard C library functions. Given that the btree module now builds and passes the relevant natmod tests, said module is now part of the QEMU port's natmod testing procedure, and CI now will build the btree module for RV32 as part to its checks. Signed-off-by: Alessandro Gatti <a.gatti@frob.it>
2025-07-20tools/pyboard.py: Align execpty prefix.Yanfeng Liu
This aligns the prefix string in L285 to that in L284 though the two strings have equal length. Signed-off-by: Yanfeng Liu <yfliu2008@qq.com>
2025-07-20py/mkrules.mk: Mute blobless errors.Yanfeng Liu
This mutes usage error for blobless update from older `git` to reduce noise upon submodule updating. Signed-off-by: Yanfeng Liu <yfliu2008@qq.com>
2025-07-18py/objcode: Remove co_lnotab from v2 preview.Anson Mansfield
Signed-off-by: Anson Mansfield <amansfield@mantaro.com>
2025-07-18tests/basics/fun_code_lnotab: Test removal of co_lnotab from v2.Anson Mansfield
Signed-off-by: Anson Mansfield <amansfield@mantaro.com>
2025-07-18py/parsenum: Extend mp_parse_num_integer() to parse long long.Angus Gratton
If big integer support is 'long long' then mp_parse_num_integer() can parse to it directly instead of failing over from small int. This means strtoll() is no longer pulled in, and fixes some bugs parsing long long integers (i.e. can now parse negative values correctly, can now parse values which aren't NULL terminated). The (default) smallint parsing compiled code should stay the same here, macros and a typedef are used to abstract some parts of it out. When bigint is long long we parse to 'unsigned long long' first (to avoid the code size hit of pulling in signed 64-bit math routines) and the convert to signed at the end. One tricky case this routine correctly overflows on is int("9223372036854775808") which is one more than LLONG_MAX in decimal. No unit test case added for this as it's too hard to detect 64-bit long integer mode. This work was funded through GitHub Sponsors. Signed-off-by: Angus Gratton <angus@redyak.com.au>
2025-07-18py/smallint: Update mp_small_int_mul_overflow() to perform the multiply.Angus Gratton
Makes it compatible with the __builtin_mul_overflow() syntax, used in follow-up commit. Includes optimisation in runtime.c to minimise the code size impact from additional param. Signed-off-by: Damien George <damien@micropython.org> Signed-off-by: Angus Gratton <angus@redyak.com.au>
2025-07-18py/objint_longlong: Add arithmetic overflow checks.Angus Gratton
Long long big integer support now raises an exception on overflow rather than returning an undefined result. Also adds an error when shifting by a negative value. The new arithmetic checks are added in the misc.h header. This work was funded through GitHub Sponsors. Signed-off-by: Angus Gratton <angus@redyak.com.au>
2025-07-18tests: Skip bm_pidigits perf test if no arbitrary precision int support.Angus Gratton
The other performance tests run and pass with only 64-bit big integer support. This work was funded through GitHub Sponsors. Signed-off-by: Angus Gratton <angus@redyak.com.au>
2025-07-18tests/thread: Rename thread_lock4 test to thread_lock4_intbig.Angus Gratton
Relies on arbitrary precision math, so won't run on a port which has threads & limited bigint support. This work was funded through GitHub Sponsors. Signed-off-by: Angus Gratton <angus@redyak.com.au>
2025-07-18unix/variants: Add a 'longlong' variant to test 64-bit bigints in CI.Angus Gratton
Signed-off-by: Angus Gratton <angus@redyak.com.au>
2025-07-18tests/extmod/json_loads_int_64.py: Add test cases for LONGINT parse.Angus Gratton
These tests cover the use of mp_obj_new_int_from_str_len when mp_parse_num_integer overflows the SMALLINT limit, and also the case where the value may not be null terminated. Placed in a separate test file so that extmod/json test doesn't rely on bigint support. Signed-off-by: Yoctopuce dev <dev@yoctopuce.com> Signed-off-by: Angus Gratton <angus@redyak.com.au>
2025-07-18tests: Add specific tests for "long long" 64-bit bigints.Angus Gratton
These will run on all ports which support them, but importantly they'll also run on ports that don't support arbitrary precision but do support 64-bit long ints. Includes some test workarounds to account for things which will overflow once "long long" big integers overflow (added in follow-up commit): - uctypes_array_load_store test was failing already, now won't parse. - all the ffi_int tests contain 64-bit unsigned values, that won't parse as long long. This work was funded through GitHub Sponsors. Signed-off-by: Angus Gratton <angus@redyak.com.au>
2025-07-17webassembly/objpyproxy: Avoid throwing on implicit symbols access.webreflection
This commit improves get handling by guarding against implicit unknown symbols accessed directly by specific JS native APIs. Fixes issue #17657. Signed-off-by: Andrea Giammarchi <andrea.giammarchi@gmail.com>
2025-07-17examples/rp2/pio_uart_rx.py: Fix use of PIO constants.Anson Mansfield
Running the unmodified `pio_uart_rx.py` example by uploading the file and importing it doesn't succeed, and instead emits a NameError at line 26. Signed-off-by: Anson Mansfield <amansfield@mantaro.com>
2025-07-17rp2/mpnetworkport: Deregister all sys timeouts when netif is removed.Damien George
When mDNS is active on a netif it registers a lot of timeouts, namely: mdns_probe_and_announce mdns_handle_tc_question mdns_multicast_probe_timeout_reset_ipv4 mdns_multicast_timeout_25ttl_reset_ipv4 mdns_multicast_timeout_reset_ipv4 mdns_send_multicast_msg_delayed_ipv4 mdns_send_unicast_msg_delayed_ipv4 mdns_multicast_probe_timeout_reset_ipv6 mdns_multicast_timeout_25ttl_reset_ipv6 mdns_multicast_timeout_reset_ipv6 mdns_send_multicast_msg_delayed_ipv6 mdns_send_unicast_msg_delayed_ipv6 These may still be active after a netif is removed, and if they are called they will find that the mDNS state pointer in the netif is NULL and they will crash. These functions could be explicitly removed using `sys_untimeout()`, but `mdns_handle_tc_question()` is static so it's not possible to access it. Instead use the new `sys_untimeout_all_with_arg()` helper to deregister all timeout callbacks when a netif is removed. Fixes issue #17621. Signed-off-by: Damien George <damien@micropython.org>
2025-07-17extmod/network_lwip: Add sys_untimeout_all_with_arg helper function.Damien George
Really lwIP should provide this, to deregister all callbacks on the given netif. Signed-off-by: Damien George <damien@micropython.org>
2025-07-17alif/lwip_inc: Refactor lwipopts.h to use extmod's common options.Damien George
This change is a no-op for the firmware. Signed-off-by: Damien George <damien@micropython.org>
2025-07-16unix/coverage: Expand mp_printf coverage tests.Jeff Epler
Test 'l' and 'll' sized objects. When the platform's `mp_int_t` is not 64 bits, dummy values are printed instead so the test result can match across all platforms. Ensure hex test values have a letter so 'x' vs 'X' is tested. And test 'p' and 'P' pointer printing. Signed-off-by: Jeff Epler <jepler@gmail.com>
2025-07-16py/mpprint: Rework integer vararg handling.Jeff Epler
This adds support for %llx (needed by XINT_FMT for printing cell objects) and incidentally support for capitalized output of %P. It also reduces code size due to the common handling of all integers. Signed-off-by: Jeff Epler <jepler@gmail.com>
2025-07-16py/vm: Avoid heap-allocating slices when subscripting built-ins.Jim Mussared
This commit adds a fast-path optimisation for when a BUILD_SLICE is immediately followed by a LOAD/STORE_SUBSCR for a native type, to avoid needing to allocate the slice on the heap. In some cases (e.g. `a[1:3] = x`) this can result in no allocations at all. We can't do this for instance types because the get/set/delattr implementation may keep a reference to the slice. Adds more tests to the basic slice tests to ensure that a stack-allocated slice never makes it to Python, and also a heapalloc test that verifies (when using bytecode) that assigning to a slice is no-alloc. This work was funded through GitHub Sponsors. Signed-off-by: Jim Mussared <jim.mussared@gmail.com> Signed-off-by: Damien George <damien@micropython.org>
2025-07-15unix/Makefile: Drop include path of "i686-linux-gnu".Yanfeng Liu
This drops use of non-existing path `/usr/include/i686-linux-gnu` as default include paths shall suffice. Signed-off-by: Yanfeng Liu <yfliu2008@qq.com>
2025-07-15tests/extmod: Close UDP sockets at end of test.Yanfeng Liu
This adds call to release UDP port in a timely manner, so they can be reused in subsequent tests. Otherwise, one could face issue like #17623. Signed-off-by: Yanfeng Liu <yfliu2008@qq.com>
2025-07-12tests/run-tests.py: Consider tests ending in _async.py as async tests.Damien George
The test `micropython/ringio_async.py` is a test that requires async keyword support, and will fail with SyntaxError on targets that don't support async/await. Really it should be skipped on such targets, and this commit makes sure that's the case. Signed-off-by: Damien George <damien@micropython.org>
2025-07-12tests/micropython: Add missing SystemExit after printing SKIP.Damien George
The test runner expects `print("SKIP")` to be followed by `raise SystemExit`. Otherwise it waits for 10 seconds for the target to do a soft reset before timing out and continuing. Signed-off-by: Damien George <damien@micropython.org>
2025-07-12tests/extmod/asyncio_iterator_event.py: Use format instead of f-string.Damien George
Some targets don't have f-strings enabled, so try not to use them in tests. Rather, use `str.format`, which is more portable. Signed-off-by: Damien George <damien@micropython.org>
2025-07-12tools/ci.sh: Always call `apt-get update` before `apt-get install`.Jeff Epler
There have been recent build failures in build_renesas_ra_board. It appears to be the case that a security update for this package was recently issued by Ubuntu for CVE-2025-4565 and the buggy version is no longer on package servers. However, it is still referred to by the cached apt metadata in the GitHub runners. Add `apt-get update` to fix this, and audit for other sites in `ci.sh` where it might also be necessary. Signed-off-by: Jeff Epler <jepler@gmail.com>
2025-07-09shared/timeutils: Standardize supported date range on all platforms.Yoctopuce dev
This is code makes sure that time functions work properly on a reasonable date range, on all platforms, regardless of the epoch. The suggested minimum range is 1970 to 2099. In order to reduce code footprint, code to support far away dates is only enabled specified by the port. New types are defined to identify timestamps. The implementation with the smallest code footprint is when support timerange is limited to 1970-2099 and Epoch is 1970. This makes it possible to use 32 bit unsigned integers for all timestamps. On ARM4F, adding support for dates up to year 3000 adds 460 bytes of code. Supporting dates back to 1600 adds another 44 bytes of code. Signed-off-by: Yoctopuce dev <dev@yoctopuce.com>
2025-07-09py/obj: Add functions to retrieve large integers from mp_obj_t.Yoctopuce dev
This commit provides helpers to retrieve integer values from mp_obj_t when the content does not fit in a 32 bits integer, without risking an implicit wrap due to an int overflow. Signed-off-by: Yoctopuce dev <dev@yoctopuce.com>
2025-07-08py/objcode: Implement co_lines method.Anson Mansfield
Signed-off-by: Anson Mansfield <amansfield@mantaro.com>