micropython 发布版本: 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:

  • compile: use alloca instead of qstr_build when compiling import name
  • mpconfig: introduce reusable MP_HTOBE32(), etc. macros
  • objtype: mp_obj_new_type: name base types related vars more clearly
  • objnamedtuple: add _asdict function if OrderedDict is supported
  • emitnative: clean up asm macro names so they have dest as first arg
  • mkenv.mk: use $(PYTHON) consistently when calling Python tools
  • objstr: remove "make_qstr_if_not_already" arg from mp_obj_new_str
  • objstr: make mp_obj_new_str_of_type check for existing interned qstr
  • objstr: when constructing str from bytes, check for existing qstr
  • add config option to disable multiple inheritance
  • objnamedtuple: allow to reuse namedtuple basic functionality
  • objfloat: allow float() to parse anything with the buffer protocol
  • modbuiltins: slightly simplify code in builtin round()
  • runtime: simplify handling of containment binary operator
  • opmethods: include the correct header for binary op enums
  • runtime: add MP_BINARY_OP_CONTAINS as reverse of MP_BINARY_OP_IN
  • parsenum: improve parsing of floating point numbers
  • objdict: reuse dict-view key iterator for standard dict iterator
  • annotate func defs with NORETURN when their corresp decls have it
  • qstr: rewrite find_qstr to make manifest that it returns a valid ptr
  • gc: in gc_realloc, convert pointer sanity checks to assertions
  • objgenerator: remove unreachable code for STOP_ITERATION case
  • misc.h: add m_new_obj_var_with_finaliser()
  • mp_callfunction*_protected(): pass-thru return value if possible
  • modbuiltins: use standard arg-parsing helper func for builtin print
  • mpprint: make "%p" format work properly on 64-bit systems
  • mpprint: support "%lx" format on 64-bit systems
  • malloc: allow to use debug logging if !MICROPY_MALLOC_USES_ALLOCATED_SIZE
  • gc: add CLEAR_ON_SWEEP option to debug mis-traced objects
  • emitbc, asmbase: only clear emit labels to -1 when in debug mode
  • asmbase: revert removal of clearing of label offsets for native emit
  • objint_longlong: check for zero division/modulo
  • runtime: when tracing unary/binary ops, output op (method) name
  • gc: factor out a macro to trace GC mark operations
  • gc: in sweep debug output, print pointer as a pointer
  • objfun: factor out macro for decoding codestate size
  • objfun, vm: add comments on codestate allocation in stackless mode
  • objfun: factor out macro for initializing codestate
  • mkrules.mk: add "clean-frozen" target to clean frozen script/modules dir
  • runtime: move mp_exc_recursion_depth to runtime and rename to raise
  • introduce a Python stack for scoped allocation
  • convert all uses of alloca() to use new scoped allocation API
  • runtime: use the Python stack when building arg and *kwarg state
  • objexcept: use INT_FMT when printing errno value
  • extend nan-boxing config to have 47-bit small integers
  • objtype: implement better support for overriding native's init
  • objtype: refactor object's handling of new to not create 2 objs
  • builtinimport: call init for modules imported via a weak link
  • objgenerator: allow to pend an exception for next execution
  • map: don't include ordered-dict mutating code when not needed
  • mpz: fix pow3 function so it handles the case when 3rd arg is 1
  • modio: use correct config macro to enable resource_stream function
  • malloc: remove unneeded code checking m_malloc return value
  • nlrthumb: fix use of naked funcs, must only contain basic asm code
  • nlr: clean up selection and config of NLR implementation
  • nlr: factor out common NLR code to macro and generic funcs in nlr.c
  • parse: split out rule name from rule struct into separate array
  • parse: break rule data into separate act and arg arrays
  • parse: pass rule_id to push_result_rule, instead of passing rule_t*
  • parse: pass rule_id to push_result_token, instead of passing rule_t*
  • parse: remove rule_t struct because it's no longer needed
  • parse: compress rule pointer table to table of offsets
  • parse: update debugging code to compile on 64-bit arch
  • parse: fix macro evaluation by avoiding empty VA_ARGS
  • mpz: simplify handling of borrow and quo adjustment in mpn_div
  • mpz: in mpz_as_str_inpl, convert always-false checks to assertions
  • nlr: fix nlr functions for 64bit ports built with gcc on Windows
  • compile: combine compiler-opt of 2 and 3 tuple-to-tuple assignment
  • objtype: check and prevent delete/store on a fixed locals map
  • modbuiltins: for builtin_chr, use uint8_t instead of char for array
  • vm: simplify stack sentinel values for unwind return and jump
  • parsenum: fix parsing of floats that are close to subnormal
  • objfloat: fix case of raising 0 to -infinity
  • unicode: clean up utf8 funcs and provide non-utf8 inline versions
  • modbuiltins: simplify casts from char to byte ptr in builtin ord
  • objrange: implement (in)equality comparison between range objects
  • objexcept: remove long-obsolete mp_const_MemoryError_obj
  • nlrthumb: do not mark nlr_push as not returning anything
  • pystack: use "pystack exhausted" as error msg for out of pystack mem
  • objdict: disallow possible modifications to fixed dicts
  • gc: reduce code size by specialising VERIFY_MARK_AND_PUSH macro
  • gc: rename gc_drain_stack to gc_mark_subtree and pass it first block
  • gc: make GC stack pointer a local variable
  • qstr: add QSTR_TOTAL() macro to get number of qstrs
  • modbuiltins: simplify and generalise dir() by probing qstrs
  • repl: generalise REPL autocomplete to use qstr probing
  • objstr: protect against creating bytes(n) with n negative
  • objmodule: factor common code for calling init on builtin module
  • builtinimport: add compile-time option to disable external imports
  • modmicropython: allow to have stack_use() func without mem_info()
  • objstr: remove unnecessary check for positive splits variable
  • objint: use MP_OBJ_IS_STR_OR_BYTES macro instead of 2 separate ones
  • objdeque: implement ucollections.deque type with fixed size
  • objdeque: protect against negative maxlen in deque constructor
  • objdeque: use m_new0 when allocating items to avoid need to clear
  • py.mk: split list of uPy sources into core and extmod files
  • py.mk: remove .. path component from list of extmod files
  • use "GEN" consistently for describing files generated in the build
  • compile: adjust c_assign_atom_expr() to use return instead of goto
  • asm*.c: remove unnecessary check for num_locals<0 in asm entry func
  • mpz: in mpz_clone, remove unused check for NULL dig
  • mpstate.h: add repl_line state for MICROPY_REPL_EVENT_DRIVEN
  • vm: fix case of handling raised StopIteration within yield from
  • vm: simplify handling of special-case STOP_ITERATION in yield from
  • formatfloat: fix rounding of %f format with edge-case FP values
  • formatfloat: fix case where floats could render with a ":" character
  • formatfloat: fix case where floats could render with negative digits
  • objint: remove unreachable code checking for int type in format func
  • misc.h: remove unused count_lead_ones() inline function
  • obj.h: clean up by removing commented-out inline versions of macros
  • obj.h: move declaration of mp_obj_list_init to objlist.h
  • makeqstrdefs.py: optimise by using compiled re's so it runs faster
  • objexcept: make MP_DEFINE_EXCEPTION public so ports can define excs
  • runtime: check that keys in dicts passed as ** args are strings
  • runtime: be sure that non-intercepted thrown object is an exception
  • vm: don't do unnecessary updates of ip and sp variables
  • vm: optimise handling of stackless mode when pystack is enabled
  • modsys: don't compile getsizeof function if feature is disabled
  • don't include mp_optimise_value or opt_level() if compiler disabled
  • objint: simplify LHS arg type checking in int binary op functions
  • objstr: in find/rfind, don't crash when end < start
  • stream: switch stream close operation from method to ioctl
  • objgenerator: check stack before resuming a generator
  • refactor how native emitter code is compiled with a file per arch
  • nlrthumb: fix Clang support wrt use of "return 0"
  • mperrno: define MP_EWOULDBLOCK as EWOULDBLOCK, not EAGAIN
  • stream: use uPy errno instead of system's for non-blocking check
  • obj.h: fix math.e constant for nan-boxing builds
  • modbuiltins, repl: start qstr probing from after empty qstr
  • runtime: add mp_load_method_protected helper which catches exceptions
  • modbuiltins: make built-in hasattr work properly for user types
  • repl: use mp_load_method_protected to prevent leaking of exceptions
  • modbuiltins: in built-in dir make use of mp_load_method_protected
  • modbuiltins: make built-in dir support the dir special method
  • objdeque: fix sign extension bug when computing len of deque object

