1094 views|6 replies

1w

Posts

25

Resources
The OP
 

MicroPython v1.23 released [Copy link]

 

Dynamic USB devices, improved webassembly porting, openamp, tls, vfs modules

This version of MicroPython adds support for dynamic USB devices defined in Python, adds new openamp, tls and vfs modules, completely reconfigures webassembly to add a proxy between JavaScript and Python, and implements significant code size optimizations for frozen modules. There are many other enhancements and bug fixes.

After a lot of design, development and testing, MicroPython now fully supports user-defined USB devices. The interface is implemented through the new machine.USBDevice class, which allows users to specify USB descriptors and implement Python callbacks for USB endpoint transfers. With it, any USB device can be implemented in pure Python. While the machine.USBDevice interface is low-level and complete, there is a higher-level USB library in the microython library that makes it easier to implement a variety of devices, such as keyboards, mice, MIDI and serial CDC. This functionality is currently available on rp2 and samd, and will be ported to other hardware in the future.

Support for the OpenAMP (asymmetric multiprocessing) protocol has been added through the new OpenAMP module. This allows MicroPython to control other CPU cores in the system, load and start processes, and communicate with them through the terminal. This functionality is currently available on mimxrt and stm32.

Two new modules have been added: vfs and tls . The vfs module contains all vfs (virtual file system) related functions and classes, such as mount, umount, and VfsFat. These were originally in the os module, but using them in os was incompatible with CPython, so they were moved to their own dedicated module. They are currently still present in the os module, but will eventually be removed from it, so it is recommended to use the vfs module from now on. Similarly, the new tls module is an evolution of the ssl module, so all existing functionality in ssl has been moved to the tls module. This was done because MicroPython's SSL interface is increasingly different from CPython's, and moving SSL/TLS functionality into the new tls module gives it room to grow and gain new features that are useful for embedded applications. Compatibility with normal Python is still retained through the pure Python implementation of the ssl module. One of the new features in the new tls module is the ability to register certificate verification callbacks.

Other additions include more methods on deque objects, making them double-ended and supporting iteration, and support for half-float 'e' formats in struct.pack/struct.unpack. Dynamic native modules have exposed some additional runtime methods, and the .mpy subversion has been increased from v6.2 to v6.3 (native code in .mpy files needs to be recompiled, but bytecode does not, and remains compatible).

Significant code size optimizations have been made for frozen modules. A new internal mp_proto_fun_t type has been defined that allows bytecode functions (as opposed to native code) to be stored in frozen code without any additional overhead of mp_raw_code_t descriptor structures. All firmware built with frozen modules will be significantly smaller in size. Code size has also been further improved for very small targets by adding an option to remove the qstr hash bytes.

Inside the source code, the "STATIC" macro definition has been removed. Code should now only use "static". If you have C/C++ code that uses "STATIC", then replace it with "STATIC", or provide your own #define defining "STATIC" to "STATIC". See

链接已隐藏,如需查看请登录或者注册
for more information .

Mbedtls has been updated to version 3.5.1. Network interface constants, such as IF_STA and SEC_WPA2, have now been merged across ports, so they are all at the WLAN class level, e.g. network.WLAN.SEC_WPA2 (the existing constants at the network module level have been retained for backward compatibility, but the new constants should be used in preference from now on).

esp32 Some important bug fixes were found in the BLE component to deinitialize without crashing, and to increase the size of the BLE task stack. This port also uses the new I2S IDF driver, and supports IDF 5.0.5 and 5.2. For esp32-C3/S2/S3 devices, support for entering the bootloader via machine.bootloader(), as well as esp32.mcu_temperature().

The rp2 port has added a new machine.USBDevice dynamic USB driver and applied firmware performance optimizations to key parts of the runtime and virtual machine, resulting in a performance improvement of about 10%. Direct access to the memory of PIO and SPI FIFOs is now possible through proxy arrays, and bugs with threads, lightsleep, and UART IRQ delays have been fixed.

The stm32 port has integrated support for the new openamp module, which is enabled on all Arduino boards. The firmware for Arduino boards is now frozen in additional Arduino-specific library code. Internal flash writes on STM32H5 and STM32H7 MCUs have been fixed (bank selection and last word in write buffer), an important fix for SPI DMA cache errors, an I2C clock fix for I2C4 on STM32F7 MCUs, and a fix for FDCAN source clock frequency on STM32G4 MCUs have been added. Mboot has added support for a new raw file system to allow simpler and more robust firmware updates.

The webassembly port has been significantly overhauled in structure and is now built as a JavaScript .mjs module, exporting a user-friendly JavaScript level API inspired by the API provided by Pyodide (which is a version of CPython that runs in the browser). This change was motivated by the need to use MicroPython as an engine in Pyscript, a platform for Python in the browser. New features in the webassembly port include object proxies between Python and JavaScript, a js module to interface with JavaScript namespaces, a jsffi module for various proxy helpers, top-level asynchronous code, JavaScript-driven async support, automatic growth of the Python heap, integration of JavaScript and Python finalization for global memory management, more time module functions, and support for build variants (following the unix port).

The changes in code size of the various ports since the last release are (absolute and percentage changes in the text section):

   bare-arm:   -220  -0.383%
minimal x86:   -341  -0.184%
   unix x64: +20168  +2.527%
      stm32:  -1692  -0.430%
     cc3200:   +256  +0.139%
    esp8266:  -8880  -1.260%
      esp32:  -3328  -0.194%
     mimxrt:   -408  -0.112%
 renesas-ra:   -464  -0.074%
        nrf:   -640  -0.341%
        rp2:  +5380  +1.626%
       samd:  +3224  +1.229%

