PDA

View Full Version : spin2cpp version 0.2



ersmith
01-09-2012, 05:02 AM
Here's an updated version of the spin to C++ translator. This one now understands the OBJ section of .spin files, so it's able to compile real programs. It also has some work-arounds to the FullDuplexSerial issues that I mentioned in the message about the first version of spin2cpp. It's able to compile the unmodified FullDuplexSerial.spin and produce something that works. However, optimization at levels -O2 and above can sometimes produce incorrect results with FullDuplexSerial (I think the work-around for missing volatile is still incomplete).

There's a command line option (-main) to force the output to contain a simple main() that calls the first object method.

In the Demos directory are two samples, Hello.spin and Fibo.spin. Both are complete programs, and can be compiled either by the normal spin compiler (to interpreted spin) or by spin2cpp + gcc (to LMM PASM); Demos/Makefile shows how to do this.

Edited Jan 9: a new version 0.3 is available, see the next message.

Eric

ersmith
01-10-2012, 12:34 AM
I'm not sure if anyone is using this, but here is version 0.3 of spin2cpp. This version fixes several bugs in the pasm assembly, and adds a few more Spin features. It can now produce correct output for the C3 c3_vga_demo_010.spin file (and the VGA objects the latter requires). I think it's actually somewhat useful now, although obviously there is still more work to do on it!

Eric

Dave Hein
01-10-2012, 02:43 AM
Eric,

I played around with it a bit, and it's looking good. A couple of problems that I encountered is that it doesn't handle empty methods and it assumes that the .spin extension is included in the object name. Of course, Spin requires specifying only the root of the object file name.

Dave

ersmith
01-10-2012, 05:26 PM
I played around with it a bit, and it's looking good. A couple of problems that I encountered is that it doesn't handle empty methods and it assumes that the .spin extension is included in the object name. Of course, Spin requires specifying only the root of the object file name.


Thanks for the feedback, Dave! Those two issues will be fixed in the next release.

Eric