extmod:

  • modussl_axtls: socket_read: Handle EAGAIN
  • moduhashlib: enable SHA1 hashing when using "mbedtls" library
  • vfs_fat: mount FatFS on creation so VFS methods can be used
  • modussl_axtls: implement key and cert kw args to wrap_socket
  • modlwip: commit TCP out data to lower layers if buffer gets full
  • machine_signal: change VLA to use new scoped allocation API
  • modure: convert alloca() to use new scoped allocation API
  • modussl_mbedtls: clean up mbedtls state when error during setup
  • modframebuf: add 2-bit color format (GS2_HMSB)
  • modframebuf: add 8-bit greyscale format (GS8)
  • vfs_fat_file: implement SEEK_CUR for non-zero offset
  • modujson: implement ujson.dump() function
  • vfs_fat: move ilistdir implementation from misc to main file
  • vfs_fat: merge remaining vfs_fat_misc.c code into vfs_fat.c
  • vfs_fat: make fat_vfs_open_obj wrapper public, not its function
  • vfs_fat: remove declaration of mp_builtin_open_obj
  • vfs_fat_diskio: use a C-stack-allocated bytearray for block buf
  • machine_spi: make SPI protocol structure public
  • vfs_fat: add file size as 4th element of uos.ilistdir tuple
  • re1.5: fix compilecode.c compile problem on IAR tool chain
  • modlwip: check if getaddrinfo() constraints are supported or not
  • vfs: delegate import_stat to vfs.stat to allow generic FS import
  • uzlib: fix C-language sequencing error with uzlib_get_byte calls
  • modlwip: in ioctl handle case when socket is in an error state

