Forum | Documentation | Website | Blog

Skip to content
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.

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

all:
- reformat C and Python source code with tools/codeformat.py
- convert exceptions to use mp_raise_XXX helpers in remaining places
- remove spaces between nested paren and inside function arg paren
- remove spaces inside and around parenthesis
- fix implicit casts of float/double, and signed comparison
- use MP_ERROR_TEXT for all error messages
- clean up error strings to use lowercase and change cannot to can't
- fix implicit floating point promotion
- fix implicit conversion from double to float
- fix implicit floating point to integer conversions
- enable extra conversion warnings where applicable
- remove commented-out include statements
- format code to add space after C++-style comment start
- factor gchelper code to one place and use it for unix & ARM ports
- fix auto-enable of MICROPY_GCREGS_SETJMP to select GC behaviour
- update Python code to conform to latest black formatting

py core:
- remove commented-out debug printf's from emitbc and objlist
- obj.h: remove comments about additional mp_buffer_info_t entries
- objobject: add object.__setattr__ function
- objobject: add object.__delattr__ function
- nlrx86: silence possible warnings about unused nlr argument
- asmx86: fix stack to be 16-byte aligned for entry and sub-call
- asmx86: remove unused 5th argument facility
- runtime: don't allocate iter buf for user-defined types
- objsingleton: use mp_generic_unary_op for singleton objects
- introduce MP_ROM_NONE macro for ROM to refer to None object
- introduce MP_ROM_FALSE/MP_ROM_TRUE for ROM to refer to bool objects
- objstr: don't use inline GET_STR_DATA_LEN for object-repr D
- obj.h: use 32-bit shift in MP_OBJ_NEW_QSTR calc for obj-repr D
- clean up commented-out code and comments about exception hierarchy
- objslice: add support for indices() method on slice objects
- objslice: inline fetching of slice paramters in str_subscr()
- make mp_obj_get_type() return a const ptr to mp_obj_type_t
- mkenv.mk: move usage of 32-bit flags to py.mk
- unicode: add unichar_isalnum()
- runtime: move MICROPY_PORT_INIT_FUNC near the end of mp_init()
- nativeglue: use mp_const_X instead of &mp_const_X_obj
- obj.h: redefine qstr object encoding to add immediate obj encoding
- obj: add MICROPY_OBJ_IMMEDIATE_OBJS option to reduce code size
- obj: optimise mp_obj_get_type for immediate objs with repr A and C
- mpconfig.h: define BITS_PER_BYTE only if not already defined
- objint: add mp_obj_int_get_uint_checked() helper
- pairheap: add generic implementation of pairing heap data structure
- gc: don't include or init gc_mutex when GIL is enabled
- qstr: don't include or init qstr_mutex when GIL is enabled
- objgenerator: use mp_obj_new_exception_arg1 to make StopIteration
- objexcept: optimise mp_obj_new_exception[_arg1/_args] functions
- obj.h: add and use mp_obj_is_bool() helper
- release GIL during syscalls in reader and writer code
- emitnative: use NULL for pending exception (not None)
- emitnative: stop after finding an unwind target
- mpthread.h: use strong type for mp_thread_set_state() argument
- objtype: make mp_obj_type_t.flags constants public, moved to obj.h
- support non-boolean results for equality and inequality tests
- compile: allow 'return' outside function in minimal builds
- scheduler: add "raise_exc" argument to mp_handle_pending
- scheduler: move mp_keyboard_interrupt from lib/utils to py core
- scheduler: allow a port to specify attrs for mp_keyboard_interrupt
- scheduler: move clearing of kbd traceback to mp_keyboard_interrupt
- expand type equality flags to 3 separate ones, fix bool/namedtuple
- add mp_raise_type helper macro and use it where appropriate
- add mp_raise_msg_varg helper and use it where appropriate
- factor out definition of mp_float_union_t to one location
- objexcept: rename mp_obj_new_exception_msg_varg2 to ..._vlist
- objtuple: remove code that handles tuple-subclass equality test
- objtype: allow mp_instance_cast_to_native_base to take native obj
- dynruntime.h: add implementation of mp_obj_cast_to_native_base
- objarray: turn on MP_TYPE_FLAG_EQ_CHECKS_OTHER_TYPE for memoryview
- removing dangling "else" to improve code format consistency
- bc0.h: shift comment to start of line to improve format consistency
- builtinimport: adjust if-block order in find_file to clean up #if's
- malloc: put { on separate line for funcs that have selective sigs
- un-nest configuration #if/#endif's for selection of complex code
- parse: add parenthesis around calculated bit-width in struct
- builtinevex: support passing in a bytearray/buffer to eval/exec
- objstr: remove duplicate % in error string
- objstringio: expose tell() on StringIO and BytesIO objects
- modmicropython: add heap_locked function to test state of heap
- stream.h: include sys/types.h to get size_t and off_t for POSIX API
- mpconfig.h: enable MICROPY_MODULE_GETATTR by default
- pairheap: properly unlink node on pop and delete
- pairheap: add helper function to initialise a new node
- use preprocessor to detect error reporting level (terse/detailed)
- dynruntime.mk: set MICROPY_ENABLE_DYNRUNTIME instead of per module
- implement "common word" compression scheme for error messages
- objexcept: allow compression of exception message text
- parse: remove unnecessary check in const folding for ** operator
- objexcept: remove optional TimeoutError exception
- scheduler: fix race in checking scheduler pending state
- scheduler: add assert that scheduler is locked when unlocking
- makecompresseddata.py: don't prefix str with mark if not compressed
- scope: add assert to check that low numbered qstrs do fit in uint8_t
- always give noop defines when MICROPY_ROM_TEXT_COMPRESSION disabled
- objarray: fix sign mismatch in comparison
- objint: do not use fpclassify
- makecompresseddata.py: make compression deterministic
- objdict: fix popitem for ordered dicts
- stream: remove mp_stream_errno and use system errno instead
- modio: allow uio.IOBase streams to return errno for read/write error
- scheduler: add option to wrap mp_sched_schedule in arbitrary attr
- parse: support constant folding of power operator for integers
- scheduler: convert mp_sched_full and mp_sched_num_pending to macros
- parse: make mp_parse_node_extract_list return size_t instead of int
- nativeglue.h: rename "setjmp" entry to "setjmp_" to avoid any clash
- py.mk: use additional CFLAGS to compile string0.c
- modmath: work around msvc float bugs in atan2, fmod and modf
- ringbuf: fix compilation with msvc
- modsys: use consistent naming pattern for module-level const objects
- modbuiltins: fix getattr to work with class raising AttributeError
- dynruntime.h: make mp_obj_str_get_str raise if arg not a str/bytes
- objtype: add __dict__ attribute for class objects
- objtype: use mp_obj_dict_copy() for creating obj.__dict__ attribute
- obj.h: clarify comments about mp_map_t is_fixed and is_ordered
- compile: convert scope test to SCOPE_IS_COMP_LIKE macro
- compile: implement PEP 572, assignment expressions with := operator
- grammar.h: consolidate duplicate sub-rules for :test and =test
- compile: implement PEP 526, syntax for variable annotations
- misc.h: add missing semi-colon in mp_float_union_t for big-endian
- obj.h: add public mp_obj_is_dict_or_ordereddict() helper macro
- objtype: support passing in an OrderedDict to type() as the locals
- asm: add funcs/macros to emit machine code for logical-shift-right
- asm: add condition codes for signed comparisons
- emitnative: implement binary operations for viper uint operands
- objcomplex: add mp_obj_get_complex_maybe for use in complex bin-op
- obj.h: make existing MP_TYPE_FLAG_xxx macros sequential
- rework mp_convert_member_lookup to properly handle built-ins
- obj.h: fix mp_seq_replace_slice_no_grow to use memmove not memcpy
- compile: don't await __aiter__ special method in async-for
- persistentcode: maintain root ptr list of imported native .mpy code
- runtime: fix builtin compile() in "single" mode so it prints exprs
- mphal.h: introduce mp_hal_time_ns and implement on various ports

extmod:
- uzlib: explicitly cast ptr-diff-expr to unsigned
- fix modbluetooth and modwebrepl to build in nanbox mode
- modbluetooth: fix func prototype, empty args should be (void)
- vfs_posix: release GIL during system calls
- modbluetooth: implement config getter for BLE rxbuf size
- modbluetooth.h: fix typo in comment about registering services
- modbluetooth_nimble: fix wrong offset used for descriptor flags
- modframebuf: allow blit source to be a subclass of FrameBuffer
- modbluetooth_nimble: move nimble specific code, factor nimble.mk
- modbluetooth: extract out gatts_db functionality from nimble
- btstack: add empty modbluetooth implementation
- btstack: implement advertising
- btstack: implement service registration
- btstack: implement gatts_db for btstack
- btstack: implement scan and gatt client, connect and disconnect
- btstack: implement notifications/indications for GATT clients
- nimble: clarify active state and check for active in all methods
- modbluetooth: unify error handling in remaining places
- modbluetooth: change scan result's "connectable" to "adv_type"
- nimble: when getting BLE MAC try public address if random fails
- vfs: factor out vfs mount-and-chdir helper from stm32
- modlwip: fix polling of UDP socket so it doesn't return HUP
- modlwip: properly handle non-blocking and timeout on UDP recv
- vfs_posix_file: lock GIL when writing and allow stdio flush
- vfs_posix_file: include unistd.h to get STD{IN,OUT,ERR}_FILENO
- uasyncio: add new implementation of uasyncio module
- uasyncio: add optional implementation of core uasyncio in C
- uasyncio: add manifest.py for freezing uasyncio Py files
- uasyncio: don't create a Loop instance in get_event_loop()
- uasyncio: implement Loop.stop() to stop the event loop
- uasyncio: add error message to Lock.release's RuntimeError
- uasyncio: add StreamReader/StreamWriter as aliases of Stream cls
- uasyncio: add global exception handling methods
- modubinascii: make code private and module self-contained
- btstack: pass through SCAN_RSP events
- modbluetooth: provide FLAG_WRITE_NO_RESPONSE for characteristics
- uasyncio: add Loop.new_event_loop method
- uasyncio: change cannot to can't in error message, and test exp
- nimble: update to work with NimBLE 1.3
- modbluetooth: don't hold atomic section during mp_sched_schedule
- btstack: implement more robust init/deinit sequencing
- modbluetooth: fix sign compare and unused variable warnings
- modbtree: retain reference to underlying stream so it's not GC'd
- vfs_lfsx: fix path handling in uos.stat() to consider cur dir
- vfs_lfsx: normalize path name in chdir
- vfs_lfsx: fix rename to respect cur dir for new path
- modbluetooth: add support for changing the GAP device name
- nimble: make error code mapping default to MP_EIO
- vfs_lfsx: fix import_stat so it takes into account current dir
- vfs: retain previous working directory if chdir fails
- modbluetooth: make modbluetooth event not a bitfield
- modbluetooth: add discover complete events for svc/char/desc
- modbluetooth: allow discovery of svc/char by uuid
- modbluetooth: implement read done event
- modbluetooth: ensure status=0 always on success
- modbluetooth: support bigger characteristic values
- ure: use single function for match/search/sub
- uasyncio: add asyncio.wait_for_ms function
- modbluetooth: register default GATT service and fix esp32 init
- moductypes: use mp_obj_is_dict_or_ordereddict to simplify code
- vfs_lfs: fix littlefs bindings to build in nan-box mode
- nimble: fix attr NULL ptr dereference in ble_gatt_attr_read_cb
- btstack: schedule notify/indicate/write ops for bg completion
- modbluetooth: ignore unused self_in in ble_gatts_indicate
- modbluetooth: fix so it builds in peripheral-only mode
- modbluetooth: add event for "indicate acknowledgement"
- modussl: improve exception error messages
- modussl_mbedtls: integrate shorter error strings
- uasyncio: add StreamReader.readexactly(n) method
- vfs_reader: fix mp_reader_new_file to open file in "rb" mode
- uasyncio: truncate negative sleeps to 0
- vfs_lfs: add mtime support to littlefs files
- btstack: implement GAP scan duration_ms parameter
- modbluetooth: fix race between READ_REQUEST and other IRQs
- bluetooth: support active scanning in BLE.gap_scan()
- machine_i2c: fix buffer overrun if 'addrsize' is bigger than 32
- modlwip: fix error return for TCP recv when not connected
- vfs: support larger integer range in VFS stat time fields
- vfs: add option to use 1970 as Epoch

lib:
- utils/pyexec: introduce MICROPY_REPL_INFO, wrap debug prints in it
- mp-readline: add an assert() to catch buffer overflows
- mp-readline: add word-based move/delete EMACS key sequences
- utils: change default value of pyexec_mode_kind to 0 to put in bss
- utils/pyexec: handle pending exceptions after disabling kbd intrs
- add BlueKitchen BTstack submodule
- tinyusb: update to a6b916ba for i.MX support
- btstack: update to latest master btstack commit
- littlefs: update littlefs2 to v2.2.0
- mynewt-nimble: update submodule to NimBLE release 1.3.0
- btstack: update to c8b9823 for USB HCI reset timeout fix
- nrfx: upgrade to nrfx v2.0.0
- utils: lock the scheduler when executing hard callback functions
- utils/pyexec: add missing MP_ERROR_TEXT when compiler disabled
- utils: protect all of mpirq.c with MICROPY_ENABLE_SCHEDULER
- libc: add implementation of strncpy
- mbedtls_errors: add code to patch mbedtls for shortened error strs
- stm32lib: update library for H7 v1.6.0 and WB v1.6.0
- libm_dbl: add round.c source code
- libc: fix string0's implementation of strncpy
- timeutils: add helper functions to deal with nanosecs since 1970

drivers:
- cyw43: fix to build in nanbox mode
- cyw43: include stdio.h in files that use printf
- cyw43: return early from cyw43_wifi_set_up if wifi_on fails
- nrf24l01: change pipe addrs in test to match Arduino addrs
- onewire: fix undefined variable errors
- display/ssd1306.py: change the SET_COM_PIN_CFG setting
- support SPI/QSPI flash chips over 16MB

mpy-cross:
- main: fix stderr_print_strn parameter type
- main: print uncaught nlr jump to stderr

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

docs:
- more consistent capitalization and use of articles in headings
- library/machine.I2C.rst: use positional-only arguments syntax
- library/machine.UART.rst: detail timeout behaviour of read methods
- README: add short paragraph about using readthedocs
- library/machine: document machine.soft_reset() function
- library: add / to indicate positional-only args in library docs
- library/uos.rst: improve block devices section, and ioctl ret vals
- esp8266: in TCP tutorial, add HTTP response code and content-type
- unix: add a new new quickref page for the UNIX port
- library: fix framebuf monochrome 1-bit modes, swapping HLSB/HMSB
- develop: detail how to add symbols to mp_fun_table for native mods
- library: add initial docs for uasyncio module
- add docs and test for uasyncio custom exc handler methods
- library: note that uasyncio.wait_for() can raise exception
- library: document that char_data/notify_data are also references
- library: note that machine.Pin.irq's hard arg may not be supported
- library: fix docs for machine.WDT to specify millisecond timeout
- develop: fix module/source name in Makefile of native example
- reference: add note about multiple exceptions when heap is locked
- library: update ubluetooth for new events and discover by uuid
- fix Sphinx 3.x warnings, and enable warnings-as-errors on build
- esp8266: add quickref documentation for UART on esp8266
- library: clarify that the arg to esp.deepsleep is in microseconds
- esp32: add info about PWM duty cycle range to esp32 quickref
- library: add gatts_indicate() doc to ubluetooth.rst
- library: for ubluetooth, add docs for _IRQ_GATTS_INDICATE_DONE
- library: update documentation of esp32's RMT
- library: update pyb.SPI init method to add descr about "ti" arg
- library: update pyb.Timer to add missing args and defaults to init
- library: update pyb.UART to correct pyboard UART availability
- esp32: fix machine.Timer quickref to specify HW timers
- change `\*` to `*` in argument lists

examples:
- accellog.py: shift long comments to their own line
- bluetooth/ble_temperature_central.py: shorten comment
- natmod: add .gitignore to ignore generated example .mpy files
- bluetooth: replace "connectable" parameter with "adv_type"
- bluetooth: fix incorrect value of BR/EDR flag in advertising
- bluetooth: fix event code in ble_temperature_central.py
- bluetooth: in ble_advertising.py, skip appearance if not set
- bluetooth: add simple UART demo with central and peripheral

tests:
- run-tests: add "--mpy-cross-flags" arg to specify mpy-cross flags
- extmod: split out VfsFat finaliser tests to separate test file
- micropython: add test for yield-from while heap is locked
- run-tests: handle 'CRASH' return by float.py feature test
- cpydiff: add CPy diff-test for using dict.keys() as a set
- unix: make unix time test pass on more platforms
- unix: add coverage test for new mp_obj_int_get_uint_checked func
- make run-tests help and README be more descriptive of behaviour
- extmod: add basic machine.Timer test
- unix: add coverage tests for pairheap data structure
- unix: add coverage test for mp_obj_new_exception_args
- unix: add coverage tests for mp_obj_is_type() and variants
- add boolean-as-integer formatting tests for fixed regression
- add tests for generator throw and yield-from with exc handlers
- basics: expand test cases for equality of subclasses
- cmdline/repl_inspect: add new test for -i option
- cmdline: add test for MICROPYINSPECT environment variable
- cpydiff: add os module environ differences
- move CPy diff test to real test now that subclass equality works
- basics: move test for "return" outside function to own file
- unix: add coverage tests for kbd-intr and scheduler
- run-tests: auto-skip extmod/ticks_diff, extmod/time_ms_us tests
- basics: add tests for equality between bool and int/float/complex
- basics: add test for equality between tuple and namedtuple
- basics: add test for tuple compare with class derived from tuple
- basics/array1.py: add equality testing for array
- run-multitests.py: add new test runner for multiple Py instances
- multi_net: add initial set of multi-instance tests for network
- multi_bluetooth: add initial tests for bluetooth BLE
- run-tests: consider all tests as native when emit=native is used
- run-multitests.py: print test summary and do exit(1) on failure
- extmod: add uasyncio tests
- run-tests: skip uasyncio if no async, and skip one test on native
- make default MICROPYPATH include extmod to find uasyncio
- multi_net: add uasyncio test for TCP server and client
- net_inet: add uasyncio internet tests
- basics/dict_pop.py: remove extra comma in call and fix grammar
- micropython/heapalloc_fail_set.py: remove extra trailing comma
- format all Python code with black, except tests in basics subdir
- float: add new lexer test to test parsing of float without prefix
- run-tests: add commands to print and clean *.exp,out files
- extmod: update littlefs test output to match new library version
- run-tests: make diff tool user configurable
- float: fix cmath_fun_special for MICROPY_FLOAT_IMPL_FLOAT
- extmod: add btree test for errors raised by btree DB library
- run-multitests.py: allow filtering out lines from stdout
- multi_bluetooth/ble_gap_advertise: fix bytes/str compare warning
- run-multitests.py: add shortcuts for local Python instances
- cpydiff: add cpydiff test for __all__ used in imported package
- thread/thread_stacksize1.py: increase stack size for CPython
- multi_bluetooth: fix typo printing wrong IRQ type
- run-multitests.py: add TRACE banner and move TEST output to end
- run-tests: skip REPL feature checks when running via pyboard.py
- multi_bluetooth: update to work with new BLE events
- run-multitests.py: allow passing unique env vars to each instance
- basics: add tests for assignment operator :=
- cpydiff: add CPy diff test for assignment expression behaviour
- basics: add tests for variable annotations
- basics: split out memoryview slice-assign tests to separate file
- move .mpy import tests from import/ to micropython/ dir
- micropython: improve .mpy import tests to run on more targets
- extmod: add test for uasyncio.sleep of a negative time
- extmod: make uasyncio_fair test more reliable by adjusting sleeps
- run-tests: use absolute paths where possible
- run-tests: make test output directory configurable
- split out complex reverse-op tests to separate test file
- extmod: add tests for verifying FAT and littlefs mtime values

tools:
- gen-cpydiff.py: adjust subsections to sentence case
- add metrics.py script to build and compute port sizes/metrics
- pydfu.py: clean up syntax, update comments and docstrings
- pyboard.py: add option --no-follow to detach after sending script
- pyboard.py: use slice del instead of list.clear() for Py2 compat
- pyboard.py: change shebang to use python3
- makemanifest.py: support freezing with empty list of mpy files
- codeformat.py: add formatter using uncrustify for C, black for Py
- makemanifest.py: fix build on Windows by adding .exe to mpy-cross
- metrics.py: use check_call instead of run to error out on error
- codeformat.py: eliminate need for sizeof fixup
- pydfu.py: add args for VID/PID & exit with cleaner error handling
- pydfu.py: display any error strings from device/mboot
- codeformat.py: include all msvc C code in auto-format
- pyboard.py: support setting device/baudrate from shell env vars
- pyboard.py: add -d as an alias for --device
- metrics.py: add option to diff to error if delta above threshold
- metrics.py: don't build mpy-cross if not needed by any ports
- metrics.py: use OrderedDict when reading build log
- check_code_size.sh: remove unused script
- codeformat.py: use -q option on uncrustify to make output quiet
- codeformat.py: add verbose option to pass to uncrustify and black
- uncrustify.cfg: remove deprecated sp_word_brace option
- codeformat.py: remove sizeof fixup
- uncrustify: update config for v0.71.0
- codeformat.py: include extmod/{btstack,nimble} in code formatting
- uncrustify: enable more opts to remove space between func and '('
- makemanifest.py: support freezing a subdirectory recursively
- pydfu.py: respect longer timeouts requested by DFU device/mboot
- makemanifest.py: use errno.EEXIST instead of number 17
- makemanifest.py: print nicely formatted errors from mpy-cross
- pyboard.py: replace eval() of received data with alternative
- mpy-tool.py: fix offset of line number info
- makemanifest.py: use os.makedirs to make path for generated files

CI:
- add new job to build and test unix coverage in 32-bit mode
- add stm32 build in nanbox mode
- update travis to specify which unix variant to build
- add OSX build to CI
- add CI job to check code formatting
- build stm32 PYBD_SF6 with BTstack as bluetooth stack
- run multi_net tests as part of coverage job
- for unix tests use Makefile target instead of explicit commands
- print errors out for OSX job
- exclude some uasyncio tests on OSX
- use custom PPA to get pre-built uncrustify
- use grep with --text on qemu-arm output
- build NUCLEO_L073RZ instead of B_L072Z_LRWAN1 for stm32 job
- build full unix coverage build on osx job
- build GENERIC_1M board as part of esp8266 job
- make OSX build work again by not installing pkgconfig
- split esp32 ESP-IDF v3 and v4 builds to separate jobs
- decrease build duration by starting OSX build early
- finish jobs early after test failure
- use tools/metrics.py to compute size diff of minimal ports
- make sure upstream/master exists when computing size-diff check
- build more boards as part of nrf job
- run apt commands once, to slightly speed up the CI
- set build name so it appears in the web interfaces
- for powerpc job, build both UART variants
- change nrf pca10056 board to build with soft-device enabled
- build qemu-arm with MP_ENDIANNESS_BIG=1 to test bigendian build
- in stm32 job, build mboot for NUCLEO_WB55
- build mboot for PYBV10 with LFS2 enabled in stm32 job
- install newer toolchain for nrf job
- add pca10090 build to nrf job
- change nrf pca10056 board to build with s140 SoftDevice
- add zephyr build to CI
- add GitHub action to build docs

The ports
=========

all ports:
- allow overriding CROSS_COMPILE in a custom makefile
- modify mp_hal_pin_write macro so it can be used as a function
- add lib/libm/roundf.c to bare-metal Makefile's
- enable error text compression for various ports, but not all
- disable MICROPY_PY_ASSIGN_EXPR in bare-arm and minimal ports

cc3200 port: no changes specific to this port

esp8266 port:
- modules: fix AttributeError in _boot.py if flash not formatted
- modules/ntptime.py: add comment about configuring NTP host
- put mp_keyboard_interrupt in IRAM
- machine_pin: disable ets_loop_iter during hard IRQ handler
- modmachine: implement machine.soft_reset()
- README.md: add docker build instructions
- modnetwork: add support for wlan.ifconfig('dhcp')
- enable and freeze uasyncio
- change from FAT to littlefs v2 as default filesystem
- makeimg.py: print out info about RAM segments when building fw
- machine_pin: move pin_intr_handler to iRAM, de-support hard IRQ
- mpconfigport.h: add definitions for BEGIN/END_ATOMIC_SECTION
- clean up Pin intr handler by moving all code to machine_pin.c
- boards: move py/pairheap.c code from iRAM to iROM
- esp_mphal: move most functions in esp_mphal.c from iRAM to iROM
- uart: move a few functions from iRAM to iROM
- boards: allow configuring btree/FAT/LFS2 support when building
- esppwm: fix PWM glitch when setting duty on different channel

esp32 port:
- Makefile: assign result of $call to dummy var for older make
- modmachine: add implementation of machine.soft_reset()
- enable NimBLE support on all builds (IDF 3.3 and 4.0)
- modnetwork: add max_clients kw-arg to WLAN.config for AP setting
- Makefile: reorder includes to build with latest toolchain
- uart: use core-provided mp_keyboard_interrupt, placed in IRAM
- modsocket: convert EADDRINUSE error code from lwip return value
- move to IDF 4.0 release version
- deinitialize Bluetooth on soft reset
- README.md: update build instructions for newer toolchain
- modsocket: handle poll of a closed socket
- enable and freeze uasyncio
- README.md: fix typo in venv instructions
- change from FAT to littlefs v2 as default filesystem
- espneopixel: use integer arithmetic to compute timing values
- update to ESP IDF v3.3.2
- modesp32: add idf_heap_info(capabilities) to esp32 module
- consolidate check_esp_err functions and add IDF error string
- improve support for OTA updates
- partitions: update comments in files regarding offset
- modsocket: fix getaddrinfo to raise on error
- machine_sdcard: add "freq" keyword arg to SDCard constructor
- modmachine: fix machine.reset_cause to use IDF's esp_reset_reason
- mpthreadport: fix calculation of thread stack size
- update IDF v4.0 supported hash to v4.0.1
- esp32_rmt: extend RMT to support carrier feature
- esp32_rmt: call rmt_driver_install before rmt_config
- esp32_rmt: properly fix looping behaviour of RMT
- network_lan: add support for IP101 PHY
- mphalport: fix mp_hal_time_ns offset

javascript port: no changes specific to this port

mimxrt port:
- add new, minimal port to NXP i.MX RT series CPUs
- add MIMXRT1010 board
- add MIMXRT1060_EVK board
- add initial impl of machine.LED class, and basic pin support
- tusb_config.h: preliminary fix for TinyUSB HS endpoint overflow
- boards: enable LED class for MIMXRT1060_EVK board
- boards: integrate support for MIMXRT1020_EVK board
- boards: set __heap_size__ to 0 in MIMXRT1011.ld

minimal port:
- make build more flexible and work as 64-bit build

nrf port:
- main: remove unnecessary repl_info(0) call
- boards/common.ld: add ENTRY(Reset_Handler) in linker script
- drivers: use mp_raise_msg where appropriate, and shorten exc msgs
- drivers/bluetooth: fix variable initialisation error with older gcc
- remove custom "random" module and use extmod version instead
- use MICROPY_HW_ENABLE_RNG instead of MICROPY_PY_RANDOM_HW_RNG
- Makefile: don't use -fno-builtin for Cortex-M0 builds
- mphalport: remove need for "syntax unified" in mp_hal_delay_us
- update to work with nrfx v2.0.0, to match TinyUSB
- add openocd as a supported flasher
- bluetooth: use MP_ERROR_TEXT for all error messages
- bluetooth/ble_uart: fix implicit declaration of function
- bluetooth: handle data length update request
- bluetooth/ble_uart: add mp_hal_stdio_poll function
- bluetooth/ble_uart: fix random advertisement name
- bluetooth/ble_uart: swap end character on cooked strings
- Makefile: disable ROM text compression when compiling for debug
- add support for time.ticks_xxx functions using RTC1
- enable nrf tick support on all boards by default
- boards: add initial support for Actinius Icarus
- nrfx_config: disable RTC2 for nRF9160 targets
- boards: enable RTCounter machine module for nrf9160 boards
- add board definition for nRF52840-MDK-USB-Dongle
- split mpconfigport.h into multiple files
- enable more features for all targets
- Makefile: improve user C modules support

pic16bit port: no changes specific to this port

powerpc port:
- fix Makefile rule when linking
- set better default compiler
- uart: choose which UART to use at build time, not runtime

qemu-arm port:
- set default board as mps2-an385 to get more flash for tests
- README: update link to toolchain
- support building in debug mode with DEBUG=1
- Makefile: add CFLAGS_EXTRA to CFLAGS

samd port:
- fix to build with latest tinyusb

stm32 port:
- mbedtls: resize mbedtls output buffer from 16 down to 4 kiB
- fix to build in nanbox mode
- add configuration to build in nanbox mode
- boards/PYBD: change RTC asynch prediv from 1 to 4
- softtimer: change linear linked list to a pairing heap
- powerctrl: for F7, allow PLLM!=HSE when setting PLLSAI to 48MHz
- Makefile: allow a board's .mk file to add things to CFLAGS
- boards/STM32F769DISC: add config to use external SPI as filesys
- powerctrl: disable HSI if not needed to save a bit of power
- powerctrl: enable overdrive on F7 when waking from stop mode
- boards/stm32f746_af.csv: add ADC alt functions to correct pins
- sdio: add support for H7 MCUs
- stm32_it: don't call __HAL_USB_HS_EXTI_CLEAR_FLAG on H7 MCUs
- powerctrl: improve support for changing system freq on H7 MCUs
- powerctrl: reenable PLL3 on H7 MCUs when waking from stop mode
- sdram: expose the result of sdram startup test in stm32_main
- usbd_conf: allow boards to configure USB HS ULPI NXT/DIR pins
- usbd_cdc_interface: remove "interrupt_char != -1" check
- sdram: fix compile issue from unused sdram startup test flag
- mpconfigport.h: add option to have custom help text
- modnetwork: remove redundant call to nimble_poll in lwip poll
- refactor bluetooth stack/hci/driver bindings
- add bindings for BTstack implementation
- boards/PYBD: allow building with BTstack (via make command line)
- refactor Bluetooth HCI RX to be independent of transport layer
- main: fix bug mounting 3rd SD partition
- mboot: allow overriding led_init and led_state in board folder
- mboot: update dfu state/status flags to better match standard
- mboot: protect against invalid address flash writes
- mboot: update LED0 state from systick handler
- mboot: remove unnecessary test for led being 1 in led_state
- softtimer: initialise pairing-heap node before pushing to heap
- enable and freeze uasyncio
- mpconfigport.h: remove unused root pointer for BTstack bindings
- mpconfigport.h: make most extended modules configurable by board
- boards: disable pend_throw, uheapq, utimeq on small-flash boards
- Makefile: add missing ordering dependency on generated headers
- storage: fix start address of second, internal block device
- mboot/README: clarify that mboot can access FAT formatted FS only
- mboot: expose custom DFU USB VID/PID values at makefile level
- Makefile: rename SRC_LIB to LIB_SRC_C to match other ports
- main: peform a clean shutdown of btstack on soft reset
- boards/PYBD_SF2: put BTstack library in external QSPI XIP flash
- README: reorg DFU flashing instructions with addition for PYBD
- add support for F412 MCUs
- boards: add board config for Nucleo-F412ZG development board
- machine_uart: retain attached-to-repl setting when init'ing UART
- machine_uart: allow re-init'ing a static UART object
- modmachine: allow changing AHB and APB bus frequencies on STM32WB
- adc: add support to pyb.ADC for STM32WB MCUs
- machine_adc: make setting of ADC1_COMMON->CCR clearer on STM32WB
- dma: add support for DMA on STM32WB, with SPI settings provided
- boards/xxx_WB55: enable pyb.ADC and hardware SPI on WB55 boards
- Makefile: quote libgcc path so spaces are not an issue
- boards/STM32F769DISC: use macro instead of const for flash size
- factoryreset: provide empty create-FS function when FAT disabled
- usb: add support for 2xVCP on L0, L432 and WB MCUs
- rfcore: leave txpower level as default when initialising rfcore
- boards/NUCLEO_WB55: add more CPU pins and aliases to SW1/2/3
- irq: clean up irq.h so it does not depend on core uPy defines
- powerctrlboot: include irq.h to get definitions of IRQ priorities
- flash: make flash C-API reusable, and funcs return an error code
- i2cslave: add support for WB MCUs
- flash: add flash_is_valid_addr, and extend sectors for 2MB F7
- mboot: use flash routines from main stm32 code rather than custom
- mboot: use CMSIS system source code for SystemInit function
- mboot: add support for using mboot with WB MCUs
- boards: add build-time option for NUCLEO_WB55 to use mboot
- mboot: set VTOR on start up to ensure it has the correct value
- mboot: use additional CFLAGS to compile string0.c
- mpconfigport.h: enable PY_IO_FILEIO when any VFS is enabled
- timer: support TIM1 on WB MCUs
- boards: enable LFS2 on PYBD_SF3 and PYBD_SF6
- mboot: don't search for firmware on FS, just attempt to open it
- mboot: decouple stream, filesystem and top-level loading code
- mboot: add support for littlefs
- mboot: update README to describe WB and littlefs support
- i2cslave: pass I2C instance to callbacks to support multi I2Cs
- usbd_cdc_interface: remove full==size-1 limitation on tx ringbuf
- timer: properly initialise timer deadtime/brk on WB MCUs
- mboot: implement DFU mass erase
- flash: update flash_get_sector_info to return -1 on invalid addr
- mboot: add DFU logic to respond to DFU_GETSTATE request
- mboot: remove the use of timeout in DFU_GETSTATUS
- mboot: disable polling mode by default and use IRQ mode instead
- fdcan: use the right FIFO to calc element address in can_receive
- fdcan: use FDCAN_RXFxS_FxFL instead of hard-coded value
- fdcan: support maximum timeout of HAL_MAX_DELAY in can_receive
- pyb_can: handle timeout arg for FDCAN in pyb_can_send
- usbdev: fix calculation of SCSI LUN size with multiple LUNs
- pin_defs_stm32: fix pin printing to show IN mode correctly
- powerctrl.h: include stdbool.h to get definition of bool

teensy port: no changes specific to this port

unix port:
- modtime: add utime.mktime function, to complement utime.localtime
- modos: add uos.rename and uos.rmdir
- add build variants, analogous to boards on bare-metal
- add placeholder DEV variant with settrace enabled
- rename unix binaries to micropython-variant (not _variant)
- Makefile: reserve CFLAGS_EXTRA/LDFLAGS_EXTRA for external use
- release GIL during all system calls
- unix_mphal: add compile check for incompatible GIL+ASYNC_KBD_INTR
- main: print usage and NLR errors to stderr instead of stdout
- main: add support for MICROPYINSPECT environment variable
- main: add #if guard around -v option usage and document -i/-m opts
- main: add command-line -h option for printing help text
- modos: implement putenv and unsetenv to complement getenv
- main: use OS-dependent path separator when searching path
- Makefile: remove old variant targets that are no longer needed
- variants/standard: fix role of PREFIX when used to install
- Makefile: allow to install all variants of the executable
- mpthreadport: use SIGRTMIN+5 instead of SIGUSR1 for thread-GC
- mpthreadport: fix Mac build by using SIGUSR1 if SIGRTMIN not avail
- mphalport.h: fix build when MICROPY_USE_READLINE=0
- unix_mphal: adjust #if in mp_hal_stdin_rx_chr to improve format
- file: don't raise OSError(EINVAL) on sys.stdin/out/err.flush()
- Makefile: detect and pass thru mpy-cross flags when running tests
- remove custom file implementation to use extmod's VFS POSIX one
- remove custom definition of MP_PLAT_PRINT_STRN
- coverage: init all pairheap test nodes before using them
- enable uasyncio C helper module on coverage build
- mpthreadport: fix crash when thread stack size <= 8k
- implement PEP 475 to retry syscalls failing with EINTR
- mpthreadport: ensure enough thread stack to detect overflow
- fix behaviour of COPT/NDEBUG for unix variants
- implement MICROPY_BEGIN/END_ATOMIC_SECTION protection macros
- Makefile: fix regression using install on non-GNU systems
- modmachine: add machine.idle(), implemented using sched_yield
- add support for modbluetooth and BLE using btstack
- enable modbluetooth on the "dev" and "coverage" variants
- add btstack to the unix submodules list
- main: enter REPL when inspect active, even with stdin redirected
- btstack_usb: allow choosing adaptor via environment variable
- make manifest selection match other ports
- enable uasyncio on dev variant
- variants: enable VFS and all supported filesystems on dev variant
- make the MICROPY_xxx_ATOMIC_SECTION mutex recursive
- fatfs_port: implement get_fattime
- variants: fix fast and freedos variants so they build again
- modos: support larger integer range in uos.stat fields

windows port:
- support word-based move/delete key sequences for REPL
- windows_mphal: release GIL during system calls
- improve default search path
- msvc: fix warnings regarding function declarations
- remove custom definition of MP_PLAT_PRINT_STRN
- windows_mphal: fix missing semicolon
- update genhdr.targets to match makeqstrdefs.py args
- make appveyor.yml self-contained

zephyr port:
- update include paths for Zephyr v2.0
- replace deprecated time conversion macro
- remove reference to syscall_macros_h_target
- implement block device protocol via zephyr disk access api
- enable virtual file system and uos module
- enable fatfs
- implement block device protocol via zephyr flash map api
- enable littlefs
- mount a file system during init
- enable usb mass storage class on mimxrt1050_evk
- execute main.py file if it exists
- update machine.Pin class to use new zephyr gpio api
- use zephyr build system to merge configurations
- fix and rename stacks_analyze function in zephyr module
- fix floating point configuration
- update for refactored zephyr device structures
- update to new zephyr timeout API
- convert DT_FLASH_AREA usages to new dts macros
- increase minimum required cmake version to 3.13.1
- use cmake find_package to locate zephyr
- implement machine.Pin.irq() for setting callbacks on pin change
- make-minimal: disable FAT and LFS2 options to make it build
- include storage/flash_map.h unconditionally
- README: update required Zephyr version and mention new features