The main reasons for these code size changes are:

  • bare-arm, minimal: disable qstr hashing
  • unix: Update mbedtls to version 3.5.1
  • stm32: optimize size of frozen modules
  • cc3200: added new vfs module, and fixed bugs in VM and array types
  • esp8266: disable unused MICROPY_DEBUG_PRINTERS and optimize frozen modules
  • esp32, mimxrt, renesasra, nrf: optimize frozen modules
  • rp2: add machine.USBDevice, enable -O2 optimization
  • samd: add machine.USBDevice

The performance of all ports is effectively unchanged since the last release, with the exception of the rp2 port, which has seen a performance improvement of about 10%.

Thanks to everyone who contributed to this release: Amirreza Hamzavi, Andrew Leech, Angus Gratton, Brian Pugh, Carlosgg, Christian Walther, Damien George, Danil van de Giessen, darc, Dash Peters, David Lechner, Felix Drre, iabdalkader, Ihor Nehrutsa, Iksas, J. Neuschfer, Jared Hancock, Jim Lipsey, Jim Mussared, Jochen Sprickerhof, Joey232, Jos Verlinde, Kwabena W. Agyeman, Maarten van der Schreck, Matt Trentini, Matthias Urlichs, Michia iel W. Beijen, Mike Teachman, Nicko van Someren, Olivier Lenoir, Phil Howard, Rick Sorensen, robert hh, Sebastian Romero, Simon Wood, Stanislav Ponomarev, stijn, Takahashi Takeo, Trent Piepho, Trent Warlaven, Vonasmic, YAMAMOTO Takashi, Yoctopuce.

MicroPython is a global open source project with contributions from the following time zones: 0800, 0700, 0600, -0500, -0300, +0000, +0100, +0200, +0330, +0400, +0900, +1000, +1100.

The work for this release was funded in part by GitHub Sponsors and in part by George Robotics, Espressif, Anaconda, Arduino, LEGO Education, OpenMV, and Planet Innovation.

链接已隐藏,如需查看请登录或者注册

Latest reply

Are there no detailed tutorials on this? If so, please recommend some.   Details Published on 2024-6-9 10:11
 
 

1127

Posts

17

Resources
2
 

Then it should be very convenient to write USB with micrpython.

Comments

Yes  Details Published on 2024-6-4 17:44
 
 
 

1w

Posts

25

Resources
3
 
fxyc87 posted on 2024-6-4 17:06 Then it should be very convenient to write USB with micrpython.

Yes

 
 
 

685

Posts

0

Resources
4
 

Finally I remembered the Bluetooth of ESP32, it's too difficult and not very easy to use

Comments

espnow is more convenient, you can try it  Details Published on 2024-6-6 12:51
 
 
 

1w

Posts

25

Resources
5
 
Posted by Extreme Zero on 2024-6-6 08:50 I finally remembered the Bluetooth of ESP32. It's too difficult and not very easy to use

espnow is more convenient, you can try it

 
 
 

38

Posts

0

Resources
6
 

Are there no detailed tutorials on this? If so, please recommend some.

Comments

The official tutorial is basically enough, but it is only in English. For the rest, you can look through the previous posts, there is a lot of content, but it is relatively scattered.  Details Published on 2024-6-9 11:33
 
 
 

1w

Posts

25

Resources
7
 
hjh0512 posted on 2024-6-9 10:11 Is there no detailed tutorial on this? If there is a high probability that there will be one, please recommend a few.

The official tutorial is basically sufficient, but it is only in English.

For the rest, you can look through the previous posts. There is quite a bit of content, but it is rather scattered.

 
 
 

Guess Your Favourite
Just looking around
Find a datasheet?

EEWorld Datasheet Technical Support

Featured Posts
What is Linux? Why did Huawei develop Hongmeng system based on Linux?

What is Linux? Why did Huawei develop Hongmeng system based on Linux? In response to the Sino-US trade friction, after ...

BlueNRG-1/2 Flash operations require mutual exclusion with BLE events

When using the Flash of BlueNRG-1/2 to store application data, you may encounter problems such as no Bluetooth signal o ...

What are the most common wireless communication (data) transmission technologies?

1. Long-distance wireless transmission technology Long-distance wireless transmission technology: Currently, the wireles ...

Discussion on the Reasons for the Temperature Drop of MOS Tubes Connected in Parallel

A circuit was originally designed to test the size of AC current. The design value is 5A maximum, with multiple rang ...

csi_pwm_init function

593820 What do device handle and device good mean? What kind of initialization function does ret = csi_pwm_init(&r, 0) ...

37 "Ten Thousand Miles" Raspberry Pi Car——ROS Learning (VSCode Debugging ROS)

This post was last edited by lb8820265 on 2022-5-10 00:27 I have introduced VSCode debugging before , which is GDB deb ...

RTD Circuit Design

RTD Circuit Design PT100/1000 meaning Common RTDs are PT100 and PT1000. 100 and 1000 mean that when the temperature is 0 ...

Canaan wants to record a video about K510. What kind of content do you hope to see? (Attached is the official information about K510)

>>The K510 board just arrived this morning . In order to help engineers get started with development, Canaan plans t ...

What is the function of the resistor at the power input end of TP4056?

This post was last edited by sky999 on 2022-8-20 03:27 Is the function of this resistor to consume some heat? Looking a ...

Connectivity and power: New Qorvo provides more comprehensive solutions for the industry

Matter was born to dissolve the ecological barriers of the Internet of Everything The Internet of Things has made the i ...

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京B2-20211791 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号
快速回复 返回顶部 Return list