lib:

  • tinytest: move from tools/tinytest
  • upytesthelper: add MicroPython test helper layer on top of tinytest
  • tinytest: clean up test reporting in the presence of stdout output
  • utils/pyexec.h: include py/obj.h because its decls are needed
  • utils/pyexec: update to work with new MICROPY_HW_ENABLE_USB option
  • stm32lib: update library to include support for STM32H7 MCUs
  • stm32lib: update library for fix to H7 SPI strict aliasing error
  • axtls: update, exposes AES functions to implement ECB cipher mode

drivers:

  • nrf24l01: make driver and test run on pyboard, ESP8266, ESP32
  • display/ssd1306: make SSD1306 class inherit from FrameBuffer
  • sdcard: support old SD cards (<=2GB)
  • sdcard: avoid allocation on the heap
  • sdcard: update doc for ESP8266 to use correct SPI number
  • cc3200: update to work with new stm32 SPI API
  • sdcard: update SD mounting example code for ESP8266
  • bus: add QSPI abstract type with software QSPI implementation
  • memory/spiflash: add support for QSPI interface
  • bus: pull out software SPI implementation to dedicated driver
  • memory/spiflash: change to use low-level SPI object not uPy one

tools:

  • mpy-tool.py: implement freezing of Ellipsis const object
  • gen-cpydiff.py: update executable paths to point to new ports dir
  • tinytest-codegen.py: generate code for upytesthelper
  • tinytest-codegen: wrap lines of exclude_tests
  • tinytest-codegen: more excludes after enabling expected output match
  • tinytest-codegen: take --target= option for test set selection
  • pydfu.py: call set_configuration() on fresh USB device object
  • tinytest-codegen: add --stdin switch instead of recently added --target
  • tinytest-codegen: ignore system locale, write output in UTF-8
  • upip: upgrade upip to 1.2.4

