Skip to content

I2CTarget, improved floats and native emitter, STM32N6 & ESP32C2 support

Latest
Compare
Choose a tag to compare
@dpgeorge dpgeorge released this 09 Aug 15:08
· 60 commits to master since this release

This release of MicroPython sees the introduction of machine.I2CTarget, which allows Python code to implement an I2C target device. It's available on the alif, esp32, mimxrt, rp2, samd, stm32 and zephyr ports. In the simplest case it can create an I2C register/memory device that connects to a bytearray (or similar buffer) and allows an I2C controller to read from and write into that bytearray. For more complex scenarios the I2CTarget class exposes a set of interrupts which can be acted upon by Python code, allowing an arbitrary I2C device to be created. See the documentation for more details and examples.

Floating point support has been improved in a few ways in this release. First, the formatting (printing) of floats has been rewritten to significantly improve the repr reversibility of floating-point numbers. That is, formatting and then re-parsing a float should return the original value. In MicroPython the percentage of floats that correctly repr and parse back was around 28% (single precision) and 38% (double precision), but has now been improved (in the standard build configuration) to 98.5% and 99.8% (single and double respectively). In addition to printing out more accurate floats, that helps a lot when saving floats to .mpy files, because it means they can be loaded back to the same value.

Second, there is now support in the compiler for handling floats as constants. Floats can now be folded (along with integers) in arithmetic operations, and be part of const assignments. This helps to optimize bytecode because constant float expressions can now be evaluated in the compiler instead of at runtime.

The third float improvement involves object representation C, where floats are stored within the immediate object value rather than on the heap. In this object module, the float can only take up 30 bits, so the last two bits of the single precision number are lost. Previously they were just truncated, but now a heuristic is applied when recovering the float value from the object such that the last two bits are copied from the previous two. This alleviates a bias towards zero and in general improves floating point calculations when using this representation.

The native and viper emitter backends have been improved to emit more optimal machine code, for example to use more compact instructions in loads and stores. This is for all supported architectures: ARM, Thumb, Xtensa, RISC-V 32, x86 and x64. Thumb v1 (for example RP2040) now supports long jumps greater than 12 bits, allowing larger Python functions to be compiled to this native architecture. Also, the inline Xtensa assembler now implements most of the LX3 opcodes, with additions including addx2, subx2, ssl and ssr, among others.

Two new MCUs are supported by this release: STM32N6xx and ESP32-C2 (aka ESP8684). The STM32N6xx is a new STMicroelectronics MCU running at 800MHz with a large amount of RAM and machine-learning accelerators. MicroPython now supports this MCU with USB, XSPI memory-mapped external flash, a filesystem, basic peripherals and deepsleep. The ESP32-C2 is by Espressif and is a small and low cost RISC-V MCU with WiFi and BLE. MicroPython running on this MCU supports a REPL, filesystem, GPIO, I2C, ADC, PWM, timers, WiFi and BLE.

The date range supported by the time module has now been standardized to work the same across all platforms. The functions time(), localtime() and mktime() now work properly on a reasonable range of dates, from at least 1970 up to 2099, regardless of the Epoch used by the platform.

The MicroPython virtual machine is now able to avoid heap-allocating slices when subscripting bytearray and memoryview objects, for example expressions like bytearray_obj[a:b] = c. The slice object is now allocated on the C stack, helping to reduce memory churn and allowing such expressions to work when the heap is locked, for example during a hard interrupt handler. This improvement goes in the general direction of MicroPython using the heap as little as possible, making execution more deterministic.

Other improvements to the core runtime include support for using __all__ in star imports, support for PEP487's __set_name__ special method, support for the _b/o/x specifier in str.format, and arrays can now be extended from any iterable, not just from an object with the buffer protocol. A new MicroPython-specific sys.implementation._thread attribute has been added, which exists when threading is enabled and tells which threading model is used (GIL or unsafe/no-GIL).

The framebuf module now supports blit'ing read-only data to a FrameBuffer, which helps when implementing custom fonts that can now be stored in ROM. The DTLS implementation in the tls module now enables DTLS HelloVerify and Anti Replay protection (for the mbedTLS backend), allowing proper DTLS servers to be implemented. The lwIP socket layer now has a queue of incoming UDP and raw packets (previously it only had room for one outstanding packet), allowing for more robust and efficient UDP protocols.

Mpremote has had a few improvements. There is a new fs tree command which mimics the Unix tree command, and includes the -s and -h options to show the file sizes in the output. The df command has been enhanced to use the new no-argument vfs.mount() query, and shows a much better summary of the mounted filesystems. The mip install command now uses hashes to skip files that exist. The location of the user config.py file is now more portable across many different OSes and configuration styles, thanks to the use of the platformdirs helper package. There is also support for targets without the errno module, improved disconnect handling, and better ESP-device detection for USB-CDC ports.

The mpy_ld.py linker can now resolve fixed-address symbols if requested, for example on ESP8266 it can link to ROM-provided functions. There is also now support for ABS32 text relocations on ARMv6M (RP2040). These improvements extend the set of C extensions that can be compiled for such targets.

Libraries that have been updated in this release include: lwIP updated to STABLE-2_2_1_RELEASE, LittleFS updated to v2.11, libhydrogen updated to the latest release, and stm32lib updated to include support for STM32N6.

There have been many improvements to the test suite, to both the tests and the test runners. This is in part to aid the new Octoprobe test framework, which provides hardware-in-the-loop testing. The continuous integration testing now also includes an undefined behaviour sanitizer (UBSan) build, an address sanitizer (ASan) build, a long-long unix variant, and also testing of object representation C. MicroPython has a lot of tests!

