Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to upgrade micropython to v1.15

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/02 Report--

This article will explain in detail how to upgrade micropython to v1.15, the content of the article is of high quality, so the editor will share it with you for reference. I hope you will have some understanding of the relevant knowledge after reading this article.

MicroPython adds general support for using CMake as a build system in this release. The RP2 migration has been merged to use the new CMake file, and the esp32 and zephyr migration has been switched to a pure CMake project. All three migrations have SDK built around CMake, a change that makes them easier to maintain and use.

As part of this effort, CMake-based portals now support user C modules. The author of the user C module should provide both .mk and .cmake configuration files (follow the documentation and examples).

Fixed an error in the multi-precision integer library, that is, arithmetic overflow in long division routines. Before this fix, some integer division will take a lot of time and produce incorrect results. For more information, see submit 0a59938. In addition, fixed regular expressions to check for and report byte overflow errors when compiling expressions. See 172fb52.

In the uasyncio library, a new MicroPython extension ThreadSafeFlag has been added, which can be set from outside the asyncio event loop, such as from another thread, irq, or scheduler context. It allows signals to be sent to asyncio tasks in preemptive code like irq, which are essentially collaborative (non-preemptive). Asyncio.current_task () has also been added with the same semantics as CPython.

As mentioned above, the esp32 migration has been switched to a complete CMake-based project, and the traditional make functionality has been removed (although a simple helper Makefile is still retained to keep the top-level build / deployment commands consistent with other migrations). Because the switch to CMake,network.LAN support has been removed and will be re-added later (use the previous version if you need LAN). The esp32 module adds basic support for non-volatile storage. In addition, ESP32-S2 and USB are initially supported, and a general S2 board is defined.

On mimxrt and samd migration, USB-CDC-TX processing has been fixed, so it now works reliably.

The RP2 migration enables more Python core features, as well as the ubinascii.crc32 (), uos.VfsFat and machine.Signal classes, and the uerrno module. Uos.urandom () has been added, and machine.freq () can now change the CPU clock rate. The machine.UART class now supports timeout/timeout_char, inverted TX/RX signals, and TX/RX with configurable buffer size. For PIO,StateMachine, the restart (), rx_fifo () and tx_fifo () helper functions have been added, and fifo connections are supported. The user C module (via CMake) and building different board configurations are now supported (the default is still PICO board). The reliability of USB is improved.

For stm32 migration, there are now more board configuration options, such as USBD VID/PID and module fine-grained selection. The UART class now supports LPUART on L0, L4, H7, and WB MCU. WB MCU has a fix to the race condition for accessing the list of BLE ACL free buffers to address low-level BLE bug.

The zephyr migration has been updated to use Zephyr v2.5.0 and to build MicroPython using CMake.

The following is a detailed list of changes generated from the git submission history and organized into sections.

Main component

All:

Rename BYTES_PER_WORD to MP_BYTES_PER_OBJ_WORD

Add .git-blame-ignore-revs for fixing up git blame output

Py core:

Gc: don't include mpconfig.h and misc.h in gc.h

Remove BITS_PER_WORD definition

Rename BITS_PER_BYTE to MP_BITS_PER_BYTE

Rename WORD_MSBIT_HIGH to MP_OBJ_WORD_MSBIT_HIGH

Gc: change include of stdint.h to stddef.h

Mpz: fix overflow of borrow in mpn_div

Add core cmake rule files

Expand lists in core cmake custom commands

Mkrules.cmake: rename QSTR_DEFS variables to QSTRDEFS

Mkrules.cmake: add MICROPY_QSTRDEFS_PORT to qstr build process

Nlr: implement NLR for AArch74

Nlrx64: fix typo in comment

Vm: for tracing use mp_printf, and print state when thread enabled

Rename remaining object types to be of the form mp_type_xxx

Py.cmake: move qstr helper code to micropy_gather_target_properties

Py.cmake: introduce MICROPY_INC_CORE as a list with core includes

Profile: resolve name collision with STATIC unset

Runtime: make sys.modules preallocate to a configurable size

Extmod:

Vfs_posix_file: allow closing an already closed file

Btstack: add HCI trace debugging option in btstack_hci_uart

Btstack: add stub functions for passkey, l2cap bindings

Btstack: enable SYNC_EVENTS, PAIRING_BONDING by default

Uasyncio: add asyncio.current_task ()

Add core cmake rule files

Nimble: ensure handle is set on read error

Moduselect: fix unsigned/signed comparison for timeoutbound copyright 1

Uasyncio: add ThreadSafeFlag

Nimble/hal/hal_uart: fix HCI_TRACE format specifiers

Modbluetooth: allow NimBLE to use Zephyr static address

