Assets 2
This release adds the MicroPython cross-compiler that can generate .mpy
files (pre-compiled bytecode) which can be executed within any
MicroPython runtime/VM.  The ESP8266 port is also vastly improved thanks
to a hugely successful Kickstarter campaign.  This port now has an
alternative event loop implementation to allow proper Berkeley sockets
using lwIP built from source, and a greatly improved network module.
Many extension modules are now enabled (ujson, ubinascii, uctypes,
uhashlib, urandom, uheapq, ure, uzlib) and the machine module includes
Timer, Pin, PWM, ADC, I2C, SPI, and basic UART.  Bignums are supported,
along with 30-bit precision floating point, and normal error messages.
There is FatFS support and uos.dupterm.

Many other improvements and bug fixes have been made to the core and
other ports.  The basic test suite can now run within a 16k heap.  Inline
assembler functions now support 4 arguments.  The Unix port has the -i
option to start the REPL after a script is finished.  The stmhal port now
exposes the flash and SD card as proper objects with the block protocol.
There is support for generic STM32F439 boards, the NUCLEO-F411RE board,
and targets to deploy via ST-LINK and OpenOCD.

py core:
- mpprint: fix sign extension when printf'ing %u, %x and %X
- vm: fix popping of exception block in UNWIND_JUMP opcode
- objstr: for str.format, add nested/computed fields support
- objstr: for str.format, don't allocate on the heap for field name
- extend native type-sig to use 4 bits, so uint is separate to ptr
- mpz: complete implementation of mpz_{and,or,xor} for negative args
- mpz: add commented-out mpz_pow3_inpl function, to compute (x**y)%z
- viper: allow casting of Python integers to viper pointers
- viper: allow uint as index to load/store, and give better error msg
- objarray: implement "in" operator for bytearray
- mpstate.h: fs_user_mount is now standard, reusable uPy functionality
- asmx64: add helper macro for generating REX_[WRXB] bits from a reg64
- asmx64: support all 16 regs in reg to memory move instructions
- emitnative: add check that RHS of viper store is of integral type
- repl: check for an identifier char after the keyword
- vm: add macros to hook into various points in the VM
- parse: use m_renew_maybe to ensure that memory is shrunk in-place
- malloc: provide a proper malloc-based implementation of realloc_ext
- emitinlinethumb: use qstrs instead of char* for names of asm ops
- add MICROPY_DYNAMIC_COMPILER option to config compiler at runtime
- stackctrl: add mp_stack_set_top() to explicitly set stack top value
- emitglue: get persistent bytecode working on Linux ARM platform
- objboundmeth: allocate arg state on stack if heap alloc fails
- use MP_SMALL_INT_POSITIVE_MASK to check if uint fits in a small int
- fix passing of some wide int types to printf varg format list
- objarray: fix array slice assignment when array is reallocated
- formatfloat: fix buffer overflow when formatting tiny numbers
- objfun: allow inline-asm functions to be called with 4 arguments
- frozenmod: allow port to override lexer to use for frozen modules
- parse: don't allocate an extra parse node for power exponent
- parse: when looking up consts, check they exist before checking type
- stream: add mp_stream_writeall() helper function
- stream: fix object vs ptr usecase in mp_stream_writeall()
- modio: initial implementation of io.BufferedWriter class
- modio: implement io.BufferedWriter.flush()
- modio: io.BufferedWriter: describe flushing policy
- formatfloat: fix case of float format where leading digit was "10"
- formatfloat: fix further cases of buffer overflow in formatting
- parsenum: use pow function to apply exponent to decimal number
- ringbuf.h: add reusable ring buffer class
- map: prevent map resize failure from destroying map
- move stream-related declarations from obj.h to stream.h
- combine continuous block of emit steps into with_cleanup emit call
- implement basic with support in native emitter
- objarray: fix array.append so it doesn't extend if append fails
- stream: add bigger inventory of stream ioctl's
- stream: add Python-level ioctl() method