The alif port now supports pin interrupts, has improved SPI transfers, and I2C configuration now allows changing the SCL and SDA pins.

The esp32 port is updated to use ESP-IDF v5.4.2, and now supports ESP32-C2. Most ESP32-based boards now auto-detect the size of their flash on boot and automatically create an appropriate vfs partition based on the size of the flash. This allows the same firmware image to work on boards with various flash sizes. This port has also added a new esp32.PCNT class along with machine.Counter and machine.Encoder, which can count input edges, including motor rotation. The PWM class has been improved, and its API now matches other ports. There is support for the LAN8670 PHY, and a new esp32.idf_task_info() function (useful with the new utop package in micropython-lib). The UART.sendbreak() method has been rewritten so that it doesn't reconfigure the UART during its execution.

The nrf port has had fixes and improvements to its UART REPL to make it more robust, and work with mpremote. It also now uses the correct iRAM address for native code execution on nRF52 MCUs. The nrf implementation of machine.enable_irq() and machine.disable_irq() has been reworked so it uses the code common with all other ports, and this is a breaking change (on nrf boards only) due to the signature change of enable_irq(). Previously the signature was enable_irq(), and now the signature matches other ports, and the docs, and is enable_irq(state), where state is the return value from disable_irq().

The rp2 port now enables compressed error messages by default, which reduces firmware size by about 3000 bytes. The pico-sdk alarm pool is now used (again, instead of custom soft-time code) for power-saving delays, and lightsleep has been improved. Open drain mode has been fixed on RP2350 with more than 32 GPIOs, and support for hard IRQ timer callbacks has been added.

The webassembly port has seen improvements to its FFI interface with JavaScript: it improves "has" and "get" proxying, fixes binding of self to JavaScript methods, implements equality for JsProxy objects, and reuses JsProxy references when possible to improve equality relationships of JavaScript objects on the Python side.

The zephyr port has been updated to use Zephyr v4.0.0, and many improvements have been made: PWM support has been added, UARTs are now interrupt driven with ring-buffers and can set the baudrate and other parameters, GPIO supports open-drain mode, SoftI2C and SoftSPI have been enabled, and the zephyr.FlashArea class now contains constants which enumerate the available partitions. REPL reliability has also been improved and it now supports ctrl-C in the default configuration. BLE can now create services at runtime using the standard BLE.register_services() method. Other small things have been added to make the zephyr port match the behaviour of other bare-metal ports, including: boot.py and main.py are now executed at start-up, /lib is added to sys.path as appropriate, stdin/out/err have been enabled in the sys module, along with the ability to import .mpy files, and await/async keywords are enabled. This port now uses the standardized ROM configuration levels, with the default being the
"basic" level.

New boards added in this release are: GARATRONIC_PYBSTICK26_ESP32C3 and SPARKFUN_IOT_REDBOARD_ESP32 (esp32 port), SPARKFUN_REDBOARD_TURBO and SPARKFUN_SAMD21_DEV_BREAKOUT (samd port), NUCLEO_N657X0 and OPENMV_N6 (stm32 port), beagleplay_cc1352p7, nrf5340dk, nrf9151dk and rpi_pico (zephyr port).

The change in code size since the previous release for select builds of various ports is (absolute and percentage change in the text section):

   bare-arm:    -96  -0.168%
minimal x86:   -207  -0.112%
   unix x64:   -376  -0.045%
      stm32:  +3776  +0.966%
     cc3200:   +392  +0.212%
    esp8266:  +3484  +0.498%
      esp32: +19064  +1.122%
     mimxrt:  +3600  +0.970%
 renesas-ra:  +1296  +0.207%
        nrf:  +1140  +0.607%
        rp2:   +556  +0.245%  (RPI_PICO board)
        rp2:  +2252  +0.245%  (RPI_PICO_W board)
       samd:  +3296  +1.233%

The leading causes of these changes in code size are:

  • bare-arm, minimal: various code size improvements including optimized integer var-arg handling
  • unix: remove static PATH variable (bss size reduction), implement DTLS HelloVerify and Anti Replay protection (size increase)
  • stm32: implement machine.I2CTarget, improve accuracy of float formatting and range of time functions, improve native emitter and inline assembler, update LittleFS to v2.11.
  • cc3200: enable io.IOBase at core feature level, avoid heap-allocating slices when subscripting built-ins.
  • esp8266: add more LX3 opcodes to the inline assembler, update LittleFS to v2.11, native emitter improvements, add float constant folding.
  • esp32: update to IDF 5.4.2 (+10k), implement machine.I2CTarget.
  • mimxrt: implement machine.I2CTarget, improve accuracy of float formatting, improve native emitter, add float constant folding, update LittleFS to v2.11.
  • renesas-ra: improve accuracy of float formatting, native emitter improvements, add float constant folding.
  • nrf: improve accuracy of float formatting, enable io.IOBase, standardize the range of time functions.
  • rp2 (RPI_PICO): enable compressed error messages (-3k), implement machine.I2CTarget, improve accuracy of float formatting.
  • rp2 (RPI_PICO_W): enable compressed error messages (-3k), implement machine.I2CTarget, implement DTLS HelloVerify and Anti Replay.
  • samd: implement machine.I2CTarget, improve accuracy of float formatting, improve native emitter, float constant folding.

