MicroPython Demoed Running Bare Metal In Browser |
Written by Kay Ewbank |
Tuesday, 13 June 2017 |
The developers of MicroPython have developed the ability to run MicroPython "bare metal" in a web browser. MicroPython is an implementation of Python optimised to run on microcontrollers and in constrained environments. MicroPython combines Python 3 with a small subset of the Python standard library. Despite its limited size, you get features including an interactive prompt, closures, list comprehension, generators, and exception handling. It implements the entire Python syntax and core datatypes including: str, bytes, bytearray, tuple, list, dict, set, array.array, collections.namedtuple, classes and instances. Built-in modules include sys, time, and struct. It claims to compile 99.99% of the standard library. The language will fit and run in 256k of code space and 16k of RAM.
The language is most commonly available on the MicroPython pyboard. This is a compact electronic circuit board that runs MicroPython on the bare metal, giving you a low-level Python operating system that can be used to control all kinds of electronic projects. The browser-based "bare metal" MicroPython was put together using unicorn.js. This is an Emscripted version of unicorn, which is itself a stripped-down version of QEMU, the open source machine emulator and virtualizer.
The developers say they used unicorn.js to implement a Cortex-M3 based "virtual microcontroller" that runs in the browser. They then run a unicorn port of MicroPython on this virtual microcontroller. Writing about the project on the MicroPython blog, Damien George of George Robotics said: "Running this unicorn port of MicroPython will give you a good idea of what it's like running MicroPython on the bare metal of real hardware, and allows you to test stuff out quickly, and get to know (new) features of MicroPython." The blog post said that the current port is pretty minimal and doesn't have many features enabled, but plans for the future include different builds of unicorn MicroPython to show-case size versus features.
More InformationRelated ArticlesMicro Python - The Latest Python Commando Jump Game For The Micro:bit In Python
To be informed about new articles on I Programmer, sign up for our weekly newsletter, subscribe to the RSS feed and follow us on Twitter, Facebook or Linkedin.
Comments
or email your comment to: comments@i-programmer.info
|
Last Updated ( Tuesday, 13 June 2017 ) |