MicroPython

MicroPython is a software implementation of a programming language largely compatible with Python 3, written in C, that is optimized to run on a microcontroller.[3][4]

MicroPython
Developer(s)Damien P. George
Initial release3 May 2014 (2014-05-03)
Stable release
1.18[1]  / 16 January 2022 (16 January 2022)
Repository
Written inC
PlatformARM Cortex-M, STM32, ESP8266, ESP32, 16bit PIC, Unix, Microsoft Windows, Zephyr, JavaScript, RP2040
LicenseMIT license[2]
Websitemicropython.org

MicroPython consists of a Python compiler to bytecode and a runtime interpreter of that bytecode. The user is presented with an interactive prompt (the REPL) to execute supported commands immediately. Included are a selection of core Python libraries; MicroPython includes modules which give the programmer access to low-level hardware.[5]

The source code for the project is available on GitHub under the MIT License.[6]

History

MicroPython was originally created by the Australian programmer and theoretical physicist Damien George, after a successful Kickstarter backed campaign in 2013.[7] While the original Kickstarter campaign released MicroPython with an STM32F4-powered development board "pyboard", MicroPython supports a number of ARM based architectures.[8] The ports supported in the mainline are ARM Cortex-M (many STM32 boards, TI CC3200/WiPy, Teensy boards, Nordic nRF series, SAMD21 and SAMD51), ESP8266, ESP32, 16bit PIC, Unix, Windows, Zephyr, and JavaScript.[9] Also, there are many forks for a variety of systems and hardware platforms not supported in the mainline.[10]

In 2016, a version of MicroPython for the BBC Micro Bit was created as part of the Python Software Foundation's contribution to the Micro Bit partnership with the BBC.[11]

In July 2017, MicroPython was forked to create CircuitPython, a version of MicroPython with emphasis on education and ease of use. MicroPython and CircuitPython support somewhat different sets of hardware (e.g. CircuitPython supports Atmel SAM D21 and D51 boards, but dropped support for ESP8266). As of version 4.0, CircuitPython is based on MicroPython version 1.9.4.[12]

In 2017, Microsemi made a MicroPython port for RISC-V (RV32 and RV64) architecture.[13]

In April 2019, a version of MicroPython for the Lego Mindstorms EV3 was created.[14]

In January 2021, a MicroPython port for the RP2040 (ARM Cortex-M0+, on Raspberry Pi Pico and others) was created.[15]

Libraries

The libraries in MicroPython are similar to those in Python. Some standard Python libraries have an equivalent library in MicroPython which have been renamed to distinguish between the two. The MicroPython libraries are typically smaller with features that are not widely used removed or features modified in order to save memory. There are also specific libraries that have been created to assist with hardware functionality which are not available in Python libraries.[16]

There are three types of libraries in MicroPython:

  • derived from a standard Python library (built-in libraries)
  • specific MicroPython libraries
  • specific libraries to assist with hardware

MicroPython also allows programmers to create custom libraries

Bytecode

MicroPython includes a cross compiler which generates MicroPython bytecode (file extension .mpy). The Python code can be compiled into the bytecode either directly on a microcontroller or it can be precompiled elsewhere.

MicroPython firmware can be built without the compiler, leaving only the virtual machine which can run the precompiled mpy programs.

References

  1. "Release 1.18". 16 January 2022. Retrieved 27 February 2022.
  2. George, Damien P. (4 May 2014). "micropython/LICENSE at master · micropython/micropython". GitHub. Retrieved 11 February 2017.
  3. Venkataramanan, Madhumita (6 December 2013). "Micro Python: more powerful than Arduino, simpler than the Raspberry Pi". Wired. Retrieved 15 December 2016.
  4. Yegulalp, Serdar (5 July 2014). "Micro Python's tiny circuits: Python variant targets microcontrollers". InfoWorld. Retrieved 15 December 2016.
  5. "MicroPython - Python for microcontrollers". micropython.org. Retrieved 12 August 2017.
  6. "MicroPython on GitHub". GitHub. 7 February 2022.
  7. "Micro Python: Python for microcontrollers". Kickstarter. Kickstarter. Retrieved 15 December 2016.
  8. Beningo, Jacob (11 July 2016). "Prototype to production: MicroPython under the hood". EDN Network. Retrieved 15 December 2016.
  9. George, Damien P. "micropython/ports at master · micropython/micropython". GitHub. Retrieved 22 October 2019.
  10. Sokolovsky, Paul. "Awesome MicroPython". GitHub. Retrieved 22 October 2019.
  11. Williams, Alun (7 July 2015). "Hands on with the BBC Micro-Bit user interface". ElectronicsWeekly.com. Retrieved 8 July 2015.
  12. Shawcroft, Scott (22 May 2019). "CircuitPython 4.0.1 released!". Adafruit Blog. Adafruit Industries. Retrieved 11 June 2019.
  13. "RISC-V Poster Preview — 7th RISC-V Workshop" (PDF). 28 November 2017. Retrieved 17 December 2018.
  14. "LEGO releases MicroPython for EV3 based on ev3dev and Pybricks". www.ev3dev.org. Retrieved 21 April 2020.
  15. "Meet Raspberry Silicon: Raspberry Pi Pico now on sale at $4". www.raspberrypi.org. 21 January 2021. Retrieved 21 January 2021.
  16. Bell, Charles (2017). MicroPython for the Internet of Things. Berkeley, USA: Apress.
This article is issued from Wikipedia. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.