Thanks to everyone who contributed to this release: Alessandro Gatti, Andrea Giammarchi, Andrew Leech, Angus Gratton, Anson Mansfield, Anton Blanchard, Ayush Singh, Chris Webb, Christian Lang, Damien George, Daniel Campora, Daniël van de Giessen, David Schneider, David Yang, Detlev Zundel, Dryw Wade, dubiousjim, Elvis Pfutzenreuter, ennyKey, Garatronic, Herwin Grobben, iabdalkader, IhorNehrutsa, Jeff Epler, Jim Mussared, Jonathan Hogg, Jos Verlinde, Koudai Aono, Malcolm McKellips, Matt Trentini, Maureen Helm, Meir Armon, Patrick Joy, Peter Harper, Phil Howard, purewack, Rick Sorensen, robert-hh, root, SiZiOUS, stijn, TianShuang Ke, Vdragon, Yanfeng Liu, Yoctopuce dev, Yuuki NAGAO.

MicroPython is a global Open Source project, and contributions were made from the following timezones: -0600, -0500, -0400, -0300, +0000, +0100, +0200, +0300, +0530, +0800, +0900, +1000, +1100.

The work done in this release was funded in part through GitHub Sponsors, and in part by George Robotics, Espressif, Arduino, OpenMV, Yoctopuce, Microbric and Planet Innovation.

What follows is a detailed list of changes, generated from the git commit history, and organized into sections.

Main components

all:

  • rename the "NORETURN" macro to "MP_NORETURN"
  • bump Ruff version to v0.11.6
  • go back to using default ruff quote style

py core:

  • objrange: match CPython range slicing
  • objstr: fix handling of OP_MODULO with namedtuple
  • dynruntime.mk: fix use of musl's libm.a when LINK_RUNTIME=1
  • mkrules.cmake: add CMake support for compressed error messages
  • make struct-initializing macros compatible with C++
  • malloc: add mutex for tracked allocations
  • modthread: initialize thread state nlr_top to NULL
  • makeversionhdr.py: change utcfromtimestamp() to fromtimestamp()
  • mpconfig: enable io.IOBase at core feature level
  • emitinlinethumb: refactor string literal as array initializer
  • objstr: add support for the :_b/o/x specifier in str.format
  • emitnative: improve Viper register-indexed code for Arm
  • emitnative: improve Viper register-indexed code for Thumb
  • emitnative: refactor Viper register-indexed load/stores
  • asm: remove unused generic ASM API opcode definitions
  • asmthumb: generate proper sequences for large register offsets
  • emitnative: clean up int-indexed Viper load/store code
  • persistentcode: allow a port a custom commit function and track data
  • asmxtensa: replace printf messages with exceptions
  • asmxtensa: make the generated code dumper work on mpy-cross
  • emitinlinextensa: add the rest of LX3 opcodes to the assembler
  • asmxtensa: emit prologue jump only when constants table is in use
  • scheduler: only run scheduler callbacks queued before run started
  • emitnative: let Viper int-indexed code use appropriate operands
  • asmthumb: extend load/store generators with ARMv7-M opcodes
  • asmxtensa: extend existing specialised load/store operations range
  • emitnative: remove redundant RV32 Viper int-indexed code
  • asmarm: extend int-indexed 32-bit load/store offset ranges
  • asmarm: give a proper name to the temporary register
  • asmxtensa: extend BCCZ range to 18 bits
  • asmxtensa: extend BCC range to 18 bits
  • asmthumb: implement long jumps on Thumb/armv6m architecture
  • dynruntime.mk: enable single-precision float by default on armv6/7m
  • parsenum: reduce code size in check for inf/nan
  • parsenum: further reduce code size in check for inf/nan
  • objarray: allow extending array with any iterable
  • parsenum: fix parsing complex literals with negative real part
  • objfloat: change MSVC workaround for NAN being a constant
  • mpz: avoid undefined behavior decrementing NULL
  • objlist: reduce code size in slice operations
  • mpprint: remove unused "PF_FLAG_NO_TRAILZ" flag
  • asmbase: fix assertion error with viper code
  • fix undefined left shift operations
  • modio: fix the case where write fails in BufferedWriter.flush
  • repl: skip private variables when printing tab completion options
  • runtime: add support for using all in star import
  • obj: fix nan handling in object REPR_C and REPR_D
  • misc: fix fallback implementation of mp_popcount
  • misc: introduce macros to check values' bits size
  • asmrv32: implement the full set of Viper load/store operations
  • asmarm: implement the full set of Viper load/store operations
  • asmxtensa: implement the full set of Viper load/store operations
  • asmthumb: remove redundant load/store opcode implementations
  • asmx86: implement the full set of Viper load/store operations
  • asmx64: implement the full set of Viper load/store operations
  • asmthumb: clean up integer-indexed load/store emitters
  • emitnative: let emitters know the compiled entity's name
  • runtime: initialize profile fields in mp_thread_init_state
  • profile: fix printing lineno in frame objects
  • bc: factor out helper for line-number decoding
  • showbc: use line-number decoding helper
  • objcode: implement co_lines method
  • obj: add functions to retrieve large integers from mp_obj_t
  • vm: avoid heap-allocating slices when subscripting built-ins
  • mpprint: rework integer vararg handling
  • objint_longlong: add arithmetic overflow checks
  • smallint: update mp_small_int_mul_overflow() to perform the multiply
  • parsenum: extend mp_parse_num_integer() to parse long long
  • objcode: remove co_lnotab from v2 preview
  • mkrules.mk: mute blobless errors
  • modsys: add sys.implementation._thread attribute
  • obj: fix REPR_C bias toward zero
  • obj: add new type flag to indicate subscr accepts slice-on-stack
  • objint_longlong: fix left shift of negative values
  • mpconfig: define new HEX_FMT formatting macro
  • cast type names to qstr explicitly
  • fix mp_printf integer size mismatches
  • objcell: fix printing of cell ID/pointer
  • mpprint: fix printing pointers with upper bit set
  • objint_mpz: fix pow3 where third argument is zero
  • objint_longlong: fix overflow check in mp_obj_int_get_checked
  • objint_longlong: fix longlong interoperability with floats
  • objtype: add support for PEP487 set_name
  • mphal: add stddef.h header for size_t
  • objboundmeth: add option to use mp_is_equal instead of == comparison
  • parsenum: refactor float parsing code
  • formatfloat: improve accuracy of float formatting code
  • parse: add support for math module constants and float folding
  • asmthumb: don't corrupt base register in large offset store
  • parse: fix missing nlr_pop call in complex path of binary_op_maybe

