Bug fix for esp32 SoftI2C
This is a bug fix release. The changes are:
extmod/machine_i2c: only use WRITE1 option if transfer supports it
This fixes the machine.SoftI2C.readfrom_mem() method on esp32, so it
writes the address to read from.
New mpy 6 file format with improved bytecode, addition of renesas-ra port
In this release of MicroPython the .mpy file format has been significantly
reworked and bumped to version 6. The new format now contains data and
bytecode organised to be mostly static and ready to run in-place. To
achieve this, qstr references from bytecode (and native machine code) now
go through a lookup table, to convert from local qstr number in the module
to global qstr number in the runtime that the module executes within. This
means bytecode (and most native code) does not need rewriting when it is
imported. Along with this change, the jump opcodes have been optimised to
emit 1-byte jump offsets when possible, which gives a good reduction in
bytecode size, saving RAM and reducing the size of .mpy files.
The change to the bytecode means that code constants (like long strings,
bytes objects and floats) are now shared and de-duplicated across the whole
module, rather than each code object having a separate constant table. The
parser can also now turn a tuple of constants into a constant object, so
the tuple doesn't need to be built at runtime each time it is used.
Furthermore, any constant object can now be used in "X = const(obj)"
statements.
With these bytecode changes, .mpy files see around a 10% reduction in size
and frozen .mpy code sees about a 5% size reduction. Heap memory use after
import is also down by around 5% (more savings are seen if the code uses
lots of constants). Due to the qstr indirection performance of the VM is
slightly reduced on some benchmarks by a few percent, but the benefits of
smaller code and reduced RAM usage are deemed to outweigh this. See commit
f2040bfc7ee033e48acef9f289790f3b4e6b74e5 for more details.
In the runtime, support has been added for multiple *args and **args in a
function call, following PEP 448. Built-in modules can now have (optional)
mutable attributes, and this is used to implement sys.ps1/sys.ps2 which
allow the user to customise the REPL prompt. This can be useful, for
example, to configure a different REPL for different boards so they can be
easily distinguished. The sys module has also had the MicroPython git
version and build date appended to sys.version, sys.implementation._machine
has been added, and sys.implementation.mpy renamed to
sys.implementation._mpy. The sys module can now be used to fully identify
the MicroPython version and target it is running on (and the platform
module provides additional information when it's available).
The MP_REGISTER_MODULE macro is now used to register all built-in C modules
and the third argument to this macro has been removed. Any user-C-modules
will need to be updated. Also support for MICROPY_PORT_BUILTIN_MODULES is
removed because this is no longer needed, and should be replaced by usage
of MP_REGISTER_MODULE (see commit 0a92469c10542d57ef0ea6b6cf2ed0cae9491dbe
for example).
The MP_REGISTER_MODULE macro is now used to register all built-in C modules
and the third argument to this macro has been removed. Also support for
MICROPY_PORT_BUILTIN_MODULES is removed because this is no longer needed.
mpy-cross now supports the -march=armv6m option, which can be used with the
rp2 port. The -mno-unicode has been removed.
The littlefs2 library has been updated to v2.5.0 which includes some
performance improvements and minor fixes.
At the REPL, a tab will now insert an indent when it follows whitespace,
and auto-indent is automatically disabled if a space or tab follows an
auto-indent. This means that Python code can be pasted into the standard
REPL without messing up the indentation.
mpremote is now at version 0.3.0, with a progress indicator shown when
copying large files, and recursive copy fixed on Windows. It also has the
following commands added: --help, --version, version, resume, soft-reset,
umount.
The esp32 port has a new machine.ADCBlock class and updated ADC class.
Fixes have been made to ADC2 channel mapping, low PWM frequencies,
UART initialisation of unspecified parameters, and RMT channel on S2/S3/C3
variants. The Pin.PULL_HOLD constant has been replaced by a "hold" keyword
argument to the Pic constructor, and it's now possible to configure pin
drive strength. I2C write-then-read transfers have been optimised to be
faster. WLAN.config() now supports setting/getting the txpower. New
boards include LOLIN C3 MINI ESP32-C3, LilyGO LoRa32, and UM ESP32-S3 based
boards.
The mimxrt port has updated the nxp_driver to v2.10 and fixed USB CDC RX
handling to not block. Pin drive constants have been renamed to DRIVE_x to
match other ports, and the machine.I2S class has been added. New boards
include Olimex RT1010 and MIMXRT1015_EVK.
The nrf port now includes uasyncio in the default board manifest, and
additional features have been enabled on nrf52840 and nrf9160 boards to
match the features on stm32, rp2 and esp32. This includes enabling the
json, re, zlib and framebuf modules.
There is a new renesas-ra port which targets Renesas RA4M1, RA4W1, RA6M1
and RA6M2 MCUs, with board definitions for evaluation kits for these MCUs,
along with RA4M1 clicker. This port currently supports Pin, ADC, SoftI2C,
I2C, SoftSPI, SPI, UART, Timer and RTC classes in the machine module, along
with the VFS and an internal flash filesystem.
The rp2 port now has optional USB MSC support, and optional dupterm
support. The machine.UART class has init and deinit methods added, and
the ucryptolib module is now available. The lwIP network stack has been
integrated, along with mbedtls for the ssl module, and these can be used
with the new Wiznet driver to provide Ethernet support. The Wiznet
W5100S-EVB-Pico board has been added which makes use of this driver. The
day-of-week value reported by time.localtime() has been fixed, memory
corruption when a thread is created on core1 has been fixed, and the UART
now uses a mutex when reading/writing to prevent character duplication in
code that uses both cores.
The stm32 port has added support for G0, G4 and WL MCUs. The new boards
for these MCUs are NUCLEO_G0B1RE, NUCLEO_G474RE and NUCLEO_WL55. The
ARDUINO_PORTENTA_H7 board has also been added, with full WiFi and BLE
support. The rfcore on WB55 MCUs has been improved by removing an extra
layer of buffering, and the restriction on the use of address resolution
has been removed, meaning that the rfcore WS firmware should be updated
to v1.12.0 or later; see commit 26b1d31eda292d9cd5cfc68f14ce8055256fade8.
The board-level configuration of mboot has been significantly improved to
allow more control over system clocks, more hooks into the start up
process, and a hook for state change. And the CRC32 of DFU files is now
verified before writing them.
The pyb.CAN class has been improved to support FD frames and buses with
mixed classic/extended-ID nodes, allowing extended IDs to be specified on a
per-message basis. CAN.recv also now returns a value indicating if the
received message had an extended ID or not. And CAN.initfilterbanks has
been removed, replaced with the num_filter_banks keyword argument to
CAN.init. These are all breaking changes to the pyb.CAN class API and code
will need to be updated accordingly; see commit
5cdf9645711cc12b45e602ef5795c33895116fc4 for details.
The unix port now shows compiler information in the REPL banner to make it
consistent with how bare-metal ports work, and the "-X realtime"
command-line option has been added for macOS to get improved timing. All
variants have switched to use the VFS subsystem, and use the VfsPosix class
for mounting the host's filesystem. The os module has been consolidated
with all other ports and the minimal and standard variants gain the unlink,
chdir, getcwd and listdir functions.
The windows port has also switched to the VFS subsystem and VfsPosix. It
adds support for micropython.schedule and uasyncio on the dev variant. And
BCryptGenRandom has been used to implement os.urandom.
The zephyr port upgraded Zephyr to v3.0.0.
The change in code size since the previous release for various ports is
(absolute and percentage change in the text section):
bare-arm: +792 +1.394%
minimal x86: +2091 +1.286%
unix x64: +10231 +1.995%
unix nanbox: +9777 +2.162%
stm32: +184 +0.047% PYBV10
cc3200: +904 +0.493%
esp8266: -1240 -0.177% GENERIC
esp32: +6464 +0.425% GENERIC
nrf: +11288 +6.472% pca10040
rp2: +14432 +2.929% PICO
samd: +1352 +0.970% ADAFRUIT_ITSYBITSY_M4_EXPRESS
The changes that dominate these numbers are:
Note that the stm32 port's size remained roughly unchanged. This is
because it has a decent amount of frozen Python code and the reduction in
frozen code size due to the reworked bytecode has offset the increase in
runtime/VM size due to this change. Ports like bare-arm, minimal, cc3200
and samd do not have any frozen code so only see the increase in runtime/VM
size. Production-level projects that have a significant amount of frozen
code have seen around a 4% overall reduction in their firmware size.
Thanks to everyone who contributed to this release: Algy Tynan, Andrew
Leech, Andrew Scheller, Artyom Skrobov, Asensio Lorenzo Sempere, Bradley
Wogsland, Cem Eliguzel, Chris Wilson, Christian Decker, Christian Zietz,
Christophe Priouzeau, Clayton Mills, Damien George, Daniel Jour, Daniël van
de Giessen, Dave Hylands, David Lechner, Emil Kondayan, Herwin Grobben,
iabdalkader, IhorNehrutsa, Jan, Jared Hancock, jason, Jeff Epler, Jeremy
Herbert, Jim Mussared, Jon Bjarni Bjarnason, Jonathan Hogg, Jos Verlinde,
Kattni Rembor, Lars Kellogg-Stedman, Luiz Brandao, marcidy, Martin Fischer,
Maureen Helm, Meriç SARIIŞIK, Michael Himing, Michael O'Cleirigh,
MikeTeachman, Peter D. Gray, Peter Hinch, Peter Züger, Phil Howard, Philipp
Ebensberger, Rob Knegjens, robert-hh, Sean Coates, Seon Rozenblum, Stephane
Smith, stijn, Takeo Takahashi, ubi de feo, Waterlens, wemos, YoungJoon
Chun, Yukai Li.
What follows is a detailed list of changes, generated from the git commit
history, and organised into sections.
all:
py core:
const
consistently to avoid a castextmod:
shared:
drivers:
mpy-cross:
lib:
docs:
invert
parameterexamples:
tests:
-X realtime
option for macOS teststools:
python -m
CI:
all ports:
bare-arm port: no changes specific to this component/port
cc3200 port:
esp8266 port:
esp32 port:
javascript port:
mimxrt port:
minimal port: no changes specific to this component/port
nrf port:
pic16bit port:
powerpc port: no changes specific to this component/port
qemu-arm port:
renesas-ra port:
rp2 port:
samd port:
stm32 port:
teensy port:
unix port:
-X realtime
command-line option on macOSwindows port:
zephyr port:
Boosted performance, board.json metadata, more mimxrt, rp2, samd features
This release of MicroPython sees a boost to the overall performance of the
VM and runtime. This is achieved by the addition of an optional cache to
speed up general hash table lookups, as well as a fast path in the VM for
the LOAD_ATTR opcode on instance types. The new configuration options are
MICROPY_OPT_MAP_LOOKUP_CACHE and MICROPY_OPT_LOAD_ATTR_FAST_PATH. As part
of this improvement the MICROPY_OPT_CACHE_MAP_LOOKUP_IN_BYTECODE option has
been removed, which provided a similar map caching mechanism but with the
cache stored in the bytecode, which made it not useful on bare metal ports.
The new mechanism is measured to be at least as good as the old one,
applies to more map lookups, has a constant RAM overhead, and applies to
native code as well as bytecode.
These performance options are enabled on the esp32, mimxrt, rp2, stm32 and
unix ports. For esp32 and mimxrt some code is also moved to RAM to further
boost performance. On stm32, performance increases by about 20% for
benchmarks that are heavy on name lookups, like misc_pystone.py and
misc_raytrace.py. On esp32 performance can increase by 2-3x, and on mimxrt
it is up to 6x.
All boards in all ports now have a board.json metadata file, which is used
to automatically build firmware and generate a webpage for that board
(among other possibilities). Auto-build scripts have been added for this
purpose and they build all esp32, mimxrt, rp2, samd and stm32 boards. The
generated output is available at https://micropython.org/download.
Support for FROZEN_DIR and FROZEN_MPY_DIR has been deprecated for some time
and was finally removed in this release. Instead of these, FROZEN_MANIFEST
can be used. The io.resource_stream() function is also removed, replaced
by the pure Python version in micropython-lib.
The search order for importing frozen Python modules is now controlled by
the ".frozen" entry in sys.path. This string is added by default in the
second position in sys.path. User code should adjust sys.path depending on
the desired behaviour. Putting ".frozen" first in sys.path will speed up
importing frozen modules.
A bug in multiple precision integers with bitwise of -0 was fixed in commit
2c139bbf4e5724ab253b5b034ce925e04267a9c4.
The platform module has been added to allow querying the compiler and
underlying SDK/HAL/libc version. This is enabled on esp32, mimxrt and
stm32 ports.
The mpremote tool now supports seek, flush, mkdir and rmdir on PC-mounted
filesystems. And a help command has been added.
The documentation has seen many additions and improvements thanks (for a
second time) to the Google Season of Docs project. The rp2 documentation
now includes a reference for PIO assembly instructions, a PIO quick
reference and a PIO tutorial. The random and stm modules have been
documented, along with sys.settrace, manifest.py files and mpremote. There
is also now more detail about the differences between MicroPython and
standard Python 3.5 and above.
The esp32 port sees support for ESP32-S3 SoCs, and new boards GENERIC_S3,
ESP32_S2_WROVER, LOLIN_S2_MINI, LOLIN_S2_PICO and UM_FEATHERS2NEO. The PWM
driver has been improved and now supports all PWM timers and channels, and
the duty_u16() and duty_ns() methods, and it keeps the duty constant when
changing frequency. The machine.bitstream() function has been improved to
use RMT, with an option to select the original bit-banging implementation.
The mimxrt port gained new hardware features: SDRAM and SD card support, as
well as network integration with a LAN driver. The machine.WDT class was
added along with the machine.reset_cause(), machine.soft_reset(),
machine.unique_id() add machine.bitstream() functions. DHT sensor support
was added, and f-strings were enabled.
The rp2 port now has support for networking, and bluetooth using NimBLE.
The Nina-W10 WiFi/BT driver is fully integrated and supported by the new
Arduino Nano RP2040 connect board. I2S protocol support is added along
with a machine.bitstream() driver and DHT sensor support. The PWM driver
had a bug fix with the accuracy of setting/getting the frequency, and the
duty value is now retained when changing the frequency.
On the samd port there is now support for the internal flash being a block
device, and for filesystems and the os module. Pin and LED classes have
been implemented. There are more time functions, more Python features
enabled, and the help() function is added. SEEED_WIO_TERMINAL and
SEEED_XIAO board definitions are now available.
The stm32 port now has support for F427, F479 and H7A3(Q)/H7B3(Q) MCUs, and
new board definitions for VCC_GND_H743VI, OLIMEX_H407, MIKROE_QUAIL,
GARATRONIC_PYBSTICK26_F411, STM32H73B3I_DK. A bug was fixed in the SPI
driver where a SPI transfer could fail if the CYW43 WiFi driver was also
active at the same time.
On the windows port the help() function has been enabled, and support for
build variants added, to match the unix port.
The zephyr port upgraded Zephyr to v2.7.0.
The change in code size since the previous release for various ports is
(absolute and percentage change in the text section):
bare-arm: -1520 -2.605%
minimal x86: -2256 -1.531%
unix x64: -457 -0.089%
unix nanbox: -925 -0.204%
stm32: +312 +0.079% PYBV10
cc3200: -176 -0.096%
esp8266: +532 +0.076% GENERIC
esp32: +27096 +1.820% GENERIC
nrf: -212 -0.121% pca10040
rp2: +9904 +2.051% PICO
samd: +35332 +33.969% ADAFRUIT_ITSYBITSY_M4_EXPRESS
The changes that dominate these numbers are:
Thanks to everyone who contributed to this release: Alan Dragomirecký,
Alexey Shvetsov, Andrew Leech, Andrew Scheller, Antoine Aubert, Boris
Vinogradov, Chris Boudacoff, Chris Fiege, Christian Decker, Damien George,
Daniel Gorny, Dave Hylands, David Michieli, Emilie Feral, Frédéric Pierson,
gibbonsc, Henk Vergonet, iabdalkader, Ihor Nehrutsa, Jan Hrudka, Jan Staal,
jc_.kim, Jim Mussared, Jonathan Hogg, Laurens Valk, leo chung, Lorenzo
Cappelletti, Magnus von Wachenfeldt, Matt Trentini, Matt van de Werken,
Maureen Helm, Michael Bentley, Michael Buesch, Mike Causer, Mike Teachman,
Mike Wadsten, Ned Konz, NitiKaur, oli, patrick, Patrick Van Oosterwijck,
Peter Boin, Peter Hinch, Peter van der Burg, Philipp Ebensberger, Pooya
Moradi, retsyo, robert-hh, roland van straten, Scott Armitage, Sebastian
Wicki, Seon Rozenblum, Sergei Silnov, Simon Baatz, Stewart Bonnick, stijn,
Tobias Thyrrestrup, Tomas Vanek, YoungJoon Chun.
What follows is a detailed list of changes, generated from the git commit
history, and organised into sections.
all:
py core:
extmod:
shared:
drivers:
mpy-cross: no changes specific to this component/port
lib:
docs:
period
and callback
argsexamples: no changes specific to this component/port
tests:
tools:
CI:
all ports:
bare-arm port:
cc3200 port: no changes specific to this component/port
esp8266 port:
esp32 port:
javascript port: no changes specific to this component/port
mimxrt port:
minimal port:
nrf port:
pic16bit port: no changes specific to this component/port
powerpc port: no changes specific to this component/port
qemu-arm port: no changes specific to this component/port
rp2 port:
samd port:
stm32 port:
teensy port:
unix port:
windows port:
zephyr port:
F-strings, new machine.I2S class, ESP32-C3 support and LEGO_HUB_NO6 board
This release of MicroPython adds support for f-strings (PEP-498), with a
few limitations compared to normal Python. F-strings are essentially
syntactic sugar for "".format() and make formatting strings a lot more
convenient. Other improvements to the core runtime include pretty printing
OSError when it has two arguments (an errno code and a string), scheduling
of KeyboardInterrupt on the main thread, and support for a single argument
to the optimised form of StopIteration.
In the machine module a new I2S class has been added, with support for
esp32 and stm32 ports. This provides a consistent API for transmit and
receive of audio data in blocking, non-blocking and asyncio-based
operation. Also, the json module has support for the "separators" argument
in the dump and dumps functions, and framebuf now includes a way to blit
between frame buffers of different formats using a palette. A new,
portable machine.bitstream function is also added which can output a stream
of bits with configurable timing, and is used as the basis for driving
WS2812 LEDs in a common way across ports.
There has been some restructuring of the repository directory layout, with
all third-party code now in the lib/ directory. And a new top-level
directory shared/ has been added with first-party code that was previously
in lib/ moved there.
The docs have seen further improvement with enhancements and additions to
the rp2 parts, as well as a new quick reference for the zephyr port.
The terms master/slave have been replaced with controller/peripheral,
mainly relating to I2C and SPI usage. And u-module references have been
replaced with just the module name without the u-prefix to help clear up
the intended usage of modules in MicroPython.
For the esp8266 and esp32 ports, hidden networks are now included in WLAN
scan results. On the esp32 the RMT class is enhanced with idle_level and
write_pulses modes. There is initial support for ESP32-C3 chips with
GENERIC_C3 and GENERIC_C3_USB boards.
The javascript port has had its Makefile and garbage collector
implementation reworked so it compiles and runs with latest the Emscripten
using asyncify.
The mimxrt port sees the addition of hardware I2C and SPI support, as well
as some additional methods to the machine module. There is also support
for Hyperflash chips.
The nrf port now has full VFS storage support, enables source-line on
traceback, and has .mpy features consistent with other ports.
For the rp2 port there is now more configurability for boards, and more
boards added.
The stm32 port has a new LEGO_HUB_NO6 board definition with detailed
information how to get this LEGO Hub running stock MicroPython. There is
also now support to change the CPU frequency on STM32WB MCUs. And USBD_xxx
descriptor options have been renamed to MICROPY_HW_USB_xxx.
Thanks to everyone who contributed to this release: Amir Gonnen, Andrew
Scheller, Bryan Tong Minh, Chris Wilson, Damien George, Daniel Mizyrycki,
David Lechner, David P, Fernando, finefoot, Frank Pilhofer, Glenn Ruben
Bakke, iabdalkader, Jeff Epler, Jim Mussared, Jonathan Hogg, Josh Klar,
Josh Lloyd, Julia Hathaway, Krzysztof Adamski, Matúš Olekšák, Michael
Weiss, Michel Bouwmans, Mike Causer, Mike Teachman, Ned Konz, NitiKaur,
oclyke, Patrick Van Oosterwijck, Peter Hinch, Peter Züger, Philipp
Ebensberger, robert-hh, Roberto Colistete Jr, Sashkoiv, Seon Rozenblum,
Tobias Thyrrestrup, Tom McDermott, Will Sowerbutts, Yonatan Goldschmidt.
What follows is a detailed list of changes, generated from the git commit
history, and organised into sections.
all:
py core:
extmod:
lib:
drivers:
mpy-cross:
docs:
examples: no changes specific to this component/port
tests:
tools:
CI:
all ports:
bare-arm port: no changes specific to this component/port
cc3200 port: no changes specific to this component/port
esp8266 port:
esp32 port:
javascript port:
mimxrt port:
minimal port:
nrf port:
pic16bit port: no changes specific to this component/port
powerpc port: no changes specific to this component/port
qemu-arm port: no changes specific to this component/port
rp2 port:
samd port:
stm32 port:
teensy port: no changes specific to this component/port
unix port:
windows port:
zephyr port:
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!
all:
py core:
extmod:
lib:
drivers:
mpy-cross: no changes specific to this component/port
docs:
examples: no changes specific to this component/port
tests:
tools:
CI:
bare-arm port:
cc3200 port: no changes specific to this component/port
esp8266 port:
esp32 port:
javascript port: no changes specific to this component/port
mimxrt port:
minimal port: no changes specific to this component/port
nrf port:
pic16bit port:
powerpc port: no changes specific to this component/port
qemu-arm port:
rp2 port:
samd port: no changes specific to this component/port
stm32 port:
teensy port:
unix port:
windows port:
zephyr port:
The esp32 port moves to CMake and has S2 support, new features for rp2
This release of MicroPython adds general support in the core for using
CMake as a build system. The rp2 port is consolidated to use the new
CMake files, and the esp32 and zephyr ports have switched to build as
pure CMake projects. These three ports have SDKs which are built around
CMake and this change should make them easier to maintain and use.
As part of this work, CMake based ports now have support for user C
modules. Authors of user C modules should now provide both .mk and .cmake
configuration files (following the documentation and examples).
A bug was fixed in the multiple precision integer library, an arithmetic
overflow in the long division routine. Prior to this fix certain integer
divisions would take excessive time and produce incorrect results. See
commit 0a59938574502b19b3d685133084399c090d3c11 for details. There was
also a fix for regular expressions, to check and report byte overflow
errors when compiling expressions. See commit
172fb5230a3943eeb6fbbb4de1dc56b16e2a7637.
In the uasyncio library, a new MicroPython extension has been added,
ThreadSafeFlag, which can be set from outside the asyncio event loop,
such as other threads, IRQs or scheduler context. It allows preemptive
code like IRQs to signal asyncio tasks, which are by nature cooperative
(non-preemptive). asyncio.current_task() has also been added, with the
same semantics as CPython.
As mentioned above, the esp32 port has switched to a full CMake-based
project, and traditional make capability has been removed (although a
simple helper Makefile remains to keep top-level build/deploy commands
consistent with other ports). Because of the move to CMake, network.LAN
support has been removed, to be added back in the future (use a prior
release if LAN is needed). Basic support for Non-Volatile-Storage is added
to the esp32 module. And there is also preliminary support for ESP32S2
SoCs and USB, with a GENERIC_S2 board defined.
On the mimxrt and samd ports, USB CDC TX handling has been fixed so that it
now works reliably.
The rp2 port has had many more core Python features enabled, along with the
enabling of ubinascii.crc32(), the uos.VfsFat and machine.Signal classes,
and the uerrno module. uos.urandom() has been added and machine.freq() can
now change the CPU clock frequency. The machine.UART class now has support
for timeout/timeout_char, inverted TX/RX lines, and buffered TX/RX with
configurable sized buffers. For PIO, StateMachine has added restart(),
rx_fifo() and tx_fifo() helper functions, and support for FIFO joining.
There is now support for user C modules (via CMake) and for building
different board configurations (the default remains the PICO board). USB
reliability has been improved.
For the stm32 port, there is now more configuration options for boards,
such as USBD VID/PID and fine-grained selection of modules. The UART class
now supports LPUART on L0, L4, H7 and WB MCUs. WB MCUs have a fix for a
race condition accessing the BLE ACL free buffer list, and a workaround for
a low-level BLE bug.
The zephyr port has been updated to use zephyr v2.5.0, and now builds
MicroPython as a CMake target.
What follows is a detailed list of changes, generated from the git commit
history, and organised into sections.
all:
py core:
extmod:
lib:
drivers: no changes specific to this component/port
mpy-cross: no changes specific to this component/port
docs:
examples:
tests:
tools:
all ports:
bare-arm port:
cc3200 port: no changes specific to this component/port
esp8266 port:
esp32 port:
javascript port: no changes specific to this component/port
mimxrt port:
minimal port: no changes specific to this component/port
nrf port:
pic16bit port: no changes specific to this component/port
powerpc port: no changes specific to this component/port
qemu-arm port: no changes specific to this component/port
rp2 port:
samd port:
stm32 port:
teensy port: no changes specific to this component/port
unix port:
windows port: no changes specific to this component/port
zephyr port:
New rp2 port, BLE pairing, bonding and l2cap APIs, and docs on internals
This release of MicroPython sees the addition of a new "rp2" port for the
new Raspberry Pi RP2040 microcontroller, a dual-core Cortex-M0+ MCU with
programmable IO. This port is built on the pico-sdk and MicroPython sits
very close to the bare metal. The programmable IO is supported via the
@rp2.asm_pio decorator which allows writing inline assembler to be run on
the PIO state machines.
The ubluetooth module has seen significant improvements, fixes and
additions. BLE events are now synchronous on unix and stm32 so that user
Python callbacks are called directly from the BLE stack (from NimBLE).
This helps with the new pairing and bonding API. There is also a new l2cap
API for much faster raw data transfer between BLE devices.
Many new sections have been added to the existing "Developing and building
MicroPython" chapter to make it all about the internals of MicroPython,
including details about the MicroPython compiler, and how to port to a new
system. This documentation work was done as part of Google's Season of
Docs 2020.
The native emitter and inline assembler now fully support ARMv6M, for
Cortex-M0+ CPUs. There is also support added for C++ user modules on
unix, stm32 and esp32. And reproducible builds can now be achieved by
setting SOURCE_DATE_EPOCH in the shell build environment. Qstr
preprocessing is now done in parallel to speed up building, and there is
a new tools/ci.sh script with all functionality to run the continuous
integration tests.
The machine.I2C and machine.SPI classes have been modified so they no
longer construct both software- and hardware-based peripheral instances.
Such construction is now split to explicit soft and non-soft types by the
introduction of machine.SoftI2C and machine.SoftSPI classes. See below for
more information.
The wait_for function in uasyncio now handles cancellation correctly,
VfsLfs supports mounting in read-only mode, and the urandom module will
randomise its seed on import on stm32, esp8266, esp32 and rp2 ports.
A new raw-paste mode is added to the REPL which includes flow control
between the device and host, as well as a mechanism where the device pulls
in data from the host as it parses the input. This makes pasting code
faster, more reliable and use less memory. This feature is supported on
all ports that have a raw REPL and still supports previous REPL behaviour.
See the documentation for more detail on this raw-paste mode.
The stm32 port sees improved rfcore support for WB MCUs, including flash
locking for writes when BLE is active, and a script for automatic update of
FUS/WS firmware. New hooks are added for boards to configure the top level
behaviour of the system in stm32_main, and there is now support for
Ethernet on H7 processors. Mboot now allows signed and encrypted firmware
updates.
Breaking changes in this release are:
The "sys" module is renamed to "usys". Ports that do not enable module
weak links must replace "import sys" with "import usys as sys".
See commit 40ad8f1666b265dafc7844d765f45cfae4b6299f
machine.I2C and machine.SPI constructors are changed when using
software-based I2C and SPI. Code that constructed I2C/SPI peripherals in
the following way will need to be changed (or else their use will emit a
warning which will eventually be an error):
machine.I2C(-1, ...) -> machine.SoftI2C(...)
machine.I2C(scl=scl, sda=sda) -> machine.SoftI2C(scl=scl, sda=sda)
machine.SPI(-1, ...) -> machine.SoftSPI(...)
machine.SPI(sck=sck, mosi=mosi, miso=miso)
-> machine.SoftSPI(sck=sck, mosi=mosi, miso=miso)
Code which uses machine.I2C and machine.SPI classes to access hardware
peripherals does not need to change.
See commits 39d50d129ce428858332523548f0594503d0f45b and
98182a97c5a9229938406beb722966eacceeb823
In ubluetooth, the BLE.irq() method now has positional only arguments.
See commit 6a6a5f9e151473bdcc1d14725d680691ff665a82
In ubluetooth, arguments passed to the BLE.irq() callback that were
previously bytes objects are now memoryview objects.
See commit 81f2162ca0e926c9a4a1787a3863d94d86be0b36
What follows is a detailed list of changes, generated from the git commit
history, and organised into sections.
all:
py core:
extmod:
lib:
drivers:
mpy-cross:
docs:
examples:
tests:
tools:
CI:
all ports:
cc3200 port:
esp8266 port:
esp32 port:
javascript port: no changes specific to this component/port
mimxrt port:
minimal port: no changes specific to this component/port
nrf port:
pic16bit port: no changes specific to this component/port
powerpc port: no changes specific to this component/port
qemu-arm port: no changes specific to this component/port
rp2 port:
samd port: no changes specific to this component/port
stm32 port:
firmware.bin
explicitteensy port:
unix port:
windows port:
zephyr port:
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 37e1b5c891f9964bb6c95228bc2d718511507a69
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/library/ubluetooth.html#ubluetooth.BLE.irq
See also commit e6881f08292d03f089185718c131f543d095089b
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 dd0bc26e65734b8a4fafa3769008e92e2ec6645d
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 e0905e85a7ad2961aa9192f6130565860e531ad3
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 0bd58a56137bd9124756ed0f57b4213daccfc7d5
For the unix port, binaries are renamed to micropython-variant (no longer
micropython_variant).
See commit 977b532c8fcd1a9e12844dd4f9cc2d70341013d7
What follows is a detailed list of changes, generated from the git commit
history, and organised into sections.
all:
py core:
extmod:
lib:
drivers:
mpy-cross:
docs:
\*
to *
in argument listsexamples:
tests:
tools:
CI:
all ports:
cc3200 port: no changes specific to this port
esp8266 port:
esp32 port:
javascript port: no changes specific to this port
mimxrt port:
minimal port:
nrf port:
pic16bit port: no changes specific to this port
powerpc port:
qemu-arm port:
samd port:
stm32 port:
teensy port: no changes specific to this port
unix port:
windows port:
zephyr port:
PYBD boards, BLE and littlefs, dynamic native modules, samd and powerpc
This release sees a reduction in overall bytecode size due to compression
of the bytecode prelude, saving 7 bytes of bytecode per function for
roughly 80% of functions. The bytecode opcode values are also redefined to
group them based on their argument size and format. Support is also added
for the matrix multiplication operator "@" (PEP 465).
The .mpy file format moved to version 5 to support the new bytecode
encoding, and added support for relocation of native machine code, along
with separate rodata and BSS sections. This allows a MicroPython system to
import dynamic native modules, .mpy files that are generated from C code.
Examples of this feature are provided in "examples/natmod/" and
documentation in "docs/develop/natmod.rst".
Some code-size saving optimisations were implemented leading to a reduction
in size of minimal firmware: bare-arm reduced by 584 bytes, minimal x86 by
5476 bytes (partly due to changed compiler optimisation flags) and minimal
ARM Thumb 2 by 1440 bytes (all measured with gcc 9.2.0).
A new mechanism to freeze scripts into firmware is provided - a frozen
manifest - whereby scripts to freeze are listed in a Python file (eg
manifest.py). All ports are updated to use this new feature.
When weak module links are enabled (via MICROPY_MODULE_WEAK_LINKS) an
import will now automatically search for the built-in u-variant of a module
if the non-u-variant fails (eg searches for "ufoo" if "foo" fails), so
ports no longer provide an explicit list of these. The unix and windows
ports now enable this feature.
A performance benchmarking test suite is added which can be used to compare
changes in absolute performance when optimising features, as well as
compare across different ports. See "tests/run-perfbench.py".
Bluetooth (BLE only) support is added via the "ubluetooth" module and
provides the ability to implement the four BLE roles. The BLE stack is
used is Mynewt Nimble and it currently runs on PYBD boards, STM32WB55 MCUs
and ESP32 boards.
Support for littlefs filesystems is added through the MicroPython VFS
interface, and it works on the unix, stm32, esp8266 and esp32 ports.
A new "machine.ADC.read_u16()" method is defined and implemented on stm32,
esp8266, esp32 and nrf ports, providing a consistent way to read an ADC
that returns a value in the range 0-65535. This new method should be
preferred to the existing "ADC.read()" method.
The stm32 port sees support for the new PYBD range of pyboards which
include a fully integrated CYW43xx WiFi/BT chip. USB is enhanced to
support VCP+MSC+HID mode and up to 3x simultaneous VCP interfaces. Support
is also added for STM32WBxx MCUs including BLE. There is a new machine.ADC
class which is compatible with other ports, along with a new machine.Timer
class that implements a software timer with millisecond resolution and
number of active timers only limited by RAM. Support for littlefs is
available by default via uos.VfsLfs2. Documentation for using littlefs is
found in "docs/reference/filesystem.rst".
The esp8266 port has switched to use per-board configurations and builds,
as well as the new frozen manifest feature. It also has optional littlefs
support (requires a separate build).
The esp32 port has the following new features: native code generation,
machine.SDCard, hardware I2C, mDNS queries and responder, esp32.Partition,
esp32.RMT, BLE (requires IDF v4), and built-in support for VfsLfs2. It has
switched to use per-board configurations and builds, and frozen manifests.
The default SSL output buffer is resized from 16kiB down to 4kiB to save
RAM.
There are new, minimal ports to Microchip SAMDxx microcontrollers, and
the bare metal PowerPC architecture.
A code-of-conduct based on the PSF's code is added in CODEOFCONDUCT.md.
The following new Git submodules are added: mbedtls, asf4, tinyusb,
mynewt-nimble. And a new third-party library: littlefs.
A detailed list of changes follows.
py core:
extmod:
data_alloc
length to truncate writeslib:
drivers:
tools:
tests:
mpy-cross:
all ports:
minimal port:
unix port:
windows port:
qemu-arm port:
stm32 port:
esp8266 port:
esp32 port:
javascript port:
nrf port:
powerpc port:
samd port:
zephyr port:
docs:
travis:
examples:
miscellaneous:
Improved mpy format with support for native code, and new JavaScript port
In this release the mpy file format has been moved to version 4 and has
some significant improvements: mpy file size is reduced on average by about
35%, loading time of mpy files is reduced by about 40%, and they now have
support to save native, viper and inline assembler code (or machine code
generated from any other source). Size reduction of mpy files was achieved
by adding a qstr window to reuse past qstrs when encoding them, by packing
qstrs directly in the bytecode, and by defining a static qstr set.
Some VM opcodes were also changed to fix a bug when doing a break/continue
out of a finally block, and to make some simplifications. In particular
POP_BLOCK and POP_EXCEPT opcodes were replaced with POP_EXCEPT_JUMP.
Most uppercase macros have been converted to lowercase to make a more
consistent C API, including all MP_OBJ_IS_xxx and MP_xxx_SLOT_IS_FILLED
macros.
The default PYTHON makefile variable is now changed from "python" to
"python3", but Python 2 is still supported via "make PYTHON=python2".
The mpy-cross compiler supports the new mpy version 4 and has new command
line options: "-march=" to select the native emitter, and "--version"
to print the MicroPython version and the mpy version. Also mpy-tool.py has
support for freezing native code.
A module system for external, user C modules has been implemented and
documentation for this is available in the new "docs/develop" section.
A new "javascript" port has been added which targets JavaScript as the
machine via Emscripten. This allows to run MicroPython as an application
within node.js, and to run it within a browser (among other things).
All bare-metal ports have the following improvements: machine.sleep() is
now machine.lightsleep(), and both lightsleep() and deepsleep() now take an
optional argument which is the maximum time to sleep in milliseconds.
These ports also now allow freezing of boot.py and main.py using the usual
methods. And a new I2C method i2c.writevto(addr, vect) is added which can
be used to write a tuple/list of buffers all at once to an I2C device.
The stm32 port now has a fully integrated Ethernet MAC driver (see the
network.LAN class) using lwIP for the TCP/IP stack, and sockets were made
significantly more robust. Support for F413 MCUs was added. There are
also some minor user-facing changes to this port:
For the esp32 port, the build process has been updated to align better with
the ESP IDF and now uses sdkconfig to configure features. Dual core mode
is now enabled by default, SPIRAM is in memory-mapped mode so all of it can
be used for the MicroPython heap, there is support to change the CPU
frequency, and the WDT now panics and resets the device if it times out.
A detailed list of changes follows.
py core:
extmod:
websocket
to uwebsocket
lib:
drivers:
tools:
tests:
mpy-cross:
all ports:
unix port:
windows port:
qemu-arm port:
stm32 port:
cc3200 port:
esp8266 port:
esp32 port:
javascript port:
nrf port:
zephyr port:
docs:
travis:
Vast improvements to native emitter, new nrf port, unified documentation
In this release there are a wide range of improvements and additions to
both the core and the ports. In the core the main improvement was to the
native emitter to have much more comprehensive support for general Python
features, such as generators and complex exception handling, and the
generated machine code is smaller and retains its efficiency. Elsewhere,
fuzzy testing was used to find and eliminate some corner-case bugs, user
classes were optimised when they don't use special accessors, underscores
in numeric literals are now supported (PEP515), and the uio.IOBase class
was added to allow user defined streams.
For the extended modules there is now a VfsPosix filesystem component,
a new ucryptolib module with AES support, addition of ure.sub() and of
uhashlib.md5, and the lwIP socket implementation now has working TCP
listen/accept backlog.
Compared to the last release the minimal baseline core code size is reduced
by about 2.2%, down by roughly 1500 bytes for bare-arm port and 3500 bytes
for minimal x86 port. Most other ports have increased in size due to the
addition of new features (eg ucryptolib, ure.sub).
The stm32 port sees the introduction of a new bootloader -- mboot -- which
supports DFU upload via USB FS, USB HS, as well as a custom I2C protocol,
and also support to program external SPI flash. There is significant
refactoring of the USB device driver, improved VCP throughput, and support
for 2x VCP interfaces on the one USB device. lwIP has been integrated, and
support added for SDRAM. Cortex-M0 CPUs are now supported along with
STM32F0 MCUs.
For the esp8266 port the heap is increased by 2kbytes, the radio is
automatically put to sleep if no WLAN interfaces are active, and the UART
can now be disconnected from the REPL and its RX buffer length configured.
Upon soft-reset sockets are now cleaned up.
The esp32 port has added support for external SPI RAM, PPPoS functionality,
improved performance and stability when using threads, and other general
bug fixes.
There is a new nrf port for Nordic MCUs, currently supporting nRF51x and
nRF52x chips.
The docs have now been unified so there is just one set of documentation
covering all ports. And initial documentation for the esp32 port is added.
There are two changes at the Python API level that are not backwards with
previous versions:
A detailed list of changes follows.
py core:
extmod:
lib:
drivers:
tools:
tests:
mpy-cross:
minimal port:
unix port:
windows port:
stm32 port:
cc3200 port:
esp8266 port:
esp32 port:
nrf port:
pic16bit port:
teensy port:
zephyr port:
docs:
travis:
examples:
README:
Parser size reduced, new Python stack, stm32 improvements, new esp32 port
This release brings some significant size reductions to the parser, as well
as removal of unused code and additional tests to improve coverage of the
core. A new optional, internal Python stack is introduced for scoped
allocation and can be used instead of alloca to provide more efficient and
flexible temporary memory; see MICROPY_ENABLE_PYSTACK. There have been
many improvements and internal code refactors of the stm32 port, and the
port to the Espressif ESP32 SoC has been merged from its development
repository.
Compared to the last release the change in code size is (in bytes, using
gcc 7.3):
bare-arm: -1832
minimal x86: -2608
unix x64: -5129
unix nanbox: +1024
stm32: +2120
cc3200: -928
esp8266: +336
The decrease is mainly due to the reduced size of the parser, where the
table of rule pointers was compressed to a table of offsets. The increase
in the stm32 and esp8266 ports is due to additional features, such as more
colour formats in the framebuf module and the addition of ujson.dump().
Code coverage (measured by gcov) has improved since the last version
(v1.9.3 on the left, v1.9.4 on the right):
py: 15202/15447 = 98.4% -> 15391/15513 = 99.2%
extmod: 2227/ 2363 = 94.2% -> 2291/ 2430 = 94.3%
Changes and additions seen by the Python user include: improvement of dir()
and tab-completion to list all available attributes of an object; addition
of efficient ucollections.deque type with fixed size; better handling and
polling support of sockets that get into an error state; implementation of
key and cert keyword arguments in ussl.wrap_socket (for axtls);
uos.ilistdir now return 4-tuples with the file size in the fourth position.
Changes at the C level include: removal of "make_qstr_if_not_already"
argument from mp_obj_new_str; rename of mp_exc_recursion_depth to
mp_raise_recursion_depth; removal of mp_const_MemoryError_obj; switching
of stream close operation from method to ioctl; refactoring of how native
emitter code is compiled with a file per architecture.
The stm32 port has seen a lot of improvements and additions, as well as
some significant internal refactoring to better support configuring custom
boards. STM32F7 support is improved, USB HS is supported for F723 and
F733, the CAN class has improvements to handle bus errors, ctrl-C can
now interrupt running code when the REPL is over UART, and the ADC class
added the read_timed_multi static method. Board configuration has seen
some internal changes, in particular with setting LD_FILES, TEXT0_ADDR,
and TEXT1_ADDR in mpconfigboard.mk (previously LD_FILE, FLASH_ADDR,
TEXT_ADDR). The pin_X and pyb_pin_X identifiers have been changed to be
pointers to objects rather than objects, and main is renamed to stm32_main.
A detailed list of changes follows.
py core:
extmod:
lib:
drivers:
tools:
tests:
minimal port:
unix port:
windows port:
qemu-arm port:
stm32 port:
teensy port:
esp8266 port:
esp32:
zephyr port:
docs:
travis:
Introduction of ports subdirectory where all ports are moved to
The main change in this release is the introduction of a "ports/"
subdirectory at the top-level of the repository, and all of the ports are
moved here. In the process the "stmhal" port is renamed to "stm32" to
better reflect the MCU that it targets. In addition, the STM32 CMSIS and
HAL sources are moved to a new submodule called "stm32lib".
The bytecode has changed in this release, compared to the previous release,
and as a consequence the .mpy version number has increased to version 3.
This means that scripts compiled with the previous mpy-cross must be
recompiled to work with this new version.
There have also been various enhancements and optimisations, such as:
check for valid UTF-8 when creating str objects, support for reverse
special binary operations like radd, full domain checking in the math
module, support for floor-division and modulo in the viper emitter,
and addition of stack overflow checking when executing a regex.
The stm32 port sees improved support for F7 MCUs, addition of a new board
B_L475E_IOT01A based on the STM32L475, and support for the Wiznet W5500
chipset along with improved socket behaviour.
A detailed list of changes follows.
py core:
extmod:
lib:
drivers:
tools:
tests:
unix port:
stm32 port:
cc3200 port:
esp8266 port:
zephyr port:
pic16bit port:
docs:
travis:
examples:
all:
README:
.gitattributes:
Double precision math library and support on pyboard, and improved ussl
This release brings general improvements and bug fixes to the core and
various ports, as well as documentation additions, clean-ups and better
consistency. And effort has been made to clean up the source code to
make it more consistent across the core and all ports.
There is a new tool "mpy_bin2res.py" to convert arbitrary (binary) files
to Python resources for inclusion in source code (frozen or otherwise).
The ussl module has seen improvements, including implementation of
server_hostname (for axtls) and server_side mode (for mbedtls).
There is now a double-precision float math library and stmhal has support
to build firmware with software or hardware double-precision.
A detailed list of changes follows.
py core:
extmod:
lib:
drivers:
tools:
tests:
minimal port:
unix port:
stmhal port:
cc3200 port:
esp8266 port:
zephyr port:
docs:
all:
README:
CODECONVENTIONS:
travis:
Fixes for stmhal USB mass storage, lwIP bindings and VFS regressions
This release provides an important fix for the USB mass storage device in
the stmhal port by implementing the SCSI SYNCHRONIZE_CACHE command, which
is now require by some Operating Systems. There are also fixes for the
lwIP bindings to improve non-blocking sockets and error codes. The VFS has
some regressions fixed including the ability to statvfs the root.
All changes are listed below.
py core:
extmod:
lib:
tests:
unix port:
windows port:
qemu-arm port:
stmhal port:
cc3200 port:
teensy port:
esp8266 port:
zephyr port:
docs:
examples:
New VFS subsystem and scheduling framework, and less need for the heap
This release adds some fundamental new components, allows for more Python
operations without using the heap and has reduced code size and stack
usage.
Changes in the way iterators are handled allows to iterate without
allocating on the heap for the types: tuple, list, str, bytes, bytearray,
array, dict, set, frozenset. It also allows to call the builtins all, any,
min max and sum without allocating heap memory for the iterator argument.
And improvements to the handling of super() means that super().foo() method
calls are now heap-less.
A new generic VFS subsystem has been added which allows to mount arbitrary
filesystems (even written in Python) at the root or at a mount-point within
the root. The FatFS driver has been replaced with an object-oriented
version (oofatfs) which allows a fully customisable filesystem layout.
A scheduling framework has been implemented in the core which gives the
ability to schedule callbacks to be called "as soon as possible". This
allows ports to implement "soft IRQs" which allow the programmer to
allocate memory during an interrupt handler, at the cost of some
performance related to response time of the handler. The new
micropython.schedule() function gives access to the scheduler.
Other improvements to the core include: consts can now be big-nums, for
example "X = const(1 << 100)"; addition of "help('modules')" to list
available modules; stack usage reduced for a Python call by 8 bytes on ARM
Cortex-M architectures; micropython.kbd_intr() function added to disable
Ctrl-C capture; addition of uio.resource_stream(); mpy-cross is built
automatically if needed; a helper tool mpy_cross_all.py is added to run
mpy-cross on an entire project.
The bytecode has changed in this version so existing .mpy files will need
recompiling. There have also been some changes to the C API, most notably
with mp_uint_t changed to size_t in many places.
In the extended modules the following main changes have been made: addition
of machine.Signal class to allow inversion on a Pin; framebuf has new
formats of the form MONO_xxx; addition of uselect.ipoll() for allocation-
free polling; addition of uos.ilistdir() for efficient iteration of a
directory listing; machine.Pin high/low methods are renamed to on/off in
esp8266 and zephyr (this is a backwards-incompatible change);
machine.time_pulse_us() function no longer throws exceptions, but returns
negative values instead.
For stmhal the pyb.fault_debug() function is added, and default behaviour
for a hard-fault is now an immediate reset. There is better support for F7
MCUs, in particular DMA and SD card support. A bug has been fixed with the
USB VCP (USB serial) where it would in rare cases (usually when the host PC
was under load) would lose characters. Pyboard now automatically mounts
all available partitions on the SD card. Multithreading has been
implemented and is available via the _thread module, but this feature is
disabled by default and must be enabled at compile time using the
MICROPY_THREAD and MICROPY_THREAD_GIL options. The ability to skip booting
from SD card is now available by creating an empty file on the flash called
"SKIPSD".
The cc3200 port has had some backwards incompatible changes, in particular
with I2C, Pin, UART and uos. Please see the documentation for the new
behaviour.
The esp8266 port has had a change in the size of the firmware in order to
accommodate additional features. As such the filesystem for this version
is incompatible with v1.8.7 and a device requires backup and erasure before
flashing this version. Soft IRQs are now implemented for Pin and Timer
callbacks, along with the general improvements described above.
In the documentation there is now a section describing the differences
between MicroPython and CPython. And code coverage is up to 98% across py/
and extmod/.
Changes in code size (in bytes) between v1.8.7 and this version are:
bare-arm: -1104
minimal: -1324
unix x64: -1115
unix nanbox: -11106
stmhal: +18116
cc3200: +1032
esp8266: +3060
Note that stmhal has increased significantly due to the addition of frozen
bytecode and the LCD160CR driver.
A detailed list of changes follows.
py core:
extmod:
lib:
drivers:
tools:
tests:
mpy-cross:
bare-arm port:
minimal port:
unix port:
windows port:
qemu-arm port:
stmhal port:
cc3200 port:
teensy port:
esp8266 port:
zephyr port:
pic16bit port:
README:
travis:
gitattributes:
docs:
examples:
Support for Xtensa emitter and assembler, and upgraded F4 and F7 STM HAL
This release adds support for the Xtensa architecture as a target for the
native emitter, as well as Xtensa inline assembler. The int.from_bytes
and int.to_bytes methods now require a second argument (the byte order)
per CPython (only "little" is supported at this time). The "readall"
method has been removed from all stream classes that used it; "read" with
no arguments should be used instead. There is now support for importing
packages from compiled .mpy files. Test coverage is increased to 96%.
The generic I2C driver has improvements: configurable clock stretching
timeout, "stop" argument added to readfrom/writeto methods, "nack"
argument added to readinto, and write[to] now returns num of ACKs
received. The framebuf module now handles 16-bit depth (generic colour
format) and has hline, vline, rect, line methods. A new utimeq module is
added for efficient queue ordering defined by modulo time (to be
compatible with time.ticks_xxx functions). The pyboard.py script has been
modified so that the target board is not reset between scripts or commands
that are given on a single command line.
For the stmhal port the STM Cube HAL has been upgraded: Cube F4 HAL to
v1.13.1 (CMSIS 2.5.1, HAL v1.5.2) and Cube F7 HAL to v1.1.2. There is a
more robust pyb.I2C implementation (DMA is now disabled by default, can be
enabled via an option), and there is an implementation of machine.I2C with
robust error handling and hardware acceleration on F4 MCUs. It is now
recommended to use machine.I2C instead of pyb.I2C. The UART class is now
more robust with better handling of errors/timeouts. There is also more
accurate VBAT and VREFINT measurements for the ADC. New boards that are
supported include: NUCLEO_F767ZI, STM32F769DISC and NUCLEO_L476RG.
For the esp8266 port select/poll is now supported for sockets using the
uselect module. There is support for native and viper emitters, as well
as an inline assembler (with limited iRAM for storage of native functions,
or the option to store code to flash). There is improved software I2C
with a slight API change: scl/sda pins can be specified as positional only
when "-1" is passed as the first argument to indicate the use of software
I2C. It is recommended to use keyword arguments for scl/sda. There is
very early support for over-the-air (OTA) updates using the yaota8266
project.
A detailed list of changes follows.
py core:
extmod:
lib:
drivers:
tools:
tests:
unix port:
windows port:
stmhal port:
cc3200 port:
esp8266 port:
zephyr port:
docs:
travis:
examples:
ESP8266 port uses SDK 2.0, has more heap, has support for 512k devices
This release brings some code size reductions to the core as well as
more tests and improved coverage which is now at 94.3%.
The time.ticks_diff(a, b) function has changed: the order of the arguments
has been swapped so that it behaves like "a - b", and it can now return a
negative number if "a" came before "b" (modulo the period of the ticks
functions).
For the ESP8266 port the Espressif SDK has been updated to 2.0.0, the
heap has been increased from 28k to 36k, and there is support for 512k
devices via "make 512k". upip is included by default as frozen bytecode.
The network module now allows access-point reconnection without WiFi
credentials, and exposes configuration for the station DHCP hostname. The
DS18B20 driver now handles negative temperatures, and NeoPixel and APA102
drivers handle 4 bytes-per-pixel LEDs.
For the CC3200 port there is now support for loading of precompiled .mpy
files and threading now works properly with interrupts.
A detailed list of changes follows.
py core:
extmod:
lib:
drivers:
tools:
tests:
minimal port:
unix port:
windows port:
qemu-arm port:
stmhal port:
cc3200 port:
teensy port:
esp8266 port:
zephyr port:
docs:
travis:
examples:
New port to Zephyr, upip runs on baremetal, and reduction in code size
This release adds a new port of MicroPython to run on top of the Zephyr
real-time operating system. As part of this there is now basic support for
using mbedTLS as the ussl module. The release also brings initial support
for running the package manager upip on baremetal systems with low heap
memory (such as esp8266), through a Python module interface.
Work has been done in this release to clean up the core, removing redundant
and/or unreachable code, and factoring existing duplicated code patterns.
This brings a reduction of 828 bytes in code size to the bare-arm port, and
1368 bytes to the minimal port. There is also improved coverage through
the addition of new tests for corner cases.
The "micropython" module sees the addition of the "const" identity function
which should be used as "from micropython import const" in scripts that
want to use the MicroPython constant optimisations in the compile stage.
There is also the addition of the "opt_level" function to change the
parser/compiler optimisation level at runtime.
The behaviour of "sys.exit" (and "raise SystemExit") on baremetal is now
changed: this function no longer does a soft-reset of the board, rather it
just stops the running script and drops to the REPL. In order to do an
actual soft reset the "machine.soft_reset" function has been added (to the
stmhal port only, for the time being).
Following CPython, KeyError exceptions for dictionary lookups now have the
failed key stored as the argument of the exception instance, accessible as
exc.args[0]. The "ujson.load" function has also been added, to load JSON
data from an arbitrary stream.
The I2C support in the machine module now has clock stretching, the
addition of the "addrsize" parameter in memory transfer methods, and I2C
scanning now uses dummy writes instead of dummy reads to make the scanning
more reliable.
The CMSIS library has been upgrade to v4.30, and the boards section of
the stmhal port has been refactored to use a common.ld script. The stmhal
port now has a full implementation of the machine.SPI class, with support
for both hardware SPI peripherals and fast software SPI. The USB HID
driver in stmhal has added support to receive USB HID messages from the
host.
py core:
extmod:
lib:
drivers:
tools:
tests:
unix port:
windows port:
qemu-arm port:
stmhal port:
cc3200 port:
esp8266 port:
zephyr port:
README:
docs:
travis:
examples:
Support for stream decompression in uzlib, and more ESP8266 features
This release includes some bug fixes, code clean-up, updates to the docs,
more tests, and various feature additions. The uzlib module now supports
efficient stream decompression in the form of the uzlib.DecompIO class.
Freezing of bytecode now supports floats for the ESP8266 port, as well as
complex numbers for all ports. The stmhal port has ADC working on L4
microcontrollers, fixed initialisation for DAC, and addition of the
machine.WDT class and machine.reset_cause function.
For the ESP8266 port Pin(16) now works as an input pin and the hardware
SPI peripheral is exposed as machine.SPI(1). The os.umount function is
implemented and the port supports mounting of externally connected SD
cards. The machine.WDT class is added, wlan.scan() is fixed to return all
access points, and there is support for DS18S20 devices.
py core:
extmod:
lib:
drivers:
tools:
tests:
unix port:
qemu-arm port:
stmhal port:
cc3200 port:
teensy port:
esp8266 port:
docs:
misc: