spin2cpp version 0.2
ersmith
Posts: 6,099
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
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
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
Thanks for the feedback, Dave! Those two issues will be fixed in the next release.
Eric