extmod:

  • machine_usb_device: add exception text wrappers
  • modbluetooth: use newer mp_map_slot_is_filled function
  • asyncio: fix early exit of asyncio scheduler
  • create common cyw43 driver config header
  • cyw43: move the LWIP responder fix into common CYW43 config
  • moductypes: refactor string literal as array initializer
  • modlwip: implement a queue of incoming UDP/raw packets
  • vfs_lfsx: fix errno value raised from chdir
  • modjson: detect unterminated composite entities
  • network_cyw43: disconnect STA if making inactive
  • modlwip: add optional flags argument for recv and recvfrom
  • modbluetooth: add timeout to deinit
  • modframebuf: add support for blit'ing read-only data
  • modnetwork: consolidate definition of common drivers
  • modre: use specific error message if regex is too complex
  • machine_pulse: optimise time_pulse_us for code size
  • modlwip: fix crash when calling recv on listening socket
  • network_lwip: add sys_untimeout_all_with_arg helper function
  • mbedtls: implement DTLS HelloVerify cookie support
  • mbedtls: implement recommended DTLS features, make optional
  • mbedtls: undefine ARRAY_SIZE if defined by platform
  • vfs_lfsx: allow overriding the LFS2 on-disk version format
  • vfs_posix: add additional readonly checks
  • vfs_posix: add MICROPY_VFS_POSIX_WRITABLE option
  • modlwip: print timeout with correct format string
  • modtls_mbedtls: do gc_collect and retry ssl_init on any error
  • machine_i2c_target: add new machine.I2CTarget class

shared:

  • tinyusb: use device event hook to schedule USB task
  • timeutils: standardize supported date range on all platforms
  • netutils: cast the ticks value before printing

drivers:

  • ninaw10/machine_pin_nina: add exception text wrappers
  • esp-hosted: rename Bluetooth HCI backend driver
  • ninaw10: rename Bluetooth HCI backend driver
  • cyw43: remove old BTHCI UART backend
  • esp-hosted: replace EVENT_POLL_HOOK with mp_event_wait_ms
  • support special QSPI direct-read protocol

mpy-cross:

  • main: exit with error if arch not specified with emit=native
  • main: document emit=host option in help

lib:

  • lwip: update lwIP to STABLE-2_2_1_RELEASE
  • littlefs: update LittleFS to v2.10.2
  • littlefs: reuse existing CRC32 function to save space
  • littlefs: fix string initializer in lfs1.c
  • littlefs: update LittleFS to v2.11
  • libhydrogen: update to latest release
  • berkeley-db-1.xx: update submodule to latest
  • libm_dbl: support FLT_EVAL_METHOD == 16
  • stm32lib: update library for N6 v1.1.0
  • pico-sdk: fix Pico SDK fetching develop picotool
  • micropython-lib: update submodule to latest

Support components

docs:

  • zephyr: add quick reference for PWM support
  • zephyr: add zephyr FlashArea IDs docs
  • fix SparkFun capitalization
  • esp32: improve PWM documentation and examples
  • esp32/quickref: add PWM lightsleep example
  • reference/mpremote: document the 'fs tree' command
  • library/time: amend the documentation of time.mktime()
  • esp32/quickref: mention the different timer counts
  • esp32: mention the use of Timer(0) by UART.IRQ_RXIDLE
  • add a description of recv/recvfrom flags argument
  • rp2: document the new rp2 Timer hard= option
  • develop/natmod: add notes on Picolibc and natmods
  • reference/speed_python: document schedule/GIL limitation of native
  • document PEP487 set_name implementation
  • library/bluetooth: document all allowed args to UUID constructor
  • library/rp2.StateMachine: add a note about PIO in and jmp pins
  • library/btree: fix method links to explicitly specify class
  • library: document the new machine.I2CTarget class
  • esp32: add documentation for esp32.PCNT
  • library/machine: add docs for Counter and Encoder
  • reference/mpremote: document location of config file

examples:

  • natmod/random: fix build for Xtensa
  • natmod/framebuf: fix build for Xtensa
  • natmod/deflate: fix build for Xtensa
  • natmod/btree: fix build for Xtensa
  • rp2/pio_uart_rx.py: fix use of PIO constants
  • natmod/btree: fix build on RV32 with Picolibc
  • natmod: use LINK_RUNTIME=1 when building for armv6m
  • usercmodule: cast arguments for printf
  • bluetooth/ble_advertising.py: fix decoding UUIDs

