Forum | Documentation | Website | Blog

Skip to content
New mpremote tool, and the mimxrt port gets Pin, ADC, UART, RTC and VFS

This release of MicroPython includes a new command-line tool called
"mpremote", which is intended to be the main way to remotely control a
MicroPython-based device from the command line.  It features a serial
terminal, filesystem access, support to mount a local directory on the
remote device, and a macro language to define custom commands.  This tool
can be installed from PyPI via "pip3 install mpremote", and it works on
Linux, Windows and Mac.  As part of this, improvements were made to
pyboard.py including opening serial ports in exclusive mode to more easily
manage multiple devices.

In the Python core, OSError exceptions now support the ".errno" attribute,
and an option was added to compile MicroPython without error messages to
further reduce code size where needed.  The REPL was improved so that it
does not tab-complete private methods (those starting with underscore, if
no underscore has been typed yet), and it also now tab completes built-in
module names after "import" is typed.

There has been a minor breaking change to a relative import exception: what
was previously a ValueError was changed to ImportError, following the same
change in CPython.  See commit 53519e322a5a0bb395676cdaa132f5e82de22909.

In the extmod components, uctypes has a fix for the size and offset
calculation for ARRAY of FLOAT32, uhashlib now raises an exception if a
hash is reused after digest is called, and urandom supports passing 0 to
getrandbits (following the CPython change).  In uasyncio, the readinto
method is added to the Stream class, and two race conditions were fixed:
one with start_server and wait_closed, and the other with cancelling a
task waiting on finished task; see de2e081260395f47d21bf39a97f3461df3d8b94f
and 514bf1a1911ac9173a00820b7e09dfb387e6b941 respectively.

The esp32 port now supports specifying FROZEN_MANIFEST with new CMake build
system, has NeoPixel support on GPIO32 and GPIO33, network.LAN support in
IDF v4.1 and above, and a new "reconnects" option in the WLAN STA interface
to configure how many (if any) reconnection attempts are made if the WiFi
goes down.

Many features have been added to the mimxrt port, including: VFS filesystem
support with internal flash storage, Pin, Pin.irq and ADC support, UART,
SoftI2C and SoftSPI bus support, Timer and RTC classes, and floating point
numbers.

The rp2 port now has the machine.RTC class to configure the RTC, as well as
new board definition files for SparkFun's Thing Plus RP2040 and Pro Micro
boards.

The stm32 port now supports static soft timers with a C-based callback, and
mboot has been made more configurable, in particular the LEDs and reset
mode selection can now be fully customised by a board.  Two new boards have
been added: VCC_GND_F407VE and VCC_GND_F407ZG.  A bug fix was made to the
SDIO driver to make sure DMA doesn't turn off mid-transfer; this affected
WLAN operation when certain SPI buses were being used.  See commit
a96afae90f6e5d693173382561d06e583b0b5fa5 for details.  Pin configuration of
UART has been modified so pull-up is now configured only on RX and CTS, not
TX and RTS; see 748339b28126e69fd2dc2778b2a182901d0a4693.  The USB_VCP
class has a new irq method to set a callback on USB data RX events.  The
Ethernet driver now supports low-power mode, and has a fix so the link
status is reported correctly.

On the zephyr port, scheduled callbacks are now run at idle REPL and during
sleeps, and there is an initial ubluetooth module which supports BLE
scanning and advertising.  Configuration is provided for the nucleo_wb55rg
board.

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

Thanks to everyone who contributed to this release!

Main components
===============

all:
- rename mp_keyboard_interrupt to mp_sched_keyboard_interrupt
- replace busses with buses

