spin2cpp version 1.94 released
ersmith
Posts: 6,053
I've posted release 1.94 of spin2cpp, the Spin to C/C++ converter, to https://github.com/totalspectrum/spin2cpp/releases/tag/v1.94.
I had hoped to achieve 100% implementation of Spin with this release, but COGNEW/COGINIT of Spin methods is not finished yet (COGNEW/COGINIT of Pasm has worked for a long time, and is the most common use case). There were enough bug fixes and new features that I thought a release was warranted.
If you haven't used it, spin2cpp is a compiler for Spin. It can output C or C++, and it can optionally invoke PropGCC to produce binary output, so you can compile Spin to LMM or CMM code directly if you have both spin2cpp and PropGCC installed. Spin code compiled with spin2cpp ends up being substantially faster than "standard" Spin (2x - 20x faster, depending on options), at the cost of using more space (1.2x - 4x times bigger code, again depending on options).
At present spin2cpp is a command line only tool. At some point I'd like to integrate it into a GUI; it should be straightforward to use it in the same was as openspin in many cases (the command line parameters are a bit different, but it has very similar functionality). It complements openspin by providing a different size/speed tradeoff; if you need minimum code size use openspin, if you need faster Spin code use spin2cpp.
Some sample use cases:
[ Edited to note the --gas --ccode conflict ]
I had hoped to achieve 100% implementation of Spin with this release, but COGNEW/COGINIT of Spin methods is not finished yet (COGNEW/COGINIT of Pasm has worked for a long time, and is the most common use case). There were enough bug fixes and new features that I thought a release was warranted.
If you haven't used it, spin2cpp is a compiler for Spin. It can output C or C++, and it can optionally invoke PropGCC to produce binary output, so you can compile Spin to LMM or CMM code directly if you have both spin2cpp and PropGCC installed. Spin code compiled with spin2cpp ends up being substantially faster than "standard" Spin (2x - 20x faster, depending on options), at the cost of using more space (1.2x - 4x times bigger code, again depending on options).
At present spin2cpp is a command line only tool. At some point I'd like to integrate it into a GUI; it should be straightforward to use it in the same was as openspin in many cases (the command line parameters are a bit different, but it has very similar functionality). It complements openspin by providing a different size/speed tradeoff; if you need minimum code size use openspin, if you need faster Spin code use spin2cpp.
Some sample use cases:
spin2cpp test.spinproduces "test.cpp" and "test.h", C++ code and a header file. I've tried to make the output code "natural" with preserved comments and reasonable structure, but it is of course machine generated so there are some things that will look a bit strange.
spin2cpp --binary -Os -mcmm demo.spinwill produce "demo.binary", a ready to run executable.
spin2cpp --ccode demo2.spinwill produce "demo2.c" and "demo2.h". This is plain C code, for the most part (there are a few GCC extensions used for some Spin constructs, but in many cases the output could be compiled with Catalina or other compilers).
spin2cpp --gas demo3.spinThe --gas flag says to convert the PASM code into inline assembly instead of inline hex codes. This is still experimental, but makes for more readable code. Unfortunately there's a bug which causes this not to work together with --ccode. This will be fixed in the next version of spin2cpp.
[ Edited to note the --gas --ccode conflict ]
Comments
Note: I built spin2cpp v1.94 on Mac OS X 10.11.2 (El Capitan)
propeller-elf-gcc version info:
Oh... I am able to build Hello.cpp with propeller-elf-gcc, so it's something about the --ccode variant.
dgately
I've modified the spin2cpp source code to leave off the volatile, so if you're able to build it yourself you can pull the current git version and it should be fixed.
I guess I haven't been using --ccode and --gas together much lately. Thanks for the bug report!
Yes, spin2cpp v1.95 built and is working with this fix!
Thanks,
dgately
It's hip, it's happenin', it's where all kinds of fun stuff is happening!
https://github.com/parallaxinc
After that, we can get your project set up on the official Parallax developer site.
http://developer.parallax.com/
Who could say no to that?!?
Yea... it's a bit odd... but they appear to be attempting to turn the ParallaxInc org into a GitHub-driven Obex. At least, that's my personal impression. Parallax want community-driven projects to be stored in one place for everyone to find. That's how PropWare ended up there, even though it "is not in any way sponsored by or affiliated with Parallax."