Python for embedded systems (was Re: What does Python do)

Ralf Schlatterbeck schlatterbeck at tttech.com
Mon Feb 5 07:28:33 EST 2001


Peter Hansen <peter at engcorp.com> writes:
> We have Python running on a 1MB Flash/1MB RAM PC/104 module.
> With the compiler.  Quite cool.  I know from posts here that
> at least one other company has achieved something similar.  
> I'm still pleased to find how well many of Python's advantages
> translate through into the embedded world.  This is, of course,
> an extremely long way from a 16-bit chip with a 64K address
> space, but for that there's always FORTH. :-)

I replied to Peter by email and asked him:
> How did you do it? Will you make this publicly available?

He asked me to make his answer available in this group, here it is:

Peter Hansen <peter at engcorp.com> writes:

Perhaps you would be good enough to post my reply to the forum for me,
as the  system on which I'm typing this has no Usenet access.  Thanks.

Making Python run on a PC104 system with 1MB-flash was not at
all difficult.  Among the few things we had to do was to strip
out a large number of "unnecessary" (to us) modules, including
floating point, files, long integers, all platform-specific   
stuff, and Unicode.  We had to provide a customized thread.h  
for our third-party real-time kernel.  Maybe the only thing   
that was at all difficult to figure out was how to modify     
marshal.c to avoid allocating a buffer in RAM and copying     
the code object there when a module is imported (since we     
are running code directly from flash, unlike many PC104       
systems where the flash is only used as a file system and     
all code is loaded into RAM before executing).  The final     
item to produce a useful environment was to provide a
serial port implementation of sys.stdout and sys.stdin
for the interactive interpreter.  It is very gratifying
to see the ">>> " prompt show up in Hyperterminal on a 
PC after all the hard work. :)

Our intention was to make this publicly available, but it
is not yet in any shape to do so.  Furthermore, because of
a change in strategy with our product, we are likely to   
upgrade to a more powerful processor board which will     
require migrating to a more typical configuration with    
flash file system and code running from RAM.  Rather      
than release the coarse results of our work so far,       
I would be happy to respond to individuals with
non-frivolous requests for specific assistance,
by helping point out the areas where we've made changes
and providing 'patches' or portions of our work
rather than the whole thing.  (Packaging up an 
entire work product for release, even as a free
'no warranty' type of thing, takes a lot of doing
from a corporate point of view, and I'm sorry to have
to say I can't spare the time do that right now.)

(Once we have our final configuration polished up and
at least our first product based on it released, I   
definitely intend to educate my upper management     
about why supporting the open-source community by    
contributing back to it is a Good Thing.  It really  
shouldn't be a hard sell, but it has to be done
in just the right way, as you may know. :-)

-- 
Dr. Ralf Schlatterbeck                  mailto:schlatterbeck at tttech.com
TTTech Computertechnik AG, Schönbrunnerstraße 7, A-1040 Vienna, Austria
Voice: +43/1/5853434-0,  Fax: +43/1/5853434-90,  http://www.tttech.com/



More information about the Python-list mailing list