micropython 发布 1.16 版

Spoony 64.6m2021-06-191038 次点击
MicroPython的这个版本包括一个新的命令行工具“mpremote”,它是从命令行远程控制基于MicroPython的设备的主要方式。它具有串行终端、文件系统访问、支持在远程设备上挂载本地目录以及定义自定义命令的宏语言。这个工具可以通过“pip3 install mpremote”从PyPI安装,它可以在Linux、Windows和Mac上运行。作为其中的一部分,对pyboard.py进行了改进,包括用独占模式打开串行端口,以便更轻松地管理多个设备。

在Python内核中,OSError异常现在支持“.errno”属性,并且添加了一个选项来编译MicroPython而不产生错误消息,以便在需要时进一步减少代码大小。REPL得到了改进,因此它不需要tab-complete私有方法(如果尚未键入下划线,则从下划线开始),现在它还可以在键入“import”之后tab-complete内置模块名。

相对导入异常有一个小的突破性变化:之前的ValueError在CPython中发生了相同的变化之后被更改为ImportError。参见提交53519e3。

在extmod组件中,uctypes修复了FLOAT32数组的大小和偏移量计算,uhashlib现在会在调用digest后重用哈希时引发异常,urandom支持将0传递给getrandbits(在CPython更改之后)。在uasyncio中,readinto方法被添加到Stream类中,并修复了两个竞争条件:一个是具有 start_server 和wait_closed, 另一个是取消等待完成任务的任务;分别见de2e081和514bf1a。

esp32现在支持使用新的CMake构建系统指定FROZEN_MANIFEST,并支持在GPIO32和GPIO33上使用NeoPixel,在IDF v4.1和更高版本中支持network.LAN,并且在WLAN STA接口中具有新的“reconnects”选项,用于配置在WiFi关闭时进行(如果有)重新连接尝试。

mimxrt增加了许多功能,包括:带内部闪存的VFS文件系统、Pin、Pin.irq和ADC、UART、SoftI2C和SoftSPI总线、定时器和RTC类以及浮点数等。

rp2现在有machine.RTC类来配置RTC,以及SparkFun的Thing Plus RP2040和Pro Micro板的新定义文件。

stm32现在支持静态软定时器和基于C的回调,并且mboot已经变得更加可配置,特别是led和复位模式选择现在可以完全定制。增加了两块新开发板:VCC_GND_F407VE 和 VCC_GND_F407ZG。对SDIO驱动程序进行了错误修复,以确保DMA不会关闭中间传输;当使用某些SPI总线时,这会影响WLAN的操作。有关详细信息,请参见提交a96afae。UART的引脚配置已修改,现在只在RX和CTS上配置上拉,而不是在TX和RTS上配置,见748339b。USB_VCP类有一个新的irq方法来设置USB数据接收事件的回调。以太网驱动程序现在支持低功耗模式,并且有一个修复程序,以便正确报告链路状态。

在zephyr上,现在在空闲REPL和休眠期间运行调度,并且有一个初始的ubluetooth模块,支持可扩展扫描和广告。为nucleo_wb55rg板提供配置。

下面是从git提交历史生成的更改的详细列表,并将其组织为多个部分。

感谢所有为这次发布做出贡献的人!