Modussl: fix ussl read/recv/send/write errors when non-blocking

Btstack: use MICROPY_HW_BLE_UART_BAUDRATE for first UART init

Modbluetooth: separate enabling of "client" from "central"

Extmod.cmake: add modonewire.c to MICROPY_SOURCE_EXTMOD list

Modbluetooth: free temp arrays in gatts register services

Re1.5: check and report byte overflow errors in _ compilecode

Extmod.cmake: add support to build btree module with CMake

Lib:

Tinyusb: update to version 0.8.0

Mbedtls: switch to currently latest commit of LTS branch v2.16

Utils/gchelper_generic: implement AArch74 support

Pico-sdk: update to latest version 1.1.0

Drivers: no changes specific to this component/port

Mpy-cross: no changes specific to this component/port

Support component

Docs:

Library/uasyncio.rst: add docs for ThreadSafeFlag

Develop/cmodules.rst: document C-modules and micropython.cmake

Develop: improve user C modules to properly describe how to build

Examples:

Usercmodule: add micropython.cmake to the C and CPP examples

Usercmodules: simplify user C module enabling

Embedding: fix example so it compiles again

Tests:

Extmod/vfs_posix.py: add more tests for VfsPosix class

Extmod: add test for ThreadSafeFlag

Multi_bluetooth: add basic performance tests

Rename run-tests to run-tests.py for consistency

Run-tests.py: reformat with Black

Multi_bluetooth: skip tests when BLE features are unsupported

Extmod/vfs_fat_fileio2.py: close test file at end of test

Run-tests.py: provide more info if script run via pyboard crashes

Feature_check: check for lack of pass result rather than failure

Net_inet: add 'Strict-Transport-Security' to exp file

Tools:

Add filesystem action examples to pyboard.py help

Ci.sh: change esp32 CI to work with idf.py and IDF v4.0.2

Makemanifest.py: allow passing option args to include ()

Ci.sh: update zephyr docker image to v0.11.13

Verifygitlog.py: show required format regexp in error message

Pydfu.py: support DFU files with elements of zero size

Ci.sh: add CI for CMake USER_C_MODULE support

Ci.sh: build user C modules for esp32

Metrics.py: fix esp32 output filename due to move to CMake

Ci.sh: build esp32 using IDF v4.0.2 and v4.3

Transplant

All ports:

Remove def of MP_PLAT_PRINT_STRN if it's the same as the default

Update to build with new tinyusb

Bare-arm port:

Clean up the code, make it run on an F405, and add a README

Cc3200 port: no changes specific to this component/port

Esp8266 port:

Modules: fix fs_corrupted () to use start_sec not START_SEC

Esp32 port:

Add support to build using IDF with cmake

Esp32_rmt: don't do unnecessary check for unsigned less than zero

Add explicit initialisers to silence compiler warnings

Remove traditional "make" capability

Boards: remove old IDF v3 sdkconfig values

Boards: enable BLE on all boards

README: update based on new IDF v4 cmake build process

Add support to build with ESP-IDF v4.1.1

Add support to build with ESP-IDF v4.2

Remove obsolete IDF v3 code wrapped in MICROPY_ESP_IDF_4

Modsocket: remove unix socket error code translation

Set MICROPY_USE_INTERNAL_ERRNO=0 to use toolchain's errno.h

Boards: enable size optimisation for builds

Add support to build with ESP-IDF v4.3 pre-release

Add basic support for Non-Volatile-Storage in esp32 module

Make machine.soft_reset () work in main.py and reset_cause ()

Define MICROPY_QSTRDEFS_PORT to include special qstrs

Makefile: specify port and baud on erase_flash command

Machine_hw_spi: use default pins when making SPI if none given

Restore USER_C_MODULE support with new CMake build system

Fix multiple definition errors with mp_hal_stdout_tx functions

Enable btree module

Modsocket: correctly handle poll/read of unconnected TCP socket

Add initial support for ESP32S2 SoCs

Add support for USB with CDC ACM

Boards: add GENERIC_S2 board definition

Machine_pin: use rtc_gpio_deinit instead of gpio_reset_pin

Javascript port: no changes specific to this component/port

Mimxrt port:

Fix USB CDC handling so it works reliably

Boards: add MIMXRT1050_EVK board, based on MIMXRT1060_EVK

Enable CPYTHON_COMPAT, PY_ASYNC_AWAIT, PY_ATTRTUPLE options

Minimal port: no changes specific to this component/port

Nrf port:

Drivers/usb: add USBD_IRQHandler which calls tud_int_handler

Pic16bit port: no changes specific to this component/port

Powerpc port: no changes specific to this component/port

Qemu-arm port: no changes specific to this component/port

