Shop OBEX P1 Docs P2 Docs Learn Events
spin2cpp version 0.2 — Parallax Forums

spin2cpp version 0.2

ersmithersmith Posts: 6,099
edited 2012-01-10 10:26 in Propeller 1
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

Comments

  • ersmithersmith Posts: 6,099
    edited 2012-01-09 17:34
    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 HeinDave Hein Posts: 6,347
    edited 2012-01-09 19:43
    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
  • ersmithersmith Posts: 6,099
    edited 2012-01-10 10:26
    Dave Hein wrote: »
    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
Sign In or Register to comment.