tests:

  • basics/builtin_range.py: add more tests for range slicing
  • extmod: skip binascii tests when hexlify/unhexlify don't exist
  • extmod/vfs_lfs_ilistdir_del.py: skip test if not enough memory
  • extmod/vfs_mountinfo.py: don't import unused errno module
  • extmod/vfs_posix.py: fix test on Android
  • net_hosted: only run network loopback test on supported targets
  • ports/rp2: convert rp2.DMA test to a unittest
  • ports/rp2: tune rp2.DMA test so it runs in all configurations
  • extmod: rename ssl tests that only use the tls module
  • net_inet: update micropython.org certificate for SSL tests
  • extmod/vfs_rom.py: clear sys.path before running test
  • multi_net: add test that requires queuing UDP packets
  • ports/rp2: update machine idle test to revert skip for RP2350
  • ports/rp2: add a test case for light sleeping from CPU1
  • cpydiff: document format separator difference
  • extmod/vfs_lfs_error.py: test value of all OSError's errno
  • cpydiff: explain the numeric literal parsing difference
  • cpydiff: document that uPy requires space after number+period
  • cpydiff: add test of underscore-in-literals
  • cpydiff: ensure all have two levels of category
  • run-tests.py: add list of passed/skipped tests to _result.json
  • micropython/viper_ptr: add tests for arch edge cases
  • float/math_constants.py: test actual e and pi constant values
  • run-tests.py: change _results.json to have a combined result list
  • multi_net: add test coverage for socket recv flag MSG_PEEK
  • multi_net: add test coverage for socket recv flag MSG_DONTWAIT
  • run-natmodtests.py: allow injected code customisation
  • run-tests.py: automatically skip tests that are too large
  • run-tests.py: remove filename arg from prepare_script_for_target
  • run-tests.py: unconditionally enable native tests if asked
  • extmod/random_extra_float.py: skip when funcs not available
  • run-tests.py: factor out helper function to create test report
  • run-multitests.py: create a _result.json at end of run
  • run-natmodtests.py: create a _result.json at end of run
  • run-perfbench.py: create a _result.json at end of run
  • run-natmodtests.py: consider a test skipped if mpy doesn't exist
  • ports/rp2: add tests for rp2-specific timer options
  • cpydiff: document complex() parsing difference
  • extmod: add platform_basic.py for basic coverage test of platform
  • run-tests.py: add support for ctrl keys in REPL tests
  • cmdline: add a test for REPL paste mode
  • micropython: improve viper ptr boundary tests
  • run-tests.py: allow injected code customisation
  • misc: improve test coverage of py/profile.c
  • extmod/machine_uart_tx.py: support STM32WB boards
  • extmod_hardware: add UART config for STM32WB boards
  • extmod_hardware/machine_uart_irq_rxidle.py: ignore inital IRQ
  • extmod_hardware/machine_uart_irq_rxidle.py: test multiple writes
  • ports/stm32: tweak tests to run on a wider set of boards
  • extmod/select_poll_eintr.py: skip test if target can't bind
  • basics/fun_code_full: test code objects with full feature set
  • basics/fun_code_colines: test decoded co_lines values
  • extmod/asyncio_iterator_event.py: use format instead of f-string
  • micropython: add missing SystemExit after printing SKIP
  • run-tests.py: consider tests ending in _async.py as async tests
  • extmod: close UDP sockets at end of test
  • add specific tests for "long long" 64-bit bigints
  • extmod/json_loads_int_64.py: add test cases for LONGINT parse
  • thread: rename thread_lock4 test to thread_lock4_intbig
  • skip bm_pidigits perf test if no arbitrary precision int support
  • basics/fun_code_lnotab: test removal of co_lnotab from v2
  • extmod/select_poll_eintr.py: pre-allocate global variables
  • thread/stress_aes.py: reduce test time on PC targets
  • run-tests.py: detect threading and automatically run thread tests
  • thread: allow thread tests to pass with the native emitter
  • net_inet: update micropython.org certificate for SSL tests
  • run-tests.py: use TEST_TIMEOUT as timeout for bare-metal tests
  • extmod_hardware/machine_uart_irq_break.py: remove send_uart
  • multi_bluetooth: synchronise MTU exchange in BLE MTU tests
  • multi_net: update DTLS multi-net test
  • extmod: add (failing) test for VfsPosix in readonly mode
  • micropython: rename viper boundary tests that depend on big int
  • basics: add tests for PEP487 set_name
  • internal_bench/class_create: benchmark class creation
  • internal_bench/var: benchmark descriptor access
  • run-internalbench.py: allow running internalbench on hardware
  • run-natmodtests.py: automatically skip tests that are too large
  • multi_bluetooth: extend the deep sleep test timeout
  • run-multitests.py: escape encoding errors instead of crashing
  • cpydiff: remove passing types_float_rounding test
  • micropython: test that viper offset stores don't clobber base reg
  • extmod_hardware: add self unittest for I2CTarget
  • multi_extmod: add I2CTarget multi tests
  • extmod_hardware: add basic tests for machine.Counter and Encoder