Rp2 port:

Machine_adc: only initialise the ADC periph if not already enabled

Micropy_rules.cmake: fix makemoduledefs vpath to work with abs path

Use local tinyusb instead of the one in pico-sdk

Enable MICROPY_PY_UBINASCII_CRC32 to get ubinascii.crc32 ()

Enable VfsFat class for FAT filesystem support

Machine_uart: add timeout/timeout_char to read and write

Machine_uart: add support for inverted TX and RX lines

Rp2_pio: allow more than 8 consecutive pins for PIO out/set/sideset

Rp2_pio: fix sm.get (buf) to not wait after getting last item

Modmachine: allow changing CPU clock frequency

Modmachine: re-init UART for REPL on frequency change

Rp2_flash: prevent MICROPY_HW_FLASH_STORAGE_BASE being set negative

Enable uerrno module

Enabled more core Python features

Modmachine: enable machine.Signal class

Use core-provided cmake fragments instead of custom ones

Mpthreadport.h: cast core_state to _ mp_state_thread_t

Add support for USER_C_MODULES to CMake build system

Don't advertise remote wakeup for USB serial

CMakeLists.txt: enable USB enumeration fix

Import uarray instead of array in rp2 module

Rp2_pio: validate state machine frequency in constructor

Moduos: implement uos.urandom ()

Rp2_pio: add StateMachine restart,rx_fifo,tx_fifo helper functions

Machine_uart: add buffered transfer of data with rxbuf/txbuf kwargs

Add support for building different board configurations

Rp2_pio: add fifo_join support for PIO

Samd port:

Mphalport: fix USB CDC tx handling to work reliably

Stm32 port:

Uart: add uart_set_baudrate function

Mpbthciport: only init the uart once, then use uart_set_baudrate

Mboot: add unpack-dfu command to mboot_pack_dfu.py tool

Usb: allow a board to configure USBD_VID and all PIDs

Make pyb, uos, utime, machine and onewire modules configurable

Boards: disable onewire module on boards with small flash

Mpbthciport: fix initial baudrate to use provided value

Mpbthciport: use mp_printf instead of printf for error message

Mpbtstackport: allow chipset and secondary baudrate to be set

Mboot: after sig verify, only write firmware-head if latter valid

Uart: add support for LPUART1 on L0, L4, H7 and WB MCUs

Boards/NUCLEO_WB55: enable LPUART1 on PA2/PA3

Enable MICROPY_PY_UBINASCII_CRC32 to get ubinascii.crc32 ()

Rfcore: allow BLE settings to be changed by a board

Storage: prevent attempts to read/write invalid block addresses

Make-stmconst.py: allow "" chars when parsing source comments

Main: fix passing state.reset_mode to init_flash_fs

Powerctrl: save and restore EWUP state when configuring standby

Spi: fix baudrate calculation for H7 series

Boardctrl: add MICROPY_BOARD_STARTUP hook

Makefile: fix C++ linker flags when toolchain has spaces in path

Makefile: allow QSTR_DEFS,QSTR_GLOBAL_DEPENDENCIES to be extended

Include .ARM section in firmware for C++ exception handling

Powerctrl: allow a board to configure AHB and APB clock dividers

Powerctrl: support using PLLI2C on STM32F413 as USB clock source

Boards/pllvalues.py: relax PLLQ constraints on STM32F413 MCUs

Mpconfigport.h: add support for a board to specify root pointers

Boardctrl: give boards control over execution of boot.py,main.py

Boards/NUCLEO_L476RG: add 5 remaining UARTs

Rfcore: fix race condition with C2 accessing free buffer list

Rfcore: intercept addr-resolution HCI cmd to work around BLE bug

Boards: split UARTx_RTS_DE into UARTx_RTS/UARTx_DE in pin defs

Uart: use LL_USART_GetBaudRate to compute baudrate

Sdram: make MICROPY_HW_FMC_BA1,MICROPY_HW_FMC_A11 optional pins

Teensy port: no changes specific to this component/port

Unix port:

Mpbtstackport_common: implement mp_bluetooth_hci_active

Moduselect: don't allow both posix and non-posix configurations

Improve command line argument processing

Main: make static variable that's potentially clobbered by longjmp

Windows port: no changes specific to this component/port

Zephyr port:

Update to zephyr v2.5.0

Disable frozen source modules

Remove unused build files

Build MicroPython as a cmake target

Boards: add support for the nucleo_h743zi board

Modusocket: fix parameter in calls to net_context_get_XXX ()

On how to upgrade micropython to v1.15 to share here, I hope the above content can be of some help to you, can learn more knowledge. If you think the article is good, you can share it for more people to see.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report