MicroPython version 1.13 released

Announcements and news related to MicroPython.
Post Reply
Damien
Site Admin
Posts: 647
Joined: Mon Dec 09, 2013 5:02 pm

MicroPython version 1.13 released

Post by Damien » Wed Sep 02, 2020 6:10 am

After a long delay and a crazy year, the team is happy to announce the next release of MicroPython, v1.13!

Source code and firmware can be downloaded from https://micropython.org/download/

The full change log can be found at https://micropython.org/resources/micro ... ngeLog.txt

A summary of the changes follows. Please take note of the list of breaking changes at the end.

Enjoy!

v1.13 New uasyncio module, code formatting, BTstack bindings with unix support

This release of MicroPython includes a new implementation of the uasyncio module which aims to be more compatible with CPython's asyncio module. The main change is to use a Task object for each coroutine, allowing more flexibility to queue tasks in various places, eg the main run loop, tasks waiting on events, locks or other tasks. It no longer requires pre-allocating a fixed queue size for the main run loop. A pairing heap is used to queue Tasks, and the core is optionally implemented in C.

Most code in this repository is now auto-formatted using uncrustify for C code and Black for Python code. The tools/codeformat.py script is used to apply this formatting. Options for uncrustify were chosen to match as closely as possible the existing C style, but there were nevertheless quite a few changes to make the code style consistent.

BlueKitchen BTstack bindings have been added for the ubluetooth module, as an optional alternative to the NimBLE stack. The unix port can now be built with BLE support using these bindings, which works with USB Bluetooth adaptors (this feature is enabled by default on the dev and coverage variants).

Other Bluetooth additions include: new events for service/characteristic/ descriptor discovery complete; new events for read done and indicate acknowledgement; and support for active scanning in BLE.gap_scan(). See also below for breaking changes to the ubluetooth BLE API.

PEP 526 has been implemented which adds new syntax for variable annotations, such as "x:int = 1". PEP 572 has also been implemented, which adds the ":=" operator for assignment expressions, such as "if x := 1:...".

The whole code base now supports compressing error messages (those strings used as arguments to exception instances) using a "common word" scheme, which can be used to reduce code size.

Other new features include: support for non-boolean results for equality and inequality tests; the addition of the micropython.heap_locked() function to test the state of the heap; binary operations for viper uint operands in the native emitter; and mtime support on littlefs v2 filesystems (which can be disabled if needed).

There has been an important bug fix when importing ARM machine code from an .mpy file: the system now correctly tracks the executable memory allocated to the machine code so this memory is not reclaimed by the garbage collector.

For testing, a multi-instance test runner has been added (see tests/run-multitests.py) which allows running a synchronised test across two or more MicroPython targets. This is currently used for network and BLE tests that require communication between multiple devices.

In the unix port different builds are now organised into build variants, analogous to boards on bare-metal. And PEP 475 has been implemented which retries syscalls failing with EINTR.

The stm32 port sees improved support for STM32WB MCUs, with ADC, SPI and DMA support, along with support in mboot for these MCUs. Mboot also adds optional littlefs support.

The esp8266 port now includes three generic board definitions: GENERIC_512K, GENERIC_1M and GENERIC, with the latter for modules with 2M or more of flash. This port also changed the default filesystem to littlefs, and no longer supports hard pin IRQs. See breaking changes below for more details.

The esp32 port now enables Bluetooth support (via NimBLE) on both IDF v3 and v4 builds. It also changes the default filesystem from FAT to littlefs v2 (but existing devices with FAT filesystems will continue to work without change).

There is also a new mimxrt port which targets NXP i.MX RT series CPUs.

Breaking changes in this release are:

- async-for no longer await's on the result of __aiter__. The __aiter__ method should return an async-iterable object but is not itself awaitable. See commit https://github.com/micropython/micropyt ... 8511507a69

- In ubluetooth, the IRQ event constants have all changed value (from a bitfield to a sequential integer) and Python code should be updated accordingly by replacing the const definitions with the new ones, which can be found at https://docs.micropython.org/en/latest/ ... th.BLE.irq See also commit https://github.com/micropython/micropyt ... 43d095089b

- In ubluetooth, the IRQ data for the _IRQ_SCAN_RESULT event has had the "connectable" entry changed to "adv_type". The existing connectable value was a boolean and True now becomes 0x00, False becomes 0x02. See commit https://github.com/micropython/micropyt ... 2e2ec6645d

- For esp8266, the default filesystem has changed from FAT to littlefs v2. And the flash layout of the firmware and filesystem has changed to give more space to the firmware and frozen bytecode. When upgrading an existing esp8266 device the filesystem will be reformatted so files should be backed up first. See commit https://github.com/micropython/micropyt ... 860e531ad3

- For esp8266, machine.Pin no longer supports configuring a pin IRQ with "hard=True" (because the interrupt handling code is moved to iRAM). Existing code using pin IRQs should remove any "hard=True" argument. See commit https://github.com/micropython/micropyt ... 3daccfc7d5

- For the unix port, binaries are renamed to micropython-variant (no longer micropython_variant). See commit https://github.com/micropython/micropyt ... 70341013d7

ksluka
Posts: 1
Joined: Fri Sep 18, 2020 2:30 pm

Re: MicroPython version 1.13 released

Post by ksluka » Fri Sep 18, 2020 2:37 pm

Hello, I found that the latest micropython docs on page https://docs.micropython.org/en/latest contains documentation for old version 1.8.x. Can you please fix that? Thank you.

User avatar
marfis
Posts: 215
Joined: Fri Oct 31, 2014 10:29 am
Location: Zurich / Switzerland

Re: MicroPython version 1.13 released

Post by marfis » Fri Sep 18, 2020 3:52 pm

A little late.. but a big thank you to Damien and all the contributors.

What a big changelog and somehow it seems to address magically things I‘ve silently wished for. Great.

Keep it up!

User avatar
pythoncoder
Posts: 5956
Joined: Fri Jul 18, 2014 8:01 am
Location: UK
Contact:

Re: MicroPython version 1.13 released

Post by pythoncoder » Fri Sep 18, 2020 4:45 pm

Yes indeed. Especially uasyncio V3 which is an awesome achievement :D
Peter Hinch
Index to my micropython libraries.

Post Reply