```
Main components

all:
rename mp_keyboard_interrupt to mp_sched_keyboard_interrupt
replace busses with buses

py core:
objexcept: support errno attribute on OSError exceptions
add option to compile without any error messages at all
dynruntime.h: add mp_obj_get_array() function
profile: use mp_handle_pending() to raise pending exception
scheduler: add mp_sched_exception() to schedule a pending exception
scheduler: add optional port hook for when something is scheduled
runtime: remove commented-out code from mp_deinit()
scheduler: add missing MICROPY_WRAP_MP_SCHED_EXCEPTION usage
repl: filter private methods from tab completion
repl: enter four spaces when there are no matches
repl: refactor autocomplete to reduce nesting
repl: refactor autocomplete, extracting reusable parts
repl: autocomplete builtin modules
gc: make gc_lock_depth have a count per thread
mkenv.mk: don't emit info about BUILD_VERBOSE if it's set
objarray: prohibit comparison of mismatching types
objarray: implement more/less comparisons for array
objarray: use mp_obj_memoryview_init helper in mp_obj_new_memoryview
objarray: fix constructing a memoryview from a memoryview
nlraarch64: add underscore prefix to function symbols for Darwin ABI
nlrx64: correct the detection of Darwin ABI
asmx64: support use of top 8 regs in src_r64 argument
emitnative: fix x86-64 emitter to generate correct 8/16-bit stores
mkrules.cmake: add MPY_LIB_DIR and BOARD_DIR to makemanifest call
asmarm: use builtin func to flush I- and D-cache on ARM 7 archs
compile: raise an error on async with/for outside an async function
gc: access the list of root pointers in an asan-compatible way
repl: don't read past the end of import_str
builtinimport: change relative import's ValueError to ImportError
emitglue: always flush caches when assigning native ARM code
stackctrl: prevent unused-var warning when stack checking disabled
gc: only use no_sanitize_address attribute for GCC 4.8 and above

extmod:
uasyncio: use .errno instead of .args[0] for OSError exceptions
remove old comments used for auto-doc generation
moductypes: remove double blank lines and debugging printf's
moductypes: replace numbers with macro constants
moductypes: fix size and offset calculation for ARRAY of FLOAT32
moduhashlib: put hash obj in final state after digest is called
modurandom: add error message when getrandbits has bad value
modurandom: support an argument of bits=0 to getrandbits
uasyncio: fix start_server and wait_closed race condition
uasyncio: add readinto() method to Stream class
uasyncio: fix race with cancelled task waiting on finished task
nimble: remove TODO comment about notify_custom freeing om

lib:
utils: remove unused PYEXEC_SWITCH_MODE from pyexec.h
utils: add ARM semihosting utility functions
lwip: switch to use GitHub mirror repo
mbedtls: switch to currently latest commit of LTS branch v2.16

drivers:
sdcard: add sleep_ms(1) delay in SDCard.readinto sync loop
cyw43/cyw43_ctrl: use new sdio enable API functions
cyw43/cywbt: add compile option for RF switch
cyw43/cywbt: remove hard-coded UART6 alternate function setting
display/ssd1306.py: add rotate method
display/ssd1306.py: add support for 72x40 displays
mpy-cross: no changes specific to this component/port

Support components

docs:
library/machine: specify initial machine.PWM class
library/machine: add machine.bootloader docs
esp8266: add note about simultaneous use of STA_IF and AP_IF
esp8266: add instructions on entering programming mode manually
esp8266: clarify limitations of SSL in esp8266 and fix typos
fix some spelling mistakes
pyboard: fix typo in pyb.Switch tutorial
esp32: add UART to quickref
esp32: add WDT to quickref
esp32: add SDCard to quickref
esp8266: add WDT to quickref
library: add initial API reference for rp2 module and its classes
library/rp2.rst: fix typo overriden->overridden
esp32: add APA106 to quickref
esp32: mention Signal in GPIO section of quickref
esp8266: mention Signal in GPIO section of quickref
esp8266: add SSD1306 to quickref and tutorial
library: clarify what type of algorithm is implemented in heapq
library: add a blank line to fix formatting for ussl docs
library/pyb.Pin.rst: update the arguments for Pin.init()
rp2: add skeleton docs for the rp2 port
library/machine.RTC.rst: document datetime method and fix ex code
esp32: document WLAN "reconnects" config option

examples: no changes specific to this component/port

tests:
use .errno instead of .args[0] for OSError exceptions
run-multitests.py: provide some convenient serial device shorcuts
multi_bluetooth: add performance test for gatt char writes
thread: make stress_create.py test run on esp32
thread: make stress_aes.py test run on bare-metal ports
thread: make exc1,exit1,exit2,stacksize1,start1 tests run on rp2
run-perfbench.py: fix native feature check
run-multitests.py: flush stdout for each line of trace output
run-tests.py: parallelize running tests by default
cpydiff: add test and workaround for function.module attr
make float and framebuf tests skip or run on big-endian archs
extmod/btree_gc.py: close the database to avoid a memory leak
basics: split out literal tests that raise SyntaxWarning on CPy
run-multitests.py: allow to work without sys.stdout on target
multi_bluetooth/ble_gap_advertise.py: allow to work without set
unix: add ffi test for integer types
cpydiff: add test for array constructor with overflowing value
float: make bytes/bytearray construct tests work with obj repr C

tools:
metrics.py: add rp2 port to table of ports that can be built
upip.py: use .errno instead of .args[0] for OSError exceptions
pyboard.py: support opening serial port in exclusive mode
gen-cpydiff.py: fix formatting of doc strings for new Black
makemanifest.py: show directory name if there is a FreezeError
mpy_ld.py: support R_X86_64_GOTPCREL reloc for x86-64 arch
pydfu.py: remove default VID/PID values
ci.sh: update zephyr docker image to v0.17.3
ci.sh: use FROZEN_MANIFEST in an esp32 build to test feature
mpy-tool.py: support relocating ARMv6 arch
tinytest-codegen.py: add command-line option to exclude tests
ci.sh: build Cortex-A9 sabrelite board as part of qemu-arm CI
pyboard.py: track raw REPL state via in_raw_repl variable
pyboard.py: add "soft_reset" option to Pyboard.enter_raw_repl()
mpremote: add new CLI utility to interact with remote device
ci.sh: build mpy-cross as part of ci_mimxrt_build
mpremote: use available ports instead of auto-connect list
mpremote: use signal to capture and handle ctrl-C on Windows

CI:
workflows: add CI workflow for mimxrt port
workflows: add workflow to build and run unix port on MIPS
workflows: add workflow to build and run unix port on ARM

The ports

bare-arm port:
switch to use MICROPY_ERROR_REPORTING_NONE to reduce size
cc3200 port: no changes specific to this component/port

esp8266 port:
modnetwork: use mp_handle_pending() to raise pending exception
boards/GENERIC_512K: add custom manifest without FS modules
update manifest to point to new dirs in micropython-lib
boards/GENERIC_512K: add custom minimal _boot.py

esp32 port:
CMakeLists.txt: require CMake version 3.12
restore FROZEN_MANIFEST support with new CMake build system
esp32_rmt: clear config struct before filling it out
mpthreadport: don't explicitly free thread struct in TCB cleanup
mpthreadport: use binary semaphore instead of mutex
extend support for S2 series, and S3 where applicable
boards: rename TINYPICO board to UM_TINYPICO
boards: add UM_FEATHERS2 and UM_TINYS2 board definitions
boards/UM_TINYPICO: fix include of sdkconfig fragment
machine_i2c: allow boards to configure I2C pins using new macros
boards: set default I2C and SPI pins on UM_xxx boards
boards: fix spelling mistakes in comments for UM_xxx boards
update manifest to point to new dirs in micropython-lib
boards: add M5STACK_ATOM board definition
espneopixel: add support for GPIO32 and GPIO33
Makefile: fix wrong target for partition-table.bin
makeimg.py: load sizes from partition table and verify data fits
partitions-2MiB.csv: update table so firmware fits
README: describe how to select compatible version of existing IDF
network_lan: add Ethernet support for IDF v4.1 and above
modnetwork: add "reconnects" option to WLAN STA interface
machine_hw_spi: allow None for unused pins in initializer
machine_sdcard: use deinit_p to deinit SD bus in SPI mode

javascript port: no changes specific to this component/port

mimxrt port:
improve ticks and sleep functions using GPT
implement machine.Pin class
enable built-in help
extend the Pin module for SoftI2C, SoftSPI support
add custom help text and enable help("modules")
enable frozen modules
add flash storage support with VFS and littlefs filesystem
boards/TEENSY40: re-create the flash FS after deploy
add the Timer class to the machine module
remove __WFE() from MICROPY_EVENT_POLL_HOOK
machine_timer: reuse any existing timer objects
machine_timer: leave the Timer clock source at IPG clock
machine_rtc: add the RTC class to the machine module
add floating point support
enable many Python and some extmod features
machine_adc: add the ADC class to the machine module
boards: add board configuration files for Teensy 4.1
machine_rtc: change RTC.datetime() tuple to match other ports
machine_rtc: maintain microsecond offset
machine_uart: add the UART class to the machine module
machine_pin: implement pin.irq() functionality
modutime: extend the time module

minimal port: no changes specific to this component/port

nrf port:
boards/microbit: use mp_sched_exception() where appropriate
add machine.memXX, and allow boards to customise some features
boards: add support for evk_nina_b3 board
add more math sources to Makefile, and enable log2 implementation

pic16bit port:
Makefile: make the XC compiler version user-configurable

powerpc port: no changes specific to this component/port

qemu-arm port:
add support for Cortex-A9 via sabrelite board

rp2 port:
boards: add board definition for SparkFun Thing Plus RP2040
boards: add board definition for SparkFun Pro Micro board
tusb_port: add the device unique-id to the USB id
move manifest.py to boards directory
mpthreadport: add mp_thread_deinit to reset core1 on soft reset
CMakeLists.txt: include tinyusb_common in PICO_SDK_COMPONENTS
machine_rtc: add initial support for RTC
machine_rtc: check return value from rtc_set_datetime

samd port: no changes specific to this component/port

stm32 port:
boards/pllvalues.py: support wider range of PLL values for F413
machine_timer: improve usability of Timer constructor and init
mboot: allow unpacking dfu without secret key
correct typos in project README files
uart: fix H7 UART clock source configuration
softtimer: add support for having a C-based callback
softtimer: support static soft timer instances
boardctrl: add constants for reset mode values
boardctrl: show first reset-mode state on LEDs when selecting
mboot: allow a board to add source files to the build
adc: allow mboot to use basic ADC functions
mboot: fix mp_hal_delay_us() and add mp_hal_ticks_ms()
mboot: allow a board to customise the linker scripts
mboot: allow mboot to be placed at any location in flash
sdcard: allow configuring the SDMMC periph used for SD/MMC card
uart: enable HW flow control for UART 1/5/7/8
sdio: add functions to re/enable SDIO/SDIOIT
boards/PYBD_SF2: enable RF switch compile option
sdio: allow configuring the SDMMC periph used for SDIO
boards: change default LSI_VALUE to 32000 for F4 MCUs
powerctrl: add MICROPY_HW_ENTER_BOOTLOADER_VIA_RESET option
boardctrl: adjust logic for running boot.py, main.py
mboot: add MBOOT_LEAVE_BOOTLOADER_VIA_RESET option
mboot: make LEDs and reset-mode selection more configurable
boards: add VCC_GND_F407VE board
boards: add VCC_GND_F407ZG board
sdio: fix case of SDIO DMA turning off mid transfer
uart: configure pull-up only on RX and CTS, not TX and RTS
mboot: leave bootloader from thread mode, not from IRQ
boards/NUCLEO_L432KC: fix FS size and enable LFS1 filesystem
boards/PYBD_SF2: disable GCC 11 warnings for array bounds
usb: add USB_VCP.irq method, to set a callback on USB data RX
boards: enable MICROPY_HW_SPIFLASH_ENABLE_CACHE on VCC_GND boards
sdram: prevent array-bounds warnings with GCC 11
eth: add low-power mode configuration option
eth: fix eth_link_status function to use correct BSR bit

teensy port:
provide own implementation of gc_collect, to not use stm32
correct typos in project README files

unix port:
modffi: use a union for passing/returning FFI values
main: increase stack limit on ARM architectures
modffi: fix conversion between Python integers and ffi types
fix build on arm64-darwin due to integer cast

windows port:
mpconfigport.h: enable features also present in unix port

zephyr port:
run scheduled callbacks at REPL and during mp_hal_delay_ms
modmachine: add machine.idle()
boards: add config for nucleo_wb55rg board
update disk access configuration for Zephyr v2.6.0
disable CONFIG_NET_SOCKETS_POSIX_NAMES
update to Zephyr v2.6.0
add initial ubluetooth module integration
boards: enable ubluetooth on nucleo_wb55rg board
```
收藏 ♥ 感谢
暂无回复

登录注册 后可回复。



GitHub