tests:

  • net_hosted: add test for socket connect() and poll() behaviour
  • basics: add test for containment of a subclass of a native type
  • basics/builtin_range: add test for corner case of range slicing
  • basics/builtin_locals: add test for using locals() in class body
  • cpydiff: add difference-test for second arg of builtin next()
  • cpydiff: fix markup where "`" (xref) was used instead of "``" (code)
  • heapalloc_*: refactor some tests to work in strict stackless mode
  • heapalloc, heapalloc_super: skip in strict stackless mode
  • basics: add test for overriding a native base-class's init method
  • extmod: add test which subclasses framebuf.FrameBuffer
  • cpydiff: update subclassing Exception case and give work-around
  • fix few test for proper "skipped" detection with qemu-arm's tinytest
  • run-tests: add --list-tests switch
  • add tests to improve coverage of py/objtype.c
  • run-tests: fix handling of --list-tests wrt skipped tests
  • run-tests: add composable --include and --exclude options
  • run-tests: don't test for --target=unix with "pyb is None"
  • run-tests: skip running feature checks for --list-tests/--write-exp
  • basics: add more set tests to improve coverage of py/objset.c
  • extmod/uhashlib_sha256: add test for hashing 56 bytes of data
  • float/builtin_float_hash: add test to improve objfloat.c coverage
  • unix: add test for printf with %lx format
  • basics/generator_pend_throw: add test for just-started generator
  • basics/builtin_pow3: add tests for edge cases of pow3
  • add some more tests to improve coverage of py/parse.c
  • extmod: add some uctypes tests to improve coverage of that module
  • basics/memoryerror: add test for out-of-memory using realloc
  • basics: rename remaining tests that are for built-in functions
  • unix: add coverage test for calling mp_obj_new_bytearray
  • automatically skip tests that require eval, exec or frozenset
  • rewrite some tests so they can run without needing eval/exec
  • run-tests: capture any output from a crashed uPy execution
  • basics/deque*: tests for ucollections.deque
  • basics: add tests to improve coverage of py/objdeque.c
  • basics: add test for calling a subclass of a native class
  • stress: add test to create a dict beyond "maximum" rehash size
  • unix: add coverage tests for mpz_set_from_float, mpz_mul_inpl
  • extmod/vfs_fat_fileio1: add test for failing alloc with finaliser
  • extmod/uzlib_decompress: add uzlib tests to improve coverage
  • float: adjust float-parsing tests to pass with only a small error
  • unix: add coverage test for VM executing invalid bytecode
  • basics/gc1: add test which triggers GC threshold
  • extmod/vfs_fat_fileio1: add test for calling file obj finaliser
  • unix: add coverage tests for various GC calls
  • move heap-realloc-while-locked test from C to Python
  • unix: add coverage test for uio.resource_stream from frozen str
  • extmod/time_ms_us: add test for calling ticks_cpu()
  • extmod/time_ms_us: fix ticks tests, ticks_diff args are reversed
  • basics/builtin_enumerate: add test for many pos args to enumerate
  • cpydiff: indent workaround code snippet so it formats correctly
  • pyb: update CAN test to expect that auto_restart is printed
  • pyb/can: update to test pyb.CAN restart, state, info, inplace recv
  • basics/iter1.py: add more tests for walking a user-defined iter
  • basics: add test for use of return within try-except
  • basics/int_big1.py: add test converting str with non-print chars
  • basics: modify int-big tests to prevent constant folding
  • stress: add test to verify the GC can trace nested objects
  • basics/int_big1.py: add test for big int in mp_obj_get_int_maybe
  • basics: add test for subclassing an iterable native type
  • basics: add tests for edge cases of nan-box's 47-bit small int
  • basics/class_super.py: add tests for store/delete of super attr
  • basics/string_compare.py: add test with string that hashes to 0
  • micropython: add set of tests for extreme cases of raising exc's
  • stress/recursive_gen: add test for recursive gen with iter
  • move recursive tests to the tests/stress/ subdir
  • pyb/adc.py: fix test so that it really does test ADC values
  • pyb: add test for pyb.ADCAll class
  • io/bytesio_ext2: remove dependency on specific EINVAL value
  • run-tests: support esp32 as a target for running the test suite
  • cpydiff: remove core_function_unpacking now that it succeeds
  • cpydiff: remove types_str_decodeerror now that it succeeds
  • cpydiff: remove working cases from types_float_rounding
  • cpydiff: remove types_int_tobytesfloat now that it doesn't fail
  • float/float_parse: allow test to run on 32-bit archs

minimal port:

  • README: update text to better describe what "make run" does
  • Makefile: explicitly include lib/utils/printf.c in build
  • Makefile: only build with core source files

unix port:

  • moduselect: add .dump() method for debugging
  • mpconfigport: disable uio.resource_stream()
  • add support for using the Python stack
  • Makefile: coverage: allow user to pass CFLAGS_EXTRA
  • mpconfigport.h: allow to override stackless options from commandline
  • mpconfigport_coverage.h: enable MICROPY_PY_IO_RESOURCE_STREAM
  • mpconfigport_coverage: enable range (in)equality comparison
  • coverage: allow coverage tests to pass with debugging disabled

windows port:

  • mpconfigport: provide off_t definition for MSVC port
  • mpconfigport: enable some features, including the Python stack
  • add Appveyor CI builds for windows mingw port

qemu-arm port:

  • rework "test" target using upytesthelper
  • test_main: clean up invocation of tinytest_main()
  • test_main: include setjmp.h because it's used by gc_collect

