Help with propeller C and Spin
tdahbura
Posts: 6
Is there a way to compile a c program to a library and then call it from SPIN?
I am using the ICCV 7.04 tool, but am not sure how to compile a routine and then include it as part of my spin code to be called...
Any help would be appreciated on the steps or docs to do this...
Thanks,
Tony
I am using the ICCV 7.04 tool, but am not sure how to compile a routine and then include it as part of my spin code to be called...
Any help would be appreciated on the steps or docs to do this...
Thanks,
Tony
Comments
No, sorry. You have to choose either spin or C.
But what you can do from either is to load up cogs and interface with them in the same way. We have been taking a number of obex objects and splitting them into separate spin and pasm components. Then translating the spin part into C. So these 'cogjects' can be loaded from arrays on an sd card, and hence don't take up hub ram after they have been loaded. There are display, mouse, keyboard drivers using this method.
But I think there might be one cunning thing you can do in Catalina, and that is to treat the spin interpreter as a 'cogject', load it up, run it and then use it to run spin programs. Reload the cog with other code once it has finished. I have not done this but it could be possible.
What is the program you need to write?
Hi Tony,
Dr_A is correct - there are several ways you can execute a Spin method in parallel with a C program - but making C callable from Spin (or vice-versa) is not currently possible (at least not without so much messing about that it is not really worth the effort).
Ross.
If you are developing on a Windows platform you could try CSPIN http://forums.parallax.com/showthread.php?119342-CSPIN-A-C-to-Spin-Converter&highlight=cspin . It will convert from C to Spin so you can interface to the objects in the OBEX. It does have some restrictions, which are documented in the README file. I've attached the latest version to this post.
Dave
Tony
I am going to try your cspin out. Never fear I am not afraid of the command line!
I would second other comments though to focus on the tool and not worry about the GUI right now. BTW I am a mac user with a vmware window running to running some of these gui based tools to talk with my propeller.
Tony
I hope cspin works OK for you. Let me know if you run into any problems, and I'd be happy to take a look at it.
Dave