tools:

  • mpremote: use zlib.compressobj instead of zlib.compress
  • mpremote/tests: add tests for errno behavior
  • mpremote: refactor error handling to apply generally to any errno
  • mpremote: fix possibly-missing EOPNOTSUPP errno name
  • mpremote/tests: add test for rm -r on /remote vfs
  • mpremote: prevent deletion of /remote files via rm -r
  • ci.sh: update URL for xtensa-lx106-elf-standalone.tar.gz
  • mpremote: for mip install, use hash to skip files that exist
  • verifygitlog.py: apply stricter rules on git subject line
  • verifygitlog.py: disallow a leading slash in commit subject line
  • verifygitlog.py: allow long co-author and sign-off names
  • gen-cpydiff.py: improve stdout vs stderr interleaving
  • gen-cpydiff.py: fix RST heading generation
  • gen-cpydiff.py: ensure every item has at least 2 TOC levels
  • mpremote: add new 'fs tree' command
  • mpremote/tests: add tests for 'fs tree' command
  • pyboard.py: avoid initial blocking read in read_until()
  • pyboard.py: introduce timeout_overall for read_until()
  • pyboard.py: add write_timeout and catch errors in enter_raw_repl
  • mpy_ld.py: resolve fixed-address symbols if requested
  • ci.sh: remove natmod build restrictions for Xtensa
  • ci.sh: clean the correct MPY files when batch compiling
  • ci.sh: allow errors in code-size build to fail the CI
  • boardgen.py: ensure board pin locals_dict has consistent order
  • ci.sh: fix nanbox CI test runs
  • mpy_ld.py: support R_ARM_ABS32 relocation in text
  • mpremote: improve df command to use new no-arg vfs.mount() query
  • ci.sh: add functions for sanitizer builds
  • autobuild: build alif boards as part of auto-build
  • ci.sh: disable "stack use after return" in ASan build
  • mpremote: fix disconnect handling on Windows and Linux
  • ci.sh: increase test timeout to 60s in coverage jobs
  • mpremote: support OSError's on targets without errno
  • ci.sh: always call apt-get update before apt-get install
  • pyboard.py: align execpty prefix
  • ci.sh: increase timeout for unix qemu test runs
  • ci.sh: increase timeout for stackless clang test runs
  • ci.sh: skip thread/stress_heap.py test on macOS test run
  • ci.sh: skip thread/stress_recurse.py on unix qemu test runs
  • ci.sh: change averaging to 1 for run-perfbench.py test
  • pyboard.py: add timeout argument to Pyboard.exec_/exec
  • ci.sh: test building all natmod examples with all ARM-M archs
  • mpremote: fix errno.ENOTBLK attribute error on Windows
  • mpremote: update ESPxxx detection for USB-CDC ports
  • mpremote: add platformdirs dependency to requirements.txt
  • mpremote: locate config.py location across different host OSes

CI:

  • workflows: split QEMU/Arm builds into separate entries
  • workflows: use windows-latest runner for all Windows CI jobs
  • workflows: add sanitize_undefined workflow to unix port CI
  • workflows: run the address sanitizer (ASan) build during CI
  • workflows: remove the unix "settrace" CI job
  • workflows: use Python 3.11 for unix coverage testing
  • workflows: add new CI job to test unix port with GIL enabled
  • workflows: build unix port for docs and run workflow more often
  • workflows: add a CI job to build ESP32-C2 and ESP32-C6 boards

The ports

all ports:

  • fix SparkFun capitalization
  • update board.json files for vendor/product consistency
  • eliminate define of {U,}INT_FMT where redundant
  • define new HEX_FMT formatting macro

alif port:

  • create common cyw43 driver config header
  • Makefile: create firmware.zip with files needed for deploying
  • boards/ALIF_ENSEMBLE: add board.json and deploy instructions
  • README: update README with build instructions
  • Makefile: allow specifying a custom build directory
  • machine_pin: add support for machine.Pin IRQ
  • machine_spi: improve transfer function to poll events
  • lwip_inc: refactor lwipopts.h to use extmod's common options
  • machine_i2c_target: implement I2CTarget class
  • machine_i2c: allow changing I2C SCL/SDA pins

bare-arm port: no changes specific to this component/port

cc3200 port: no changes specific to this component/port

embed port:

  • port: fix alloca include for Windows platforms

esp8266 port:

  • main: print error information on crash-induced reboots
  • modmachine: use common machine_time_pulse_us implementation

esp32 port:

  • enable compressed error messages by default
  • esp32_common.cmake: skip BTree module when requested
  • tools: update metrics_esp32 script for ESP-IDF >=v5.4.x
  • esp32_common.cmake: use the tinyusb source files from ESP-IDF
  • machine_timer: fix timer.value() for an uninitialized timer
  • esp32_common.cmake: allow adding defines and compiler flags
  • main: make the entry point function name configurable
  • machine_uart: correctly manage UART queue and event task
  • network_common: raise a memory error on ESP_ERR_NO_MEM
  • network_ppp: restructure to match extmod/network_ppp_lwip
  • machine_pwm: improve PWM and make its API match other ports
  • mpconfigport: document how to get more debug info
  • mpthreadport: fix double delete of tasks on soft reset
  • update to use ESP-IDF v5.4.1
  • network_lan: add support for LAN8670 PHY
  • modesp32: implement esp32.idf_task_info()
  • machine_i2c: fix default I2C pins for C3, S3
  • network_lan: add PHY_GENERIC device type
  • boards/SPARKFUN_IOT_REDBOARD_ESP32: add SparkFun board
  • modsocket: add optional flags argument for recv and recvfrom
  • machine_timer: do not free interrupt from ISR
  • re-use allocated timer interrupts and simplify UART timer code
  • update ADC driver update to the new esp_adc API
  • main: auto detect the size of flash and auto create vfs partition
  • boards: convert all boards to auto detect flash size
  • README: update README to describe auto filesystem sizing
  • modesp32: make wake_on_ulp available only on SoCs that support it
  • modesp32: make wake_on_touch available only on SoCs supporting it
  • modesp32: make wake_on_ext0 available only on SoCs supporting it
  • modesp32: make wake_on_ext1 available only on SoCs supporting it
  • modesp32: fix access to ext0_pin only if defined
  • boards/GARATRONIC_PYBSTICK26_ESP32C3: add pybstick26-esp32c3 defn
  • panichandler: support building against IDFv5.4.2
  • machine_uart: improve sendbreak so it doesn't reconfig the UART
  • update to use ESP-IDF v5.4.2
  • add support for ESP32-C2 (aka ESP8684)
  • add "Free RAM" optimisation config flags
  • fix first line ESP32-C2 serial output after reset or deepsleep
  • machine_i2c: factor default pin macros to header file
  • machine_i2c_target: implement I2CTarget class
  • modesp32: add esp32.PCNT class
  • modules/machine.py: add Counter and Encoder classes
  • mpconfigport: disable I2CTarget on ESP32-C6 to reduce code size
  • machine_timer: enable timer clock source for ESP32C6
  • machine_timer: fix machine.Timer() tick frequency on ESP32C2,C6

