[python-uk] PYCON UK Python-on-a-chip
G Bulmer UK
gbulmeruk at yahoo.co.uk
Mon Oct 3 17:09:29 CEST 2011
Good news for folks who were interested in Python on Microcontrollers
at PYCON UK (and anywhere else :-)
The "best" implementation that I have found so far is "Python-on-a-
A project lead by Dean Hall. (If you know of something better, please,
please tell me)
1. It already works
2. P14p is runs in about 55 KB+ program memory (flash) and 8KB RAM (to
be useful), so just about fits on an Arduino Mega, and definitely fits
in slightly bigger MCUs.
It does have some missing features:
My Python is so poor, that I feel uncomfortable. I have no problem
with 'exec' being missed out :-)
I do feel uncomfortable (in theory) about 'try', 'except' and
'finally' being missing, but they do feel like pretty sophisticated
concepts to use on a microcontroller. I first saw exceptions in Green,
which became the Ada programming language, a language explicitly
designed for embedded programming. I saw them again in C++, then Java
(I've tried to teach all of them at undergraduate and post grad). IMHO
it requires programming maturity to use them well, but I am always
unhappy to use "cut-down" implementations in order to teach something.
If anyone can find the time, I'd be grateful if folks would tell me if
they think I am "barking up the wrong tree" (or simply "barking":-) by
focusing on P14p.
In the absence of guidance, I will try to keep chipping away:-)
Anyway, while PYCON UK was happening (down the pub:-), 'Dave' of
LeafLabs published this small, but encouraging blog:
He has got interactive PyMite (part of Python-on-a-chip) working on an
STM32F103 (ST Micro Cortex-M3 ARM) "Maple" !
I base my boards on the LeafLabs work, so this is excellent news. I
missed this blog until Monday, so I apologise if anyone at PYCON UK
feels I was asking questions unnecessarily.
I currently use Arduinos C/C++ and the Arduino libraries for my
workshops, but I am trying to move to the much more powerful ARM
microcontroller; there are some projects which people ask about which
are much more practical on faster, 32-bit MCUs with better peripherals.
LeafLabs IDE is a fork of Processing (the base for the Arduino-IDE)
and uses the same gcc C/C++ toolchain, but with LeafLabs libraries, so
it isn't a big leap from Arduino.
As folks who have done Microcontroller development will tell you,
debugging C/C++ code on a microcontroller without hardware debug
support can get quite hard. I don't use hardware debug with kids for a
bunch of reasons (I'm happy to explain if anyone asks).
So, being able to debug a live program, by printing variables, or
running fragments of code, in the same programming language as the
program is a significant step forward :-)
I think that might be teachable. Actually, I think it might offer a
completely different way to learn.
Please don't assume I think this is "the way" to get Python into the
hands of learners. I think people learn for many reasons, with many
goals. This *broadens* the reach of Python (to include me and smaller
MCUs:-). Of course, I still need to understand it!
PS - Bog thank you to people for encouraging my microcontroller
efforts in education (children and adults) at PYCON UK
More information about the python-uk