stm32 port:

  • boards/NUCLEO_F429ZI: incr CPU freq to 168MHz to get USB working
  • boards: add support for NUCLEO-F746ZG evaluation board
  • boards/stm32f767_af.csv: update AF table based on datasheet
  • boards/*_af.csv: make consistent use of JTMS, JTCK, SWDIO, SWCLK
  • add support for using the Python stack
  • usbdev: pass thru correct val for SCSI PreventAllowMediumRemoval
  • use corrected capitalization of HAL_SD_CardStateTypedef
  • allow to build a board without any hardware I2C ports defined
  • uart: add support for 7-bit modes: 7N1 and 7N2
  • uart: support board configs with CTS/RTS on UART6
  • i2c: fix bug with I2C4 initialisation
  • i2c: support more I2C baudrates for F746, and more F7 MCUs
  • spi: if MICROPY_HW_SPIn_MISO undefined, do not claim pin on init
  • modmachine: handle case of no MICROPY_PY_MACHINE_I2C
  • add support for DHT11/DHT22 sensors
  • spi: make SPI DMA wait routine more power efficient by using WFI
  • sdcard: make SD wait routine more power efficient by using WFI
  • usbdev: reduce dependency on py header files
  • usbdev: combine all str descriptor accessor funcs into one func
  • can: support MCUs without a CAN2 peripheral
  • improve support for STM32F722, F723, F732, F733 MCUs
  • modmachine: in freq(), select flash latency value based on freq
  • sdcard: only define IRQ handler if using SDMMC1 peripheral
  • sdcard: use maximum speed SDMMC clock on F7 MCUs
  • usbdev: add support for MSC-only USB device class
  • usb: allow board to select which USBD is used as the main one
  • usbdev: add support for high-speed USB device mode
  • i2c: use macros instead of magic numbers for I2C speed grades
  • spi: add support for a board naming SPI peripherals 4, 5 and 6
  • rng: simplify RNG implementation by accessing raw peripheral regs
  • spi: allow SPI peripheral state to persist across a soft reset
  • i2c: allow I2C peripheral state to persist across a soft reset
  • spi: provide better separation between SPI driver and uPy objs
  • update LCD and network drivers to work with new SPI API
  • spi: accept machine.SPI object in spi_from_mp_obj() function
  • rtc: fix rtc_info flags when LSE fails and falls back to LSI
  • rtc: fix RTC init to use LSI if LSI is already selected on boot
  • rtc: add compile-time option to set RTC source as LSE bypass
  • main: reorder some init calls to put them before soft-reset loop
  • main: remove need for first_soft_reset variable
  • add mpconfigboard_common.h with common/default board settings
  • boards: remove all config options that are set to defaults
  • usbdev: fix USBD setup request handler to use correct recipient
  • update HAL macro and constant names to use newer versions
  • timer: support MCUs that don't have TIM4 and/or TIM5
  • introduce MICROPY_HW_ENABLE_USB and clean up USB config
  • boards: update all boards to work with new USB configuration
  • factor out flash and SPI block-device code to separate files
  • change header include guards from STMHAL to STM32 to match dir
  • add board config option to enable/disable the ADC
  • use "GEN" for describing files generated in the build
  • flash: use FLASH_TYPEPROGRAM_WORD to support newer HALs
  • move MCU-specific cfg from mphalport.h to mpconfigboard_common.h
  • spibdev: update to work with new spiflash driver
  • spibdev: add option to configure SPI block dev to use QSPI flash
  • storage: add option for bdev to supply readblock/writeblocks
  • spibdev: convert to use multiple block read/write interface
  • qspi: add hardware QSPI driver, with memory-map capability
  • i2c: on F4 MCUs report the actual I2C SCL frequency
  • boards/stm32f767_af.csv: add ADC column to pin capability list
  • boards/NUCLEO_F767ZI: update pins list to include 3 extra pins
  • boards: add stm32h743_af.csv file describing H7 GPIO alt funcs
  • boards: add stm32h743.ld linker script
  • boards: add new NUCLEO_H743ZI board configuration files
  • Makefile: add settings to support H7 MCUs
  • flash: add flash support for H7 MCUs
  • system_stm32: add H7 MCU system initialisation
  • mphalport: use GPIO BSRRL/BSRRH registers for H7 MCUs
  • wdt: add WDT support for H7 MCUs
  • uart: add UART support for H7 MCUs
  • timer: add Timer support for H7 MCUs
  • modmachine: support basic H7 MCU features
  • usbd_conf: add USB support for H7 MCUs
  • stm32_it: add support for H7 MCUs
  • dma: add DMA support for H7 MCUs
  • rtc: add RTC support for H7 MCUs
  • extint: add EXTI support for H7 MCUs
  • mpconfigboard_common: add STM32H7 common configuration
  • main: enable D2 SRAM1/2/3 clocks on H7 MCUs
  • boards: add startup_stm32h7.s for H7 series specific startup
  • boards: add startup_stm32f7.s for F7 series specific startup
  • boards: add startup_stm32f4.s for F4 series specific startup
  • boards: add startup_stm32l4.s for L4 series specific startup
  • Makefile: use separate startup file for each MCU series
  • remove startup_stm32.S, now provided in boards/ for each MCU
  • usbd_conf.h: add include of stdint.h to fix compilation issues
  • system_stm32: fix CONFIG_RCC_CR_2ND value to use bitwise or
  • storage: merge all misc block-dev funcs into a single ioctl func
  • storage: make spi_bdev interface take a data pointer as first arg
  • storage: remove all SPI-flash bdev cfg, to be provided per board
  • storage: introduce MICROPY_HW_ENABLE_INTERNAL_FLASH_STORAGE cfg
  • boards/STM32L476DISC: provide SPI-flash bdev config
  • storage: provide support for a second block device
  • qspi: do an explicit read instead of using memory-mapped mode
  • boards/STM32L476DISC: enable CAN peripheral
  • can: improve can.recv() so it checks for events, eg ctrl-C
  • can: use enums to index keyword arguments, for clarity
  • can: add "auto_restart" option to constructor and init() method
  • can: add CAN.restart() method so controller can leave bus-off
  • can: add CAN.state() method to get the state of the controller
  • can: add CAN.info() method to retrieve error and tx/rx buf info
  • use STM32xx macros instead of MCU_SERIES_xx to select MCU type
  • can: add "list" param to CAN.recv() to receive data inplace
  • dma: enable H7 DMA descriptors
  • i2c: add H7 I2C timing configurations
  • boards/NUCLEO_H743ZI: enable hardware I2C support
  • boards/NUCLEO_H743ZI: disable uSD transceiver
  • Makefile: re-enable strict aliasing optimisation for ST HAL files
  • consolidate include of genhdr/pins.h to single location in pin.h
  • qspi: don't take the address of pin configuration identifiers
  • *bdev.c: eliminate dependency on sys_tick_has_passed
  • boards: allow boards to have finer control over the linker script
  • Makefile: rename FLASH_ADDR/TEXT_ADDR to TEXT0_ADDR/TEXT1_ADDR
  • Makefile: allow a board to config either 1 or 2 firmware sections
  • boards: add common_basic.ld for a board to have a single section
  • boards: add common_bl.ld for boards that need a bootloader
  • system_stm32: set VTOR pointer from TEXT0_ADDR
  • boards/stm32f767.ld: add definition of FLASH_APP
  • boards/stm32h743.ld: remove include of common.ld
  • boards/NUCLEO_H743ZI: update to build with new linker management
  • dma: remove H7 SDMMC DMA descriptors
  • sdcard: add H7 SD card support
  • boards/NUCLEO_H743ZI: enable SD card support
  • change pin_X and pyb_pin_X identifiers to be pointers to objects
  • boards/STM32L476DISC: update to not take the address of pin objs
  • add custom, optimised Reset_Handler code
  • main: rename main to stm32_main and pass through first argument
  • main: only update reset_mode if board doesn't use a bootloader
  • mphalport: use MCU regs to detect if cycle counter is started
  • dac: add support for H7 MCUs
  • boards/NUCLEO_H743ZI: enable DAC peripheral
  • i2c: update HAL macros to use new __HAL_RCC prefix
  • i2c: fully support peripheral I2C4
  • main: guard usb_mode lines in default boot.py by relevant #if
  • adc: fix verification of ADC channel 16 for F411 MCUs
  • adc: add read_timed_multi() static method, with docs and tests
  • adc: optimise read_timed_multi() by caching buffer pointers
  • dac: add buffering argument to constructor and init() method
  • adc: factor code to optimise adc_read_channel and adc_read
  • adc: fix config of EOC selection and Ext-Trig for ADC periph
  • adc: factor common ADC init code into adcx_init_periph()
  • pin: in pin AF object, remove union of periph ptr types
  • can: allow CAN pins to be configured per board
  • stm32_it: add IRQ handler for I2C4
  • allow a board to configure the HSE in bypass mode
  • main: allow a board to configure the label of the flash FS
  • sdcard: implement BP_IOCTL_SEC_COUNT to get size of SD card
  • rng: set RNG clock source for STM32H7
  • boards/NUCLEO_H743ZI: enable RNG for this board
  • uart: allow ctrl-C to issue keyboard intr when REPL is over UART
  • uart: allow ctrl-C to work with UARTs put on REPL via os.dupterm
  • introduce MICROPY_PY_STM config to include or not the stm module
  • dac: support MCUs that don't have TIM4/5 and use new HAL macro
  • rename i2c.c to pyb_i2c.c
  • rename legacy pyb.I2C helper functions to start with pybi2c
  • i2c: add low-level I2C driver for F7 MCUs
  • machine_i2c: provide hardware I2C for machine.I2C on F7 MCUs
  • system_stm32: reconfigure SysTick IRQ priority for L4 MCUs
  • boards/NUCLEO_H743ZI: use priority 0 for SysTick IRQ
  • adc: add support for H7 MCU series
  • boards/NUCLEO_H743ZI: enable ADC peripheral
  • mphalport: add mp_hal_pin_config_speed() to select GPIO speed
  • usbd_conf: use mp_hal_pin_config() instead of HAL_GPIO_Init
  • dac: use mp_hal_pin_config() instead of HAL_GPIO_Init()
  • boards: update pins.csv to include USB pins where needed
  • mphalport: support ADC mode on a pin for L4 MCUs
  • adc: use mp_hal_pin_config() instead of HAL_GPIO_Init()
  • dac: make deinit disable the output buffer on H7 and L4 MCUs
  • dac: implement printing of a DAC object
  • mphalport: optimise the way that GPIO clocks are enabled
  • flash: remove unused src parameter from flash_erase()
  • dma: always deinit/reinit DMA channels on L4 MCUs
  • irq: define IRQ priorities directly as encoded hardware values
  • main: clean up and optimise initial start-up code of the MCU
  • dma: fix duplicate typedef of struct, it's typedef'd in dma.h
  • don't use %lu or %lx for formatting, use just %u or %x
  • Makefile: use -O2 to optimise compilation of lib/libc/string0.c
  • i2c: make sure stop condition is sent after receiving addr nack
  • usb: fix broken pyb.have_cdc() so it works again
  • usb: use correct type for USB HID object
  • README: update to reflect current MCU support

teensy port:

  • update GPIO speed consts to align with changes in stm32 port

esp8266 port:

  • etshal.h: make function prototypes compatible with ESP SDK 2.1.0+
  • README: emphasize the need to change default WiFi password
  • README: add section on using upip
  • esp8266_common.ld: put .text of more libs into .irom0.text
  • modules/webrepl_setup: fix first-time enable of WebREPL
  • modnetwork: make sure to intern string passed to .config("param")
  • machine_hspi: after an SPI write wait for last byte to transfer
  • modules: move dht.py driver to drivers/dht directory
  • esppwm: clip negative duty numbers to 0
  • README.md: update build instruction to reflect new ports dir
  • uart: allow to compile with event-driven REPL
  • modnetwork: implement WLAN.status('rssi') for STA interface
  • esppwm: always start timer to avoid glitch from full to nonfull
  • esp_mphal.h: fix I2C glitching by using input mode for od_high
  • modnetwork: allow to get ESSID of AP that STA is connected to
  • disable DEBUG_PRINTERS for 512k build

esp32:

  • add new port to Espressif ESP32 SoC
  • modnetwork: give better error msgs for AP timeout and not-found
  • modsocket: implement setsockopt(IP_ADD_MEMBERSHIP)
  • mpconfigport.h: add missing uhashlib
  • mphalport.h: make mp_halpin select gpio on the pad
  • call initialization function on sha1 and sha256
  • implement machine.WDT() class
  • README: update general description of port to add avail features
  • modutime.c: add localtime and mktime functions
  • machine_pwm: always set the channel in the PWM object
  • update to latest ESP IDF
  • modules: symlink in ntptime.py from esp8266/modules
  • modnetwork.c: fix for setting DNS with network.WLAN.ifconfig()
  • mpconfigport.h: enable ussl finaliser
  • implement wired Ethernet via network.LAN()
  • mpconfigport.h: enable websocket module
  • modesp: add osdebug() function to disable or change IDF logging
  • Makefile: support using IDF_PATH as the env var to the IDF source
  • add custom partitions.csv file with uPy specific size
  • machine_hw_spi: fix large HW SPI transfers by splitting them up
  • README: update toolchain setup
  • machine_uart: fix check of UART id so it only allows valid UARTs
  • machine_rtc: add RTC class to machine module with sleep impl
  • modesp32: add new module "esp32" to support extra wake features
  • machine_rtc: move export declaration from .c to common .h file
  • modnetwork: implement dhcp_hostname for WLAN.config()
  • update to the latest ESP IDF
  • main: allocate the uPy heap via malloc instead of on the bss
  • modsocket: allow getaddrinfo() to take up to 6 args
  • modnetwork: implement status('stations') to list STAs in AP mode
  • machine_uart: return None from UART read if no data is available
  • machine_uart: remove UART event queue object
  • README.md: fix typo readme
  • mphalport: use esp_timer_get_time instead of gettimeofday
  • mphalport: improve mp_hal_delay_us so it handles pending events
  • mphalport: improve mp_hal_stdout_tx_XXX functions
  • add support for and enable uos.dupterm()
  • modsocket: add support for registering socket event callbacks
  • mpconfigport: enable webrepl module and socket events
  • modules: add support scripts for WebREPL
  • add support for the esp32's ULP
  • modnetwork: allow to get ESSID of AP that STA is connected to
  • README: add --init to submodule update command
  • modsocket: correctly handle reading from a peer-closed socket
  • use mp_rom_map_elem_t and MP_ROM_xxx macros for const dicts
  • modsocket: check for pending events during blocking socket calls

zephyr port:

  • README: "make qemu" was replaced with "make run"
  • Makefile: clean: Remove generated prj_*_merged.conf
  • prj_base.conf: force zephyr.bin build output
  • Makefile: convert to new CMake-based Zephyr build system
  • Makefile: make prj_$(BOARD).conf optional, again
  • Makefile: syscall_macros.h generation was moved from CMake to make
  • CMakeLists.txt: update for latest Zephyr buildsys changes
  • CMakeLists.txt: properly separate CFLAGS parts gotten from CMake
  • main: move var declarations to the top of file
  • add support for binary with builtin testsuite
  • prj_base.conf: bump MAIN_STACK_SIZE to let builtin testsuite run
  • Makefile: clean: Clean libmicropython.a too
  • main: remove unused do_str() function

docs:

  • esp8266/general: TLS limitations: mention also "ussl" module limitations
  • ure: add flags arg to ure.compile(), mention that ure.DEBUG is optional
  • ure: emphasize not supported features more
  • _thread: add a placeholder docs for _thread module
  • library/network: enhance AbstractNIC.status to take an argument
  • add notes on heap allocation caused by bound method refs
  • uselect: poll: Explicitly specify that no-timeout value is -1
  • uctypes: tweak descriptor reference to hopefully be easier to follow
  • uselect: describe POLLHUP/POLLERR semantics in more details
  • library/utime: fix incorrect example with ticks_diff args order
  • uselect: ipoll: Fix grammar/wording of one-shot flag description
  • glossary: describe the callee-owned tuple concept
  • uerrno: fix xref-vs-code markup
  • glossary: describe "stream" term
  • glossary: describe string interning
  • library: add xrefs to "stream" dictionary entry for many modules
  • glossary: clarify wording for "baremetal"
  • reference/packages: add chapter on distribution packages and deployment
  • packages: add quick "Creating distribution packages" section
  • packages: mpy_bin2res no longer required to create resources
  • conf: reference CPython 3.5 docs
  • packages: use "install_dir/" in examples
  • packages: explicitly recommend usage of setuptools instead of distutils
  • library/index: elaborate uPy libraries intro
  • library/pyb.rst: add note about availability of USB MSC-only mode
  • esp8266: update PWM doc regarding clipping of min/max values
  • esp8266: add a note concerning GPIO16 pull capabilities
  • library/ujson: document dump() and load() functions
  • library/usocket: make xref to uerrno explicitly a module reference
  • library/micropython: describe optimisation levels for opt_level()
  • library/uos: create sections for distinct parts and document uname
  • library/uos: document mount, umount, VfsFat and block devices
  • reference/repl.rst: fix some minor errors in the REPL tutorial
  • library/pyb.ADC: document new features for ADCAll
  • library/pyb.ADC: remove outdated ADCAll code example
  • library: add ussl module to library index for unix port

travis:

  • pass -j4 to make to speed up compilation
  • update for qemu-arm's testing moved to Makefile.test
  • build and test strict stackless build
  • add Unix coverage test for script via stdin