Tuesday, 9 January 2007

Stackless Python 2.5 for the Nintendo DS

I have recently been corresponding about NDS Python with several people on a range of topics and a common problem each had was that they were unable to work out how it should be compiled. Since there were some gray sunless summer days, I decided to flesh out and correct the instructions I originally wrote. A day later and the end result is that this lead to me updating the existing port to the latest version of Stackless Python.

Porting Python to another platform given the presence of C runtime libraries is actually pretty straightforward. Most of the work I did in the original port of Python 2.4.3 was on two different aspects, getting the Stackless hard switching to compile properly with arm-elf-gcc and hooking up the hobbyist file system support for homebrew devices to the C runtime so that Python could access it. And similarly with the Stackless switching already working, the work in porting Python 2.5 was updating the code which hooked the file system support to the C runtime for the changes in the development environment devkitPro.

As a standalone Nintendo DS application it is still as useless as the last port due to lack of support for the DS hardware. I go into that in detail on the web page I link to for it above. But given an application which provides Python bindings for custom access to that hardware it might however be usable as an embedded scripting language.


  1. I thought I'd commented on this yesterday, but I'll try again..

    What are the odds, do you think, of being able to port stackless to the new iPhone device from Apple? It claims to run OS X, but the platform is still unknown (at least that I can find). I can think of some really neat applications and interfaces to current applications using the multi-touch LCD.

  2. There are two parts to porting Stackless to a new platform. The first is that the platform must have a environment which Python itself can be cross-compiled to (this means some method of input, standard output, a C runtime library and more). The second is that there needs to be a little bit of asembler written to do the hard switching (where a tasklet is shifted off the stack and another is shifted onto it).

    Without knowledge of the programming environment or the platform, it is impossible to say how feasible it would be to port Stackless.