Shop OBEX P1 Docs P2 Docs Learn Events
spin2cpp really works!!!, though I wonder.... — Parallax Forums

spin2cpp really works!!!, though I wonder....

Invent-O-DocInvent-O-Doc Posts: 768
edited 2013-09-24 12:44 in Propeller 1
After playing around with Propeller C and Simple IDE for a few weeks now, I've finally converted an obex object to C++.

The first object that I converted was the PWM32 driver (mix of assembly and SPIN). I use C++ anyway instead of C because I
like to have multiple class object instances and like addressing attributes of those objects. I did a couple of stock spin to C++ conversion
and things worked perfectly except for figuring out a bit of syntax and making the global variables into volatile ones.

Anyhow, I've got two questions about spin2cpp:

1) Should this be included as a feature in Simple IDE?
It seems to work pretty well, why not?

2) Can we make it so it defaults to adding the 'volatile' statement for globally declared variables (outside a function)???
I know that they have it so volatiles are added manually to make optimization more efficient, but having it to default to volatiles included would make more objects convert without human intervention.

Thoughts?

Comments

  • SRLMSRLM Posts: 5,045
    edited 2013-09-24 12:27
    2. You can add the {{++volatile}} annotation to your spin variables so that spin2cpp is aware of the additional keyword. As for making it the default I think the reasoning against that was performance (you lose the optimization that you might have).

    I agree: spin2cpp is a great tool. Just be aware that if you try to convert PWM32's PASM code to GAS you'll need to fix all the relative addressing.
  • Invent-O-DocInvent-O-Doc Posts: 768
    edited 2013-09-24 12:44
    I saw that you had a problem with that in a previous post. I don't really know PASM, so I left the --dat and --gas directives off and wound up with an incomprehensible dat block. But it works!!!!
Sign In or Register to comment.