py core:
- objexcept: support errno attribute on OSError exceptions
- add option to compile without any error messages at all
- dynruntime.h: add mp_obj_get_array() function
- profile: use mp_handle_pending() to raise pending exception
- scheduler: add mp_sched_exception() to schedule a pending exception
- scheduler: add optional port hook for when something is scheduled
- runtime: remove commented-out code from mp_deinit()
- scheduler: add missing MICROPY_WRAP_MP_SCHED_EXCEPTION usage
- repl: filter private methods from tab completion
- repl: enter four spaces when there are no matches
- repl: refactor autocomplete to reduce nesting
- repl: refactor autocomplete, extracting reusable parts
- repl: autocomplete builtin modules
- gc: make gc_lock_depth have a count per thread
- mkenv.mk: don't emit info about BUILD_VERBOSE if it's set
- objarray: prohibit comparison of mismatching types
- objarray: implement more/less comparisons for array
- objarray: use mp_obj_memoryview_init helper in mp_obj_new_memoryview
- objarray: fix constructing a memoryview from a memoryview
- nlraarch64: add underscore prefix to function symbols for Darwin ABI
- nlrx64: correct the detection of Darwin ABI
- asmx64: support use of top 8 regs in src_r64 argument
- emitnative: fix x86-64 emitter to generate correct 8/16-bit stores
- mkrules.cmake: add MPY_LIB_DIR and BOARD_DIR to makemanifest call
- asmarm: use builtin func to flush I- and D-cache on ARM 7 archs
- compile: raise an error on async with/for outside an async function
- gc: access the list of root pointers in an asan-compatible way
- repl: don't read past the end of import_str
- builtinimport: change relative import's ValueError to ImportError
- emitglue: always flush caches when assigning native ARM code
- stackctrl: prevent unused-var warning when stack checking disabled
- gc: only use no_sanitize_address attribute for GCC 4.8 and above

extmod:
- uasyncio: use .errno instead of .args[0] for OSError exceptions
- remove old comments used for auto-doc generation
- moductypes: remove double blank lines and debugging printf's
- moductypes: replace numbers with macro constants
- moductypes: fix size and offset calculation for ARRAY of FLOAT32
- moduhashlib: put hash obj in final state after digest is called
- modurandom: add error message when getrandbits has bad value
- modurandom: support an argument of bits=0 to getrandbits
- uasyncio: fix start_server and wait_closed race condition
- uasyncio: add readinto() method to Stream class
- uasyncio: fix race with cancelled task waiting on finished task
- nimble: remove TODO comment about notify_custom freeing om

lib:
- utils: remove unused PYEXEC_SWITCH_MODE from pyexec.h
- utils: add ARM semihosting utility functions
- lwip: switch to use GitHub mirror repo
- mbedtls: switch to currently latest commit of LTS branch v2.16

drivers:
- sdcard: add sleep_ms(1) delay in SDCard.readinto sync loop
- cyw43/cyw43_ctrl: use new sdio enable API functions
- cyw43/cywbt: add compile option for RF switch
- cyw43/cywbt: remove hard-coded UART6 alternate function setting
- display/ssd1306.py: add rotate method
- display/ssd1306.py: add support for 72x40 displays

mpy-cross: no changes specific to this component/port

Support components
==================

docs:
- library/machine: specify initial machine.PWM class
- library/machine: add machine.bootloader docs
- esp8266: add note about simultaneous use of STA_IF and AP_IF
- esp8266: add instructions on entering programming mode manually
- esp8266: clarify limitations of SSL in esp8266 and fix typos
- fix some spelling mistakes
- pyboard: fix typo in pyb.Switch tutorial
- esp32: add UART to quickref
- esp32: add WDT to quickref
- esp32: add SDCard to quickref
- esp8266: add WDT to quickref
- library: add initial API reference for rp2 module and its classes
- library/rp2.rst: fix typo overriden->overridden
- esp32: add APA106 to quickref
- esp32: mention Signal in GPIO section of quickref
- esp8266: mention Signal in GPIO section of quickref
- esp8266: add SSD1306 to quickref and tutorial
- library: clarify what type of algorithm is implemented in heapq
- library: add a blank line to fix formatting for ussl docs
- library/pyb.Pin.rst: update the arguments for Pin.init()
- rp2: add skeleton docs for the rp2 port
- library/machine.RTC.rst: document datetime method and fix ex code
- esp32: document WLAN "reconnects" config option

examples: no changes specific to this component/port

tests:
- use .errno instead of .args[0] for OSError exceptions
- run-multitests.py: provide some convenient serial device shorcuts
- multi_bluetooth: add performance test for gatt char writes
- thread: make stress_create.py test run on esp32
- thread: make stress_aes.py test run on bare-metal ports
- thread: make exc1,exit1,exit2,stacksize1,start1 tests run on rp2
- run-perfbench.py: fix native feature check
- run-multitests.py: flush stdout for each line of trace output
- run-tests.py: parallelize running tests by default
- cpydiff: add test and workaround for function.__module__ attr
- make float and framebuf tests skip or run on big-endian archs
- extmod/btree_gc.py: close the database to avoid a memory leak
- basics: split out literal tests that raise SyntaxWarning on CPy
- run-multitests.py: allow to work without sys.stdout on target
- multi_bluetooth/ble_gap_advertise.py: allow to work without set
- unix: add ffi test for integer types
- cpydiff: add test for array constructor with overflowing value
- float: make bytes/bytearray construct tests work with obj repr C

