summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
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>
2025-07-08tests/basics/fun_code_colines: Test decoded co_lines values.Anson Mansfield
Signed-off-by: Anson Mansfield <amansfield@mantaro.com>
2025-07-08tests/basics/fun_code_full: Test code objects with full feature set.Anson Mansfield
Signed-off-by: Anson Mansfield <amansfield@mantaro.com>
2025-07-08py/showbc: Use line-number decoding helper.Anson Mansfield
Signed-off-by: Anson Mansfield <amansfield@mantaro.com>
2025-07-08py/bc: Factor out helper for line-number decoding.Anson Mansfield
Signed-off-by: Anson Mansfield <amansfield@mantaro.com>
2025-07-08tools/mpremote: Support OSError's on targets without errno.Damien George
Targets without the `errno` module enabled will not render `OSError`s with the name of the error. Instead they just print the numeric error code. Add support for such targets by explicitly recognising certain error codes. Signed-off-by: Damien George <damien@micropython.org>
2025-07-08unix/coverage: Add missing MP_OBJ_FROM_PTR casts.Jeff Epler
An attempt to build the coverage module into the nanbox binary failed, but pointed out that these sites needed explicit conversion from pointer to object. Signed-off-by: Jeff Epler <jepler@gmail.com>
2025-07-08stm32/stm32.mk: Error out if compiling for cortex-m55 on old gcc.Damien George
Signed-off-by: Damien George <damien@micropython.org>
2025-07-08stm32/boards/NUCLEO_N657X0: Add new board definition files.Damien George
Signed-off-by: Damien George <damien@micropython.org>
2025-07-08stm32/boards/OPENMV_N6: Add new board definition files.Damien George
Signed-off-by: Damien George <damien@micropython.org>
2025-07-08stm32/spi: Fail spi_init if pins can't be configured.Damien George
Follows the UART and I2C drivers. Signed-off-by: Damien George <damien@micropython.org>
2025-07-08stm32/mboot: Add support for STM32N6xx MCUs.Damien George
Works in the usual USB DFU mode, and can program external SPI flash. It will enable XSPI memory-mapped mode before jumping to the application firmware in the external SPI flash. Signed-off-by: Damien George <damien@micropython.org>
2025-07-08stm32/boards: Add board support files for N6.Damien George
Signed-off-by: Damien George <damien@micropython.org>
2025-07-08stm32/lwip_inc: Increase lwIP memory on N6.Damien George
Signed-off-by: Damien George <damien@micropython.org>
2025-07-08stm32/main: Disable D-cache when debugging N6.iabdalkader
See ST Errata ES0620 - Rev 0.2 section 2.1.2. Signed-off-by: iabdalkader <i.abdalkader@gmail.com>
2025-07-08stm32: Add support for STM32N6xx MCUs.Damien George
This commit adds preliminary support for ST's new STM32N6xx MCUs. Supported features of this MCU so far are: - basic clock tree initialisation, running at 800MHz - fully working USB - XSPI in memory-mapped mode - machine.Pin - machine.UART - RTC and deepsleep support - SD card - filesystem - ROMFS - WiFi and BLE via cyw43-driver (SDIO backend) Note that the N6 does not have internal flash, and has some tricky boot sequence, so using a custom bootloader (mboot) is almost a necessity. Signed-off-by: Damien George <damien@micropython.org>
2025-07-08stm32/boards/make-pins.py: Support up to GPIO-O.Damien George
Signed-off-by: Damien George <damien@micropython.org>
2025-07-08lib/stm32lib: Update library for N6 v1.1.0.Damien George
Changes in this new library version are: - Add N6 HAL at v1.1.0. Signed-off-by: Damien George <damien@micropython.org>
2025-07-08lib/libm_dbl: Support FLT_EVAL_METHOD == 16.Damien George
That's almost the same as FLT_EVAL_METHOD == 0, but indicates the presence of _Float16_t support. Signed-off-by: Damien George <damien@micropython.org>
2025-07-08drivers: Support special QSPI direct-read protocol.Damien George
This is useful for interfaces that stay in memory-mapped mode by default. They can implement this method with a simple `memcpy()`. Signed-off-by: Damien George <damien@micropython.org>
2025-07-08stm32/machine_adc: Add machine.ADC implementation for STM32L1.Yuuki NAGAO
Signed-off-by: Yuuki NAGAO <wf.yn386@gmail.com>