C Compiler for the Propeller .. is there one out there ??
Hi All
A common question we get from our customer base here in Australia.
Is there a C Compiler for the Propeller ?
Is somebody working on one ?
I have not seen any posts re this issue..
Ronald Nollet
Australia
·
A common question we get from our customer base here in Australia.
Is there a C Compiler for the Propeller ?
Is somebody working on one ?
I have not seen any posts re this issue..
Ronald Nollet
Australia
·
Comments
Fortunately(?) I've been too busy with consulting to work much with the propeller; I sneak a few hours in here and there... but until the consulting gig I've got right now in addition to my regular job is done, my time is very limited. I'm in the "building the tools to build the tools to build the software" stage right now. Once·my infrastructure·hits "critical mass" watch out!
A C compiler would have the following difficulties targeting a Cog:
- no return stack
- Cog memory is not byte addressable
- no indexed addressing
- VERY limited ammount of memory in a Cog
My large model fixes all of those issues, and given sufficient time, I'd love to port a C compiler to it - however there are a number of intervening steps:
- Chip kindly modified the IDE to add 'ORGX' to help with writing large model assembly code; and while it helped, it only whetted my appetite
- I've started writing a 'large model' macro assembler, I'd say its about 80% complete; it can actually assemble all the Cog instructions now, I do have to verify the bit patterns [noparse]:)[/noparse] add the macro capability, write a linker etc
- the assembler will support three models: small (standard Cog code - needed to support video drivers etc),·my large model, and·the large model with multi-threading·in each cog - which places further restrictions on the code.
Ofcourse, as I was writing this it became obvious that I'd need to write some system libraries; I've already designed the memory manager, and it· accomodates up to 256k of HUB memory (for future propellers)
Then I realized that for best effect, Spin should not manage the memory allocation... so the initial eeprom image is a basically a null Spin program that loads (high) the system library and turns over control to a large model multi-threaded "supervisor" cog that will provide a VERY minimal set of system services: malloc/free, spawn, kill,·two I/O handles per process (stdin, stdout) and a shared stderr (all threads share ONE stderr to save memory), putchar, getchar and ioctl, and a·VERY simple messaging api (send & recv)·(you may note a certain Unix flavour in this paragraph... I may even support fork() to spawn threads within a cog)
Also, like several others, I've been looking into making a memory expander... with a very slight additional performance hit I can make a large model kernel that would support position independent code... and even swapping; and given the number of pins involved, that led me to look into I/O expanders - thus I've been gearing up on SX's.
Basically I opened up Pandora's Box when I came up with the large model.
To top it off, I REALLY want to figure out how to run Spin processes under this scheme!
Now as Mike mentions, it would be quite feasible to target a C compiler to generate Spin byte codes; frankly I'd love to see such a compiler!
Mike's OS with fetmobasic is already a cool incredibly cheap computer for introducing people to programming; with its SD support if it had a C compiler that generated spin code... the possibilities!!!
It should also be quite possible to target Cliff's Forth engine with a C compiler.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
www.mikronauts.com - a new blog about microcontrollers
Post Edited (Bill Henning) : 2/4/2007 8:10:12 AM GMT
IMHO it might be smart to make C-to-Spin source level translator first.. It should work with decent speed (not much slower than similar code in spin) and be a lot easier to debug and test than these other alternatives.. After that, it migh be feasible to bypass spin compiler and write directly to Spin.bytecode.
IBM and Intel have them, use Pragmas for Multiprocessing
GCC has something http://www.intrepid.com/upc.html
Not about to get a full C compler for the Prop?
But again each cog is a simple 32 bit risc micro so maybe it would be easy to do?
Well easy for Compiler experts[noparse]:)[/noparse]
Guess I should sit down and spend some real time on GCC.
Just downloaded it and had a quick look, guess I need to look at Prop assembly to see which micro it is closest too.
Anyone got any links on how to port GCC?
Gavin
I'm also waiting for a C compiler for the Propeller. Or at least some enhancement for the SPIN language.
Some enhancement as (by order preferences) :
- macro (so easy to implementing)
- type definition
- bit type
- pre-processor
- multi-dimensional array
- structure
- record
- ...
And also a more 'standard' syntaxe as for example: '>=' at the place of '=>'
For the rest, SPIN is a very good language easy to learn and with a lot of quality !!!
Best regards,
dro
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
in medio virtus
Post Edited (inservi) : 2/4/2007 10:45:07 AM GMT
I was the first guy to write a linux pbasic compiler/downloader for linux on 03/2003 using the parallax library, soon after it was released.
www.sourceforge.net/projects/linstamp/
My advice is that when you want something that does not exist, challenge yourself to make it like I did. Later other people made better linux apps, but mine worked for me.
The cool thing about Sourceforge is that you can create a project that other developers can work together. You can administer it, break the project into managable portions, and soon it will be complete.
I will be happy to be assigned some of the work if someone wants to start the project. I have 10 years of C experience and C could be used to make a nice C to prop spin/assembler.
www.sourceforge.net/projects/propc
Its awaiting approval from sourceforge staff... should take a few days to a few weeks. then Ill create the CVS repository for it. Meanwhile I'll administer the project and email me your spippets, design idea's or anything you want to be made public for this GNU project.
Post Edited (bassmaster) : 2/4/2007 2:45:04 PM GMT
http://forums.parallax.com/showthread.php?p=629928
Post Edited (bassmaster) : 2/4/2007 3:37:14 PM GMT
What if the IDE used plug-ins, this could allow all kinds of useful tools.