mimxrt port:

  • machine_uart: enable CTS SION so it can be read
  • cyw43_configport: update cyw43 config to use new BTHCI UART
  • create common cyw43 driver config header
  • machine_i2c_target: support I2C target mode

minimal port: no changes specific to this component/port

nrf port:

  • use correct IRAM address for native code execution on nRF52
  • only process interrupt chars on UARTs used for REPL
  • fix UART write on parts that can't write more than 255 bytes
  • boards: use 64 byte raw-paste buffer on PCA10028 and PCA10040
  • use common implementation of machine disable/enable IRQ
  • revert "nrf/Makefile: Enable LTO by default only on newer gcc."
  • drivers/bluetooth: change soft-device download URL to self hosted

pic16bit port: no changes specific to this component/port

powerpc port: no changes specific to this component/port

qemu port:

  • Makefile: allow passing flags to test_natmod via RUN_TESTS_EXTRA

renesas-ra port:

  • replace MICROPY_EVENT_POLL_HOOK with mp_event_wait
  • mpconfigport: enable MICROPY_TIME_SUPPORT_Y1969_AND_BEFORE

rp2 port:

  • add exception text wrappers
  • enable compressed error messages by default
  • create common cyw43 driver config header
  • move the LWIP responder fix into common CYW43 config
  • Makefile: add deploy target that uses picotool load
  • rp2_dma: fix default value used in pack_ctrl on RP2350
  • add temporary workaround for GCC 15.1 build failure
  • use pico-sdk alarm pool instead of soft timer for sleep
  • modmachine: add debug code for mp_machine_lightsleep
  • modmachine: add mutual exclusion for machine.lightsleep()
  • disable the LWIP tick timer when not needed
  • machine_pin: replace macros with Pico SDK functions
  • machine_pin: fix simulated open drain with more than 32 GPIOs
  • boards/SPARKFUN_XRP_CONTROLLER_BETA: fix default I2C to use I2C1
  • make FLASH LENGTH match PICO_FLASH_SIZE_BYTES in .ld files
  • machine_timer: support hard IRQ timer callbacks
  • rp2_flash: add MICROPY_HW_FLASH_MAX_FREQ to replace fixed max freq
  • rp2_flash: add default MICROPY_HW_FLASH_MAX_FREQ
  • CMakeLists.txt: make board's pins.csv configurable
  • CMakeLists.txt: make linker script configurable
  • mpnetworkport: deregister all sys timeouts when netif is removed
  • modmachine: do not use deprecated XOSC_MHZ and XOSC_KHZ
  • rp2_pio: configure jmp_pin for PIO use if it's isolation is set
  • CMakeLists.txt: fix flash size check logic
  • rp2_pio: fix use of PIO2 in prog data structure
  • machine_i2c: factor default pin macros to header file
  • machine_i2c_target: implement I2CTarget class
  • rp2_flash: add binary info for ROMFS

samd port:

  • boards/SAMD_GENERIC_Dxxx: add Microchip URL to board.json
  • machine_i2c: add the timeout keyword argument to the constructor
  • modtime: change time.time_ns() to follow the RTC time
  • boards/SAMD_GENERIC_D51xxx: fix VFS settings for internal flash
  • samd_spiflash: improve the flash type detection
  • samd_qspiflash: remove the attempt to handle a unknown device
  • boards: add two SparkFun SAMD21 boards
  • boards: change the SparkFun vendor name to SparkFun
  • machine_i2c_target: support I2C target mode

