PyMite: Python-on-a-chip

in Arduino, Chips, code, hacks, PIC by the machinegeek | 5 comments

Python-on-a-Chip (p14p) is a project to develop a reduced Python virtual machine (codenamed PyMite) that runs a significant subset of the Python language on microcontrollers without an OS. The other parts of p14p are the device drivers, high-level libraries and other tools. They’ve released ports for the Microchip PIC/24dcPIC, Teensy 2.0, Arduino Mega and others. Here is their PyCon 2011 Lightning Talk slide presentation.

Some features of PyMite include a memory requirement of roughly 55 KB program memory, supports integers, floats, tuples, lists, dicts, functions, modules, classes, generators, decorators and closures, supports 25 of 29 keywords and 89 of 112 bytecodes from Python 2.6 and is licensed under the GNU GPL ver. 2. However, it lacks a built-in compiler, and does not include any of Python’s libraries. If you know C, Python and how to work with microcontrollers, it might be worth checking out.

This entry was posted in Arduino, Chips, code, hacks, PIC and tagged .

Comments

  1. J. Peterson says:

    …does not include any of Python’s libraries

    Um, that’s kind of like a car without seats, brakes and a steering wheel.

  2. Ed Marshall says:

    Lack of libraries doesn’t seem like that big of a deal to me; most of them wouldn’t make sense in a micro environment anyway:

    – Anything that touches the filesystem, network, OS, processes, threads, etc
    – Anything linked against external libraries like SQLite, curses, etc
    – Anything dealing with Python internals

    That’s almost the entire standard library (http://docs.python.org/library/). Most of the modules left after trimming all of that probably aren’t slim enough to work as-is in a tiny environment like this.

    The system requirements are interesting; it’s an exceptionally tight fit on a few of the platforms they’ve implemented. Really cool stuff; I’d love to see what they could come up with if they put their heads together with the PyPy guys. :)

  3. 7 says:

    This is a very good news!

    even without libraries, this is still a very good start.

    I hope python will fully make its way to microcontroller development arena on different microcontrollers, just like C… [maybe in the years to come….]

  4. chuck says:

    according to their new video,
    http://pycon.blip.tv/file/4884752/ (begins at 3:45 in the video)

    the ram requirements (vm initialization) is only 2k? Am I understanding that correctly?

    Also anyone know how a normal python script will control the hardware of a microcontroller?

  5. Alan H says:

    It makes sense if your micro controller has some form of host controlled storage like a USB OTG/Host controller with a stick plugged in or SD card. You could then offer a microcontroller specific Python library and use python as a soft glue for functionality. eg. Write a Python script, plug it into the MCU, and watch it run!

Leave a Comment

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Notify me of followup comments via e-mail. You can also subscribe without commenting.