tools:
- metrics.py: add rp2 port to table of ports that can be built
- upip.py: use .errno instead of .args[0] for OSError exceptions
- pyboard.py: support opening serial port in exclusive mode
- gen-cpydiff.py: fix formatting of doc strings for new Black
- makemanifest.py: show directory name if there is a FreezeError
- mpy_ld.py: support R_X86_64_GOTPCREL reloc for x86-64 arch
- pydfu.py: remove default VID/PID values
- ci.sh: update zephyr docker image to v0.17.3
- ci.sh: use FROZEN_MANIFEST in an esp32 build to test feature
- mpy-tool.py: support relocating ARMv6 arch
- tinytest-codegen.py: add command-line option to exclude tests
- ci.sh: build Cortex-A9 sabrelite board as part of qemu-arm CI
- pyboard.py: track raw REPL state via in_raw_repl variable
- pyboard.py: add "soft_reset" option to Pyboard.enter_raw_repl()
- mpremote: add new CLI utility to interact with remote device
- ci.sh: build mpy-cross as part of ci_mimxrt_build
- mpremote: use available ports instead of auto-connect list
- mpremote: use signal to capture and handle ctrl-C on Windows

CI:
- workflows: add CI workflow for mimxrt port
- workflows: add workflow to build and run unix port on MIPS
- workflows: add workflow to build and run unix port on ARM

The ports
=========

bare-arm port:
- switch to use MICROPY_ERROR_REPORTING_NONE to reduce size

cc3200 port: no changes specific to this component/port

esp8266 port:
- modnetwork: use mp_handle_pending() to raise pending exception
- boards/GENERIC_512K: add custom manifest without FS modules
- update manifest to point to new dirs in micropython-lib
- boards/GENERIC_512K: add custom minimal _boot.py

esp32 port:
- CMakeLists.txt: require CMake version 3.12
- restore FROZEN_MANIFEST support with new CMake build system
- esp32_rmt: clear config struct before filling it out
- mpthreadport: don't explicitly free thread struct in TCB cleanup
- mpthreadport: use binary semaphore instead of mutex
- extend support for S2 series, and S3 where applicable
- boards: rename TINYPICO board to UM_TINYPICO
- boards: add UM_FEATHERS2 and UM_TINYS2 board definitions
- boards/UM_TINYPICO: fix include of sdkconfig fragment
- machine_i2c: allow boards to configure I2C pins using new macros
- boards: set default I2C and SPI pins on UM_xxx boards
- boards: fix spelling mistakes in comments for UM_xxx boards
- update manifest to point to new dirs in micropython-lib
- boards: add M5STACK_ATOM board definition
- espneopixel: add support for GPIO32 and GPIO33
- Makefile: fix wrong target for partition-table.bin
- makeimg.py: load sizes from partition table and verify data fits
- partitions-2MiB.csv: update table so firmware fits
- README: describe how to select compatible version of existing IDF
- network_lan: add Ethernet support for IDF v4.1 and above
- modnetwork: add "reconnects" option to WLAN STA interface
- machine_hw_spi: allow None for unused pins in initializer
- machine_sdcard: use deinit_p to deinit SD bus in SPI mode

javascript port: no changes specific to this component/port

mimxrt port:
- improve ticks and sleep functions using GPT
- implement machine.Pin class
- enable built-in help
- extend the Pin module for SoftI2C, SoftSPI support
- add custom help text and enable help("modules")
- enable frozen modules
- add flash storage support with VFS and littlefs filesystem
- boards/TEENSY40: re-create the flash FS after deploy
- add the Timer class to the machine module
- remove __WFE() from MICROPY_EVENT_POLL_HOOK
- machine_timer: reuse any existing timer objects
- machine_timer: leave the Timer clock source at IPG clock
- machine_rtc: add the RTC class to the machine module
- add floating point support
- enable many Python and some extmod features
- machine_adc: add the ADC class to the machine module
- boards: add board configuration files for Teensy 4.1
- machine_rtc: change RTC.datetime() tuple to match other ports
- machine_rtc: maintain microsecond offset
- machine_uart: add the UART class to the machine module
- machine_pin: implement pin.irq() functionality
- modutime: extend the time module

