MicroPython (GRPL-uPython) is a rewrite of the Python 3.4 programming language tailored for STM32 devices. It offers on-chip compiler, virtual machine and runtime to enable the rapid prototyping of applications. Extension modules provide direct access to the peripherals of the STM32 device. Custom components written in C or C++ can easily be integrated.
The pyboard reference development board is a small form-factor electronic circuit board based on a STM32F405 running MicroPython on the bare metal. The STM32 peripherals are exposed via a set of Python functions and classes.
Several STM32 Nucleo boards and STM32 Discovery kits are supported by MicroPython.
The high-level scripting language allows quick prototyping on MicroPython-based STM32 boards. RAM usage (especially the heap) is minimized. Migration from dynamic scripts is first enabled to pre-compiled bytecode and further to frozen bytecode where execution happens from flash. Computationally expensive application components can be migrated to C or C++ called from the Python code for performance optimization.
MicroPython is as compatible as possible with standard Python so that code and knowledge transfer from a desktop-based to an MCU-based embedded system is made easy.
MicroPython is supplied by a third party not affiliated to ST. For complete and latest information, refer to the third party website http://micropython.org/stm32/.
- Python compiler and virtual machine run on the STM32 device
- Interactive access to all language features over serial interface
- Fully open-source code under the MIT License available on GitHub
- Subset of Python 3.4 data types, functions, classes and modules:
- Numbers: Arbitrary precision integers, floating point and complex numbers
- Classes and instances: bytes, bytearray, tuple, list, dict, set, frozenset, array.array, collection, named tuple
- str datatype with basic unicode support (utf-8 encoding)
- closures, generators and full exception handling
- Built-in modules such as sys, time, struct, os
- Extra modules such as random, re, json, zlib, binascii, hashlib
- Support for cooperative multitasking via coroutines and Python 3.5 async keyword
- Multithreading for selected ports via the _thread module
- File system support (FAT) with custom block devices and transparent access from scripts
- Hardware-specific modules for access from scripts to STM32 peripherals such as GPIO, I2C, SPI, UART, ADC, DAC and timers
- Easy-to-build add-on modules in C or C++ with Python calling C/C++ and vice versa
- MicroPython for STM32 devices:
- based on STM32 Cube HAL
- small memory footprint: 256 kbyte Flash and 32 kbyte SRAM
- SD card support with file system access from within MicroPython
- USB support: CDC/VCP, MSC, HID
MadeForSTM32™ is a new quality label delivered by ST, which is granted after an evaluation process. It helps engineers identify third party solutions with the highest level of integration and quality for the STM32 microcontrollers' ecosystem. MadeForSTM32™ is offered to members of the ST Partner Program who want to go one step further in our collaboration, with the overall objective of contributing to a high-quality STM32 ecosystem.
In this video we discussed with just a few of the partners who have solutions already working on the STM32MP1.
The STM32Cube.AI is an extension pack of the widely used STM32CubeMX configuration and code generation tool enabling AI on STM32 Arm® Cortex®-M-based microcontrollers.