Parallax Propeller Java
Posted: January 31, 2016
I had one of these Parallax P8X32A Propeller QuickStart boards laying around (got it at RadioShack for $8 while they were failing) and thought it might be cool to make a way to program it with Java. I started by adding Propeller support to naken_asm. Actually, that might have been totally pointless since Parallax has their own assembler than can be embedded in .spin code, but it was a really easy platform to support, so it's not like it took much time. On the plus side, the disassembler (and .lst file support on the assembler) provide cycle counts for all the instructions, which could be quite useful. I then added support to Java Grinder.
I have just enough code to blink LED's and do other interesting things, but it's definitely not complete. I have a vision of how this could actually be a really neat programming platform. Something like adding support so every Java method runs on its own cog and having main() just tell which cogs to start, but I'm not sure how much more I'll work on this. This was more of just a Saturday project.
Update (July 7, 2017): I added more code to Java Grinder and got it generating Mandelbrots. It's actually pretty quick. I added the video below but for a full explanation visit: mandelbrots_simd.php.
Related Projects @mikekohn.net
Full video: https://youtu.be/QEONRKvCaoc
After compiling the Java code and running it through Java Grinder, the code needs to be turned into a DAT section of a .spin file. I wrote a program called bin2spin.go to do this. In the future, I could just spit out .spin code, but for now this works. The Makefile in samples/propeller shows how to use Parallax's tools to compile spin and upload to a board.
The current Java API for this chip looks like this: Propeller.java. One of these days I'll get around to making JavaDocs for this project.
This chip has been pretty interesting since it doesn't have a stack or registers. Registers are kind of "emulated" by using 32 bits of memory inside the cog (1 memory address). I had to make some decisions on things like static variables and local variables. I ended up putting the static variables inside of the cog. When I did the original blinking LED program, I hadn't implemented local variables and was planning to put them in shared memory. While doing the Mandelbrot demo, I implemented the local variables in the COG itself. I could possibly move these to shared memory at a later time.
Copyright 1997-2021 - Michael Kohn