extmod:
- update uzlib to 1.2.2
- fsusermount: introduce separate mkfs() function
- fsusermount: implement separate umount() function
- fsusermount: change block protocol to support ioctl method
- modmachine: truncate integers that are to be stored using mem*
- fsusermount: expose umount as a public function
- fsusermount: support mounting of multiple block devices
- vfs_fat: object-oriented encapsulation of FatFs VFS
- vfs_fat_diskio: reusable FatFs module, move from stmhal/diskio
- vfs_fat_file: reusable FatFs module, move from stmhal/file
- vfs_fat_ffconf: reusable FatFs module, move from stmhal/ffconf
- vfs_fat: move listdir() method from stmhal for reuse
- vfs_fat: add .remove() method
- vfs_fat: add .mkdir() method
- vfs_fat: add fat_vfs_import_stat(), reusable import stat routine
- vfs_fat: add .rename() method
- vfs_fat: add lexer, move from stmhal port for reuse
- vfs_fat_lexer: make conditional on FatFs support enabled
- modlwip: add .print() method
- modlwip: implement dummy setsockopt()
- modlwip: add stream protocol read method
- modlwip: add dummy .makefile() method
- modlwip: add stream .read() and .readline() methods
- modlwip: check for state change during recv busy-wait loop
- modlwip: still process remaining incoming data of a closed socket
- modlwip: add .write() stream method
- modlwip: support non-blocking recv()
- modlwip: factor out "socket connected" check to a function
- modlwip: use MICROPY_EVENT_POLL_HOOK for event polling if defined
- modlwip: rework getaddrinfo() data passing
- modlwip: add socket.setblocking() method
- modlwip: lwip_tcp_receive: Properly map lwIP error to POSIX errno
- uctypes: use mp_binary_get_val helper when extracting value
- uctypes: finish support for FLOAT32 and FLOAT64 types
- modwebsocket: start module for WebSocket helper functions
- modwebsocket: implement read support
- modlwip: add SOL_SOCKET and SO_REUSEADDR constants for setsockopt()
- modlwip: implement setsocketopt(SO_REUSEADDR)
- modlwip: lwip_tcp_send: handle properly send buffer full condition
- modlwip: add lwip->POSIX error map for lwIP 1.4.0
- modlwip: lwip_socket_setsockopt: handle option value properly
- vfs_fat_diskio: actually support sectors != 512 with Python blockdevs
- modwebsocket: properly check number of args to constructor
- modure: re_exec() renamed to ure_exec() due to collison in 4.3BSD
- modwebsocket: make sure to propagate EOF
- modwebsocket: reset mask between packets
- modwebsocket: add option for blocking writes to non-blk sockets
- modwebsocket: record current fragment type (binary/text/etc.)
- modwebsocket: allow to get type of last read data using ioctl()
- modwebsocket: implement MP_STREAM_SET_DATA_OPTS ioctl
- modwebsocket: split websocket-related defines for reuse
- modlwip: fix for loss of data in unaccepted incoming sockets
- modwebsocket: support write size beyond 125 bytes

lib:
- fatfs: add support for sector sizes larger than 512 bytes
- axtls: update to the latest upstream master

drivers:
- sdcard: add support for multi-block read/write; add SD test