stm32 port:

  • main: replace mp_stack_set calls with new mp_cstack_init_with_top
  • cyw43_configport: update cyw43 config to use new BTHCI UART
  • create common cyw43 driver config header
  • allow QSPI to work on STM32G4
  • machine_adc: enable ADC re-read errata handling for STM32WB55
  • boards/ARDUINO_PORTENTA_H7: free reserved timer
  • main: add support for additional GC blocks
  • boards/ARDUINO_GIGA: define additional GC blocks in SDRAM
  • uart: enable UART FIFO for H7 MCUs
  • adc: apply re-read errata for WB55
  • adc: simplify ADC calibration settings
  • adc: fix core temperature reading on WB55
  • machine_adc: fix internal ADC channel reading on WB MCUs
  • uart: suppress additional RX idle IRQs on F4/L1
  • irq: change SPI IRQ priority to be higher than DMA IRQ
  • dma: extend STM32H5 DMA use to SPI3 and SPI4
  • machine_adc: add machine.ADC implementation for STM32L1
  • boards/make-pins.py: support up to GPIO-O
  • add support for STM32N6xx MCUs
  • main: disable D-cache when debugging N6
  • lwip_inc: increase lwIP memory on N6
  • boards: add board support files for N6
  • mboot: add support for STM32N6xx MCUs
  • spi: fail spi_init if pins can't be configured
  • boards/OPENMV_N6: add new board definition files
  • boards/NUCLEO_N657X0: add new board definition files
  • stm32.mk: error out if compiling for cortex-m55 on old gcc
  • add casts when printing small integers
  • i2c: move I2C IRQ handlers from stm32_it.c to i2c.c
  • i2cslave: change irq handler name to i2c_slave_irq_handler
  • i2cslave: add functions to read/write I2C data
  • i2cslave: support i2c_slave_process_tx_end callback on F4
  • i2cslave: account for slow addr_match callback
  • machine_i2c_target: implement I2CTarget class

unix port:

  • variants: enable os.uname() in coverage build for tests
  • main: remove PATH_MAX from realpath
  • mpthreadport: work around lack of thread cancellation on Android
  • coveragecpp: verify struct-initializing macros' C++-compatibility
  • modsocket: expose MSG_PEEK flag for recv & recvfrom
  • coverage: add coverage test for mp_sched_schedule_node
  • coverage: add coverage test for left adjusted print
  • README: add some small documentation about sanitizers
  • variants/coverage: enable sys.settrace
  • coverage: initialize more code_state fields
  • coverage: add missing MP_OBJ_FROM_PTR casts
  • Makefile: drop include path of "i686-linux-gnu"
  • coverage: expand mp_printf coverage tests
  • variants: add a 'longlong' variant to test 64-bit bigints in CI
  • allow the GIL to be enabled
  • variants/longlong: use REPR_C on this variant
  • mpconfigport: include time.h to get definition of time_t
  • mpthreadport: ensure consistent type of PTHREAD_STACK_MIN
  • coverage: avoid type checking an invalid string
  • coverage: cast type names to qstr explicitly
  • coverage: cast values to fit %x formatting code
  • coverage: cast values to int for format printing
  • coverage: provide argmuents of expected integer types
  • coverage: remove unused printf arguments

webassembly port:

  • objpyproxy: avoid throwing on symbol or iterator has-check
  • objpyproxy: avoid throwing on implicit symbols access
  • proxy_c: provide constants for fixed JsProxy refs
  • objjsproxy: fix binding of self to JavaScript methods
  • objjsproxy: implement equality for JsProxy objects
  • proxy_js: reuse JsProxy ref if object matches

windows port: no changes specific to this component/port

zephyr port:

  • fix prj.conf for v4.1-rc1
  • fix call to thread_analyzer_print for v4.0
  • remove reference to CONFIG_MMC_VOLUME_NAME for v4.0
  • upgrade to Zephyr v4.0.0
  • machine_pwm: implement PWM support
  • boards: enable PWM on beagleconnect_freedom
  • create options to enable frozen modules
  • boards: add nrf5340dk board configuration
  • boards: add nrf9151dk board configuration
  • create ability to use device_next with CDC ACM as REPL
  • introduce auto-listing of FlashArea Partitions
  • boards: enable ADC on beagleconnect_freedom
  • modbluetooth_zephyr: allow BLE to create services at runtime
  • mpconfigport: fix mp_int_t and mp_uint_t to work on 64-bit archs
  • boards: add support for BeaglePlay CC1352p7
  • boards/beagleconnect_freedom: enable networking
  • boards/beagleconnect_freedom: remove board overlay
  • machine_uart: complete UART driver and make it interrupt driven
  • machine_pin: configure OUT pin also as input so it's readable
  • boards: disable WDT on qemu boards and networking for cortex_m3
  • README: update URL describing QEMU network settings
  • prj.conf: use UART for console as default, not CONSOLE_SUBSYS
  • update generated header path
  • main: execute boot.py and main.py like other ports
  • main: add /flash/lib or /sd/lib to sys.path on start up
  • enable sys.stdin/out/err
  • src: increase UART input buffer to 512 bytes and reduce latency
  • src: fix USB device_next driver to work with zephyr 4.0.0
  • machine_pin: add Pin.OPEN_DRAIN constant
  • machine_pin: allow constructing a Pin with an existing Pin
  • mphalport: implement C-level pin HAL
  • mpconfigport: enable machine.SoftI2C and machine.SoftSPI
  • mpconfigport: enable import of mpy and a few related features
  • mpconfigport: enable MICROPY_NLR_THUMB_USE_LONG_JUMP
  • boards/frdm_k64f: improve board configuration
  • boards/nucleo_wb55rg: enable BLE, I2C, SPI and add filesystem
  • boards/rpi_pico: add board configuration for rpi_pico
  • mpconfigport: enable sys.maxsize
  • mpconfigport: enable emergency exception buffer
  • machine_timer: make machine.Timer id argument optional
  • machine_pin: retry configuring gpio with just GPIO_OUTPUT
  • mpconfigport_minimal: use MICROPY_CONFIG_ROM_LEVEL_MINIMUM
  • mpconfigport: use MICROPY_CONFIG_ROM_LEVEL_BASIC_FEATURES
  • machine_i2c_target: implement I2CTarget class