minimal port: no changes specific to this component/port

nrf port:
- boards/microbit: use mp_sched_exception() where appropriate
- add machine.memXX, and allow boards to customise some features
- boards: add support for evk_nina_b3 board
- add more math sources to Makefile, and enable log2 implementation

pic16bit port:
- Makefile: make the XC compiler version user-configurable

powerpc port: no changes specific to this component/port

qemu-arm port:
- add support for Cortex-A9 via sabrelite board

rp2 port:
- boards: add board definition for SparkFun Thing Plus RP2040
- boards: add board definition for SparkFun Pro Micro board
- tusb_port: add the device unique-id to the USB id
- move manifest.py to boards directory
- mpthreadport: add mp_thread_deinit to reset core1 on soft reset
- CMakeLists.txt: include tinyusb_common in PICO_SDK_COMPONENTS
- machine_rtc: add initial support for RTC
- machine_rtc: check return value from rtc_set_datetime

samd port: no changes specific to this component/port

stm32 port:
- boards/pllvalues.py: support wider range of PLL values for F413
- machine_timer: improve usability of Timer constructor and init
- mboot: allow unpacking dfu without secret key
- correct typos in project README files
- uart: fix H7 UART clock source configuration
- softtimer: add support for having a C-based callback
- softtimer: support static soft timer instances
- boardctrl: add constants for reset mode values
- boardctrl: show first reset-mode state on LEDs when selecting
- mboot: allow a board to add source files to the build
- adc: allow mboot to use basic ADC functions
- mboot: fix mp_hal_delay_us() and add mp_hal_ticks_ms()
- mboot: allow a board to customise the linker scripts
- mboot: allow mboot to be placed at any location in flash
- sdcard: allow configuring the SDMMC periph used for SD/MMC card
- uart: enable HW flow control for UART 1/5/7/8
- sdio: add functions to re/enable SDIO/SDIOIT
- boards/PYBD_SF2: enable RF switch compile option
- sdio: allow configuring the SDMMC periph used for SDIO
- boards: change default LSI_VALUE to 32000 for F4 MCUs
- powerctrl: add MICROPY_HW_ENTER_BOOTLOADER_VIA_RESET option
- boardctrl: adjust logic for running boot.py, main.py
- mboot: add MBOOT_LEAVE_BOOTLOADER_VIA_RESET option
- mboot: make LEDs and reset-mode selection more configurable
- boards: add VCC_GND_F407VE board
- boards: add VCC_GND_F407ZG board
- sdio: fix case of SDIO DMA turning off mid transfer
- uart: configure pull-up only on RX and CTS, not TX and RTS
- mboot: leave bootloader from thread mode, not from IRQ
- boards/NUCLEO_L432KC: fix FS size and enable LFS1 filesystem
- boards/PYBD_SF2: disable GCC 11 warnings for array bounds
- usb: add USB_VCP.irq method, to set a callback on USB data RX
- boards: enable MICROPY_HW_SPIFLASH_ENABLE_CACHE on VCC_GND boards
- sdram: prevent array-bounds warnings with GCC 11
- eth: add low-power mode configuration option
- eth: fix eth_link_status function to use correct BSR bit

teensy port:
- provide own implementation of gc_collect, to not use stm32
- correct typos in project README files

unix port:
- modffi: use a union for passing/returning FFI values
- main: increase stack limit on ARM architectures
- modffi: fix conversion between Python integers and ffi types
- fix build on arm64-darwin due to integer cast

windows port:
- mpconfigport.h: enable features also present in unix port

zephyr port:
- run scheduled callbacks at REPL and during mp_hal_delay_ms
- modmachine: add machine.idle()
- boards: add config for nucleo_wb55rg board
- update disk access configuration for Zephyr v2.6.0
- disable CONFIG_NET_SOCKETS_POSIX_NAMES
- update to Zephyr v2.6.0
- add initial ubluetooth module integration
- boards: enable ubluetooth on nucleo_wb55rg board