tests:
- open_plus: add tests for "r+", "w+" open modes
- pyb: add simple test for stm module on pyboard
- run-tests: add esp8266 target
- bytearray1: add testcases for "in" operator
- vfs_fat_ramdisk: add test for VfsFat
- vfs_fat_ramdisk: switch to ioctl-based blockdev API
- vfs_fat_ramdisk: allow to override sector size
- vfs_fat_ramdisk: skip test if can't allocate ramdisk
- skip uctypes and urandom tests not supported byt the WiPy
- vfs_fat_ramdisk: add .listdir() testcase
- vfs_fat_ramdisk: add testcase for .remove()
- vfs_fat_ramdisk: add testcase for .mkdir()
- vfs_fat_ramdisk: allow to run in native mode (don't use "with")
- vfs_fat_ramdisk: add testcase for .rename()
- reduce large object allocations so tests can run with small heap
- print_exception: use exception which prints the same regardless of config
- recursive_iternext.py: make low-heap friendly
- run-tests: simplify handling of newline in output from tests
- run-tests: add cmd line option "--heapsize"
- split large tests into smaller files, to run with a small heap
- add new subdir "stress/" specifically for stress tests
- add a test for argument passing to inline-asm functions
- add test for io.BufferedWriter
- wipy: add Timer class tests
- float2int_fp30: variant of float2int for 30-bit stuffed float
- string_format_fp30: variant of string_format for 30-bit stuffed float

mpy-cross:
- add new component, a cross compiler for MicroPython bytecode
- give a more sensible error message when file doesn't exist
- remove setting of MICROPY_FORCE_32BIT=1 from Makefile

unix port:
- file: stop assuming that O_RDWR == O_RDONLY | O_WRONLY
- enable VfsFat support
- enabled importing of persistent bytecode (.mpy files)
- modsocket: add comment regarding close() error checking (which is none)
- unix_mphal: hack to make uos.dupterm() actually work
- implement -i option (inspect - start REPL after script is finished)
- file: parse "buffering" argument of open() builtin
- file: "encoding" arg to open() isn't kw-only
- djgpp errno.h have no ENOTSUP, so define it to Linux value
- freedos: strip and size names for binaries

stmhal port:
- diskio: introduce MICROPY_HW_HAS_FLASH setting
- move stmhal-specific FatFs routines/structs to fatfs_port.c
- file: recast as "FatFs file" class, to support other VFS types
- file: for self-contained usecase, don't define global types
- improve NUCLEO-F401RE build, with UART2 as REPL
- expose flash and SD card as proper objects with block protocol
- add mount/umount/mkfs to os module
- add a function for setting the pin alternate function
- NUCLEO 401 - Add a bunch of missing pins and reorder the pins
- CERB40 - Add pins defines for I2C3
- NUCLEO 401 - Add definitions for I2C2 and I2C3
- diskio: add provision for default returns for ioctl INIT/SEC_SIZE
- improvements to the STM32F4DISC UART config settings
- enabled importing of persistent bytecode (.mpy files)
- make SPI use mp_hal_gpio_set_af
- switch from dfu-util to tools/pydfu.py for default deploy method
- add stmhal-specific README.md with extra details for this port
- add makefile target to deploy stmhal build via ST-LINK
- add support for generic STM32F439 board (non DISCO)
- add makefile target and configuration to deploy via OpenOCD
- add board definition files for NUCLEO_F411RE
- rename STM32F401NUCLEO to NUCLEO_F401RE
- NUCELO_F401RE cleanup
- consistently enable USB SOF Irqs for all USB modes (FS and HS)

qemu-arm port:
- reinitialise uPy heap and runtime at start of each test
- enable builtin override feature, and enable more tests

cc3200 port:
- add stmhal/builtin_open.c to build
- fix breakage after VfsFat refactor
- finally fix the Timer class API
- improve robustness of the I2C driver
- simplify the Timer API and correct the documents
- fix "debug" build
- improve robustness of WLAN during sleep modes
- rename 'server' class to 'Server' for consistency
- update WiPy software version to 1.2.0

esp8266 port:
- modesp: implement flash_write(), flash_erase()
- README: add hint about adding toolchain to PATH
- modpybrtc: simplify multiplication by fixed-point value
- switch bignum implementation from long-long to mpz
- enable float support, using 30-bit stuffed floats
- enable math module
- allow Makefile's PORT variable to be overridden
- change "soft reboot" message to work with pyboard.py
- add network.ifconfig()
- enable ujson, ubinascii, and uctypes modules
- esp8266.ld: link in SDK version section
- enable config settings helpful for debugging
- enable uhashlib module
- enable more features in mpconfigport.h
- add mp_hal_delay_us function
- add time.{sleep_ms,sleep_us,ticks_ms,ticks_us,ticks_diff}
- reset "virtual RTC" on power on
- modutime: support float argument to time.sleep()
- add modmachine with mem* arrays
- modmachine: basic implementation of Timer for OS virtual timers
- modmachine: changing params of a timer requires disarming it first
- etshal.h: add timer functions prototypes
- modmachine: use etshal.h
- modmachine: timer: Add ONE_SHOT and PERIODIC symbolic constants
- add custom _assert() function
- implement Pin.__call__() and Pin.OPEN_DRAIN mode
- expose simple pin API at C level
- modpybpin: add support for GPIO16
- modmachine: add Pin class from modpyb
- etshal.h: more prototypes of ESP8266 SDK/BootROM functions
- support raising KeyboardInterrupt on Ctrl+C
- uart: add uart_flush() function
- allow Makefile's BAUD variable to be overridden
- enable stack overflow checking
- don't gc-collect BSS
- enable modlwip
- Makefile: add define for ESP8266 lwIP
- put more code in iROM section
- main: module to run on boot is "boot", not "main"
- move pyb.freq to machine.freq
- modnetwork: allow to configure STA and AP interfaces separately
- move wifi_mode() and phy_mode() to network module
- modnetwork: add per-interface .active() method
- modnetwork: move config defines to the top
- modnetwork: introduce interface .config() method
- modnetwork: add symbolic names for network interfaces: STA_IF & AP_IF
- add alternative event loop implementation
- feed WDT in ets_loop_iter()
- ets_alt_task: be sure to "pop" event before calling its handler
- ets_alt_task: update for vendor SDK 1.5.0
- esp_mphal: add higher-level event polling function
- define MICROPY_EVENT_POLL_HOOK for the port
- switch to lwIP built from source
- store frozen modules in FlashROM
- ets_alt_task: make FIRST_PRIO=0 to cover all task priorities
- make mp_hal_delay_us work with new event framework
- enable urandom module
- add module weak link from json to ujson
- enable more extmod's: uheapq, ure, uzlib
- enable non-blocking stream support
- add "socket" and "usocket" aliases for lwip module
- enable auto-indent in REPL
- expose pin object as a public structure for use as C pin API
- add basic I2C driver, with init and writeto methods
- modpybi2c: add missing include
- clean up bit-bang I2C implementation
- implement bit-bang I2C read, and add i2c.readfrom method
- add onewire helper functions as C module
- add tests/onewire.py as a driver and test code for ds18b20 dev
- implement software SPI class
- add PWM support
- esppwm.c: fix IRQ handler prototype
- put lexerstr32.o into FlashROM
- put utils.o to FlashROM
- link ADC class into machine module
- add esp.neopixel_write function to bit-bang WS2812 data
- tests: add neopixel.py test
- put modpybi2c.o to FlashROM
- set up UART handling task soon into init process
- modesp: flash_write(): Writes in multiples of 4 bytes
- modesp: flash_read(): Accept buffer to read to as a second argument
- README: update for the current status of the port
- enable FatFs support
- esp8266.ld: put FatFs to FlashROM
- deploy: Use --flash_size=8m option to esptool.py
- moduos: add listdir() proxy for MP_STATE_PORT(fs_user_mount)[0]
- moduos: factor out VFS method proxy helper
- moduos: add os.remove(), proxying to VFS object
- zero out fs_user_mount state on (soft) reset
- support importing modules from filesystem
- implement os.urandom function
- add basic support for duplicating REPL output
- enable uos.dupterm() method
- esp_mphal: add support for debug UART-only output
- let esp8266 "os" messages go to standard (REPL) UART
- support synchronous wifi scanning
- fix issue when current REPL line was garbage-collected
- switch back to accumulating input data via ring buffer
- implement input part of dupterm handling
- reset term_obj on reboot
- move PHY mode constants from modesp to modnetwork
- disallow recursive calls to REPL
- support dedicated REPL loop (aka pull-style)
- switch to non event-driven REPL to support paste mode
- uart: get ctrl-C working now that event-based REPL is disabled
- use VM_HOOK to call ets_loop_iter within the VM
- README: add link to docs
- move .rodata where it belongs with -mforce-l32 help
- bump iROM size to 512k
- ets_alt_task: comment out debug output
- minimize gap between Inst/DataRAM segments and FlashROM segment
- switch back to flashing combined firmware (single file)
- update flashing instructions in README
- bump heap size to 24k
- move pyb.hard_reset() to machine.reset()
- move pyb.unique_id() to machine.unique_id()
- modnetwork: require_if(): Report the actual interface required
- make destination for vendor OS debug output soft-configurable
- add initial implementation of machine.UART
- README: add short troubleshooting section
- switch from terse error messages to normal ones
- implement multistage bootstrap sequence
- add esp.freemem() and esp.meminfo() functions
- implement mp_builtin_open() using vfs_proxy_call()

examples:
- http_client.py, http_server.py aren't just unix, move to network/
- http_client.py: improve CPython compatibility in stream mode
- http_client.py: introduce main() function
- http_server.py: refactor/simplify for Python 3.5
- http_server.py: introduce main() function
- http_server.py: bind to 0.0.0.0, to be accessible from other hosts
- http_client_ssl.py: HTTPS client example

docs:
- correct WiPy Timer docs
- minor change to improve clarity in machine.Timer docs
- add note on machine.Timer class regarding PWM output pins
- correct machine.Timer code examples related to duty cycle
- add esp8266 quick reference page, with basic info
- esp8266: minor tweaks to quickref, Timer and I2C classes
- add versions.html template and support code for a version sidebar
- allow list of versions to be specified by environment variable
- esp8266: fix indent errors, typos, and add info about REPL UART
- update asm_thumb2_hints_tips re return type of asm funcs
- update details on using ADCAll object for vref/vbat channels
- add Python speed optimisation guide, including minimal viper ref
- esp8266: update quick reference: i2c.readfrom and neopixel example
- update asm tutorial, maximum number of allowed args is now 4
- update pyb.I2C constructor to reflect changes in Pyboard Lite
- mention that pyb.SPI constructor accepts "X" and "Y" arguments
- update pyb.UART.any() to mention that it returns character count
- topindex.html: refer to "pyb" module only for pyboard
- add standard modules list for esp8266
- network: esp8266: Update docs on WLAN constructor
- more standard modules for esp8266
- esp: remove getaddrinfo(), now in socket module as expected
- esp8266/quickref: note that timers supported are virtual ones
- esp8266/quickref: add note about GPIO16
- esp8266: phy_mode() moved to network module
- esp8266: esp.wifi_mode() replaced with network.WLAN.active()
- esp8266: esp.mac() replaced with network.WLAN.mac()
- correct pin interrupt example code for the WiPy
- network: esp8266: status is WLAN object method
- network: esp8266: .scan() is now synchronous and returns result list
- update copyright notice
- esp8266: esp.socket is deprecated, remove from docs
- os: change wording to be a bit more port-neutral
- machine: change wording to be a bit more port-neutral
- ubinascii: document a2b_base64(), b2a_base64()
- esp8266/quickref: add note about physical vs logical pin numbers
- ubinascii: document non-standard "sep" argument to hexlify()
- esp8266: Enable "machine" module docs