Pong Running in RPython Interpreter on MIPS32


I was working on pyllisp and got my interpreter work well enough to run a pong cross-compiled. It runs on GCW-Zero.

The game's two-player's pong, supposed to be played head-to-head. It speeds up after each successful deflect and restarts when either player scores 8. People who have the console may be interested to download the game here: pong.opk.

GCW-Zero toolchain was straightforward to use. RPython compiles, then evaluates gcc code though. Fortunately the programs it compiles run fine in qemu-user -emulator. I wrote a platform script and passed in the toolchain's gcc with --cc -attribute.

RPython relies on host and target machine's address width to match. I had to download 32-bit pypy to cross-compile to MIPS32. There was no greenlet support for this platform so I had to comment out that out from my code. After these changes it did compile:

~/pypy-2.4.0-linux/bin/pypy ~/pypy/rpython/bin/rpython --platform=mipsel --cc=/opt/gcw0-toolchain/usr/bin/mipsel-gcw0-linux-uclibc-gcc pyllisp.py

The pong could be bit better. I tried it with my brother, who dared to play a round with me. Proving that it works, now I've got two platforms where my interpreter runs instead of just one!

The qemu patch might be helpful for others, but it's not fine enough to push back into pypy. I'll spend some time improving it.

Hmm.. I've got few raspberry PIs sitting around in here...

Similar posts