Starting to feel alone with my spin compiler.
Oldbitcollector (Jeff)
Posts: 8,091
With all this recent activity with two C compilers for the Propeller,
I'm starting to feel like I'm one of the last guys still holding onto his Spin compiler.
I'm curious (and perhaps this could only be answered officially) if there
will be a push toward C over Spin in the future of the Propeller products
to align it more with industry standards.
Should I be purchasing C books now?
OBC
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
New to the Propeller?
Visit the: The Propeller Pages @ Warranty Void.
I'm starting to feel like I'm one of the last guys still holding onto his Spin compiler.
I'm curious (and perhaps this could only be answered officially) if there
will be a push toward C over Spin in the future of the Propeller products
to align it more with industry standards.
Should I be purchasing C books now?
OBC
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
New to the Propeller?
Visit the: The Propeller Pages @ Warranty Void.
Comments
You have nothing to fear [noparse]:)[/noparse] C can't really compete with SPIN until someone comes up with a C that produces code as compact as that produced by SPIN. Even then SPIN is the officially supported language for Propeller. Your "push question" is obviously for Parallax.
Knowing C will allow you to look at other opportunities in programming including writing Linux or Windows applications. Why not learn it on your favorite processor? There are many C educational resources and tutorials available free on the web.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
--Steve
Propalyzer: Propeller PC Logic Analyzer
http://forums.parallax.com/showthread.php?p=788230
Spin was designed for the Prop. It's not going away. And assembly is still the best choice for performance-driven apps.
-Phil
A modified Spin bytecode interpreter, optimized for C could certainly be done and would solve many of the shortcomings of the existing C compiler (and their LMM interpreters), mostly that of memory hungry programs in a small memory microcontroller. A mixture of bytecodes / LMM / native code would be ideal. You need a good optimizer for LMM and native code to be practical and only ImageCraft's compiler has that at present.
What I'm implying is that C will continue to be a secondary programming language for the Propeller, but that Spin with a little bit of assembly will continue to be the primary language.
I do think you should buy an introductory C book and start experimenting with it. There will always be applications where Spin is just too slow and it's too much trouble to write something complicated in assembly while C and LMM is just perfect for your needs.
I don't see any need for SPIN to take a back seat. The Propeller and PASM and SPIN are in perfect harmony. SPIN is an excellent language for those new to programming or just new to programming micro-controllers. I certainly prefer it to BASIC. It is compact. It's a tad slow but that is balanced by the fact that PASM is also easy to learn/use (compared to many other assemblers) when needed.
We have 8 COGs at a time to play with. A different language on each one I say[noparse]:)[/noparse]
Trick is to get all these different languages to talk to each other easily.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
For me, the past is not over yet.
I've been programming in C practically forever (I think I started in '79 or '80), and one of the driving forces behind coming up with lmm was to see about a possible C port.
However something strange has happened... I got used to Spin, and like it for quick prototyping.
Mind you, I think Spin has some flaws that should be addressed:
- string handling is horrible, I hate string(). Since "a" is used for char constants, a future rev of spin should use 'this is a string return its address' instead of string()
- since floating point constants are implemented, I'd like to see a 'float' data type and at least + - * / remainder == <> < > => =< support
- some way of having shared libraries, too much space is wasted if a library object is pulled in by several objects
- two/three dimensional arrays (bsc addresses this)
Future extension:
- data structures
- built-in debugger (ViewPort is good for this)
Regardless of my griping, I like Spin, and I am sure it will be around for as long as the Propeller is. I think it may even be easier for beginners than C.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
www.mikronauts.com - a new blog about microcontrollers
Playing devil's advocate to the C bandwagon now: I've been programming for forty years. I've never learned C, don't need it, and would never use it. The reason is simple: for any given processor, there's always a better option that's either more attuned to it, as a high-level language, closer to the metal, as an assembler, or provides higher-level services under the hood, such garbage collection, as do Perl and Python for the PC. C is attempt to have your cake (i.e. portability) and eat it, too (performance). At best, it's a poor compromise that I wouldn't waste my time with.
-Phil
Comparing C to spin, spin if much better but lacking in a few things. If spin were made into a multi platform language with a portable interpreter I would use it always over C.
On of the best things about spin is that it allows you complete control in a more fundamental way than C. I also just love the way the code is structured.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Nyamekye,
What language should we suggest he should have used?
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
For me, the past is not over yet.
Languages are tools. Everyone has preferences. C has big short commings but can make many things possible too for many people. It's kind of like choosing between barter and money. If I make caskets and need bread, I may end up "using" one of my caskets before I find someone willing to trade for equivalent value of bread. C or other common languages enable a better use of resources for customers. If you don't need something that's fine too [noparse]:)[/noparse]
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
--Steve
Propalyzer: Propeller PC Logic Analyzer
http://forums.parallax.com/showthread.php?p=788230
Post Edited (jazzed) : 3/31/2009 8:13:46 PM GMT
I can't compare spin to C, but I find spin a nice transition from higher level languages; it retains some of the most useful oop stuff without a lot of conceptual overhead. And it feels fluid entering in and out of pasm.
I'm not familiar with other assembly languages, but is it as easy to mix high & low level languages like in the prop? I really like how I can run a fast pasm routine in one cog, and a SPIN control structure in another.
Another random thought - does anyone use the SPIN video commands? Maybe it's just me, but it seems that video's always done in pasm, anyway.
@jazzed - exactly; common languages means the developer doesn't have to spend 6 months ramping up. Maybe the SPIN divide is among hobbyists, who just enjoy learning, and developers who need to ship.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Gadget Gangster - Share your Electronic Projects - Sign up as a Designer and get a free 4-pack of Project Boards!
Post Edited (Nick McClick) : 3/31/2009 8:22:53 PM GMT
The Propeller is an unusual processor in that it has a small CPU (Cog) but lage shared memory, so it is ideally suited to small PASM/compiled programs or large interpreted programs, LMM being the halfway house; quite fast, larger programs. Spin suits that model very well, C not so well at present.
That's no reason not to pick up a book on C or having a go with the ImageCraft demo or Catalina.
One area where C would arguably be better for the Propeller over Spin is where execution from external memory is involved, and as the memory size of the Propeller grows it will fit better anyway. That said, LMM from external memory is possible and little reason that Spin could not be extended to use external memory either; it only requires the tools and someone to tweak the interpreter.
The best argument for C is that it is a convenient tool for generating LMM with.
I personally cannot see Parallax pushing C over Spin, and not on the grounds of pursuing industry standards - If they thought that way we'd likely never had the Propeller as it is, it would have been tailored towards C generated object code from the start. What I expect is more likely to happen is that the shortcomings of Spin are addressed.
Post Edited (hippy) : 3/31/2009 8:24:40 PM GMT
However I may have to review my opinion there given the nature of the C implementations on the Propeller, but that is an implementation issue is it not?
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
For me, the past is not over yet.
Leon
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Amateur radio callsign: G1HSM
Suzuki SV1000S motorcycle
Why, Modula 2, of course!
-Phil
I'm curious (and perhaps this could only be answered officially) if there will be a push toward C over Spin in the future of the Propeller products to align it more with industry standards.
Should I be purchasing C books now?
OBC
I'd be happy to see Spin moving on to other micros. Of course, the neat cog-specific stuff may have to go, unless they get modified into OS-type commands to create, activate, and kill threads, but that would probably mean the dreaded "I" word! (Interrupt )
As to purchasing C books, or learning the language, there are only two reasons for that: (1) you really want to learn the language, or (2) your boss says you must know C for your job. If you decide to get a book or twelve, also check out the "How To Avoid Sneaky Errors in C" types of books and magazine articles. (I like the errors like
)
There! I've counseled OBC AND fed a Pet Peeve all in one posting!
--Rich
I will still use it quite often, moreso than C
Probably not as much as PASM [noparse]:D[/noparse] but I'll still use it an awful lot.
Especially with my demos for PropGFX. ( other than a few FemtoBasicGFX ones obviously lol )
But, if you want to learn it for your own personal gain, then go for it.
You've learnt Spin, it's not a million miles away from that.
just remember ; at the end of a line and {} are used with (or instead of) indents.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
http://www.propgfx.co.uk/forum/·home of the PropGFX Lite
Post Edited (Baggers) : 3/31/2009 9:51:09 PM GMT
Love the error demo... very subtle.
My favorite was always:
if (i = 0)
{
doSomething();
}
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
I think SPIN's role as the premier language for Propeller development is safe for a while yet.
But I'll warn you now - my next project is going to be an Ada compiler for the Propeller
Ross.
Maybe I should try and find the time to debug my fasterer spin interpreter - it's all but complete. From memory (I do have senior moments), my testing indicated about a 20% gain. I have a little space available in the cog, so some extensions could be done with LMM and overlay techniques. My overlayer will run at least as fast, if not faster, than LMM, but you need to have the space in the cog in the first place. Of course, the compiler(s) would also require the extensions.
I built a debugger for it, so it uses the output from homespun to trace spin (bytecode) instructions in the listing, and you can go down to pasm level debugging (within the interpreter or a pasm program), and it is zero footprint within the cog. The PC end needs some GUI work.
Personally, I've got by for 40 years without much C. It is to hyroglyphical (how the hell is that spelt?) so sometimes very hard to read by some who exploit it. I prefer assembler, although I've written quite a bit in VB some years back. However, lots of professionals think C should be available and these 2 compilers now provide that.
So, if it takes your fancy, learn C.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Links to other interesting threads:
· Home of the MultiBladeProps: TriBladeProp, SixBladeProp, website (Multiple propeller pcbs)
· Single Board Computer:·3 Propeller ICs·and a·TriBladeProp board (ZiCog Z80 Emulator)
· Prop Tools under Development or Completed (Index)
· Emulators: Micros eg Altair, and Terminals eg VT100 (Index)
· Search the Propeller forums (via Google)
My cruising website is: ·www.bluemagic.biz·· MultiBladeProp is: www.bluemagic.biz/cluso.htm
Had to chuckle when I read that, Cluso [noparse]:)[/noparse] My handwriting has be compaired to assembler ... as in unreadable
From about 1988, I'd say, professional programmers had to know C - and it's still pretty much a requirement.
Venturing a tad off thread here:
Now if you really want to learn a cryptic language, try Haskell
For cool, really nice languages, try Ruby or, my latest favorite, Io - which combines the best of python, perl, ruby, and SmallTalk --- and yes, SmallTalk is still alive and doing well.
- Howard in Florida
(programming since 1974 - yikes!)
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Buzz Whirr Click Repeat
I really wasn't considering it before, but Catalina has pushed me over the edge so to speak,
so I may be one of those who start with the "freebie" and move onto a more commercial
product like Imagecrafts if it sticks. So from a marketing standpoint, the "freebie" isn't a
bad thing to happen to Imagecraft.
OBC
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
New to the Propeller?
Visit the: The Propeller Pages @ Warranty Void.
Post Edited (Oldbitcollector) : 4/1/2009 4:25:02 AM GMT
Firstly - a good question. Personally, I learnt C a number of years back - old Dos based apps on P.C's and the dreaded PIC for control. Since I have been converted to the Prop in 06 - it has been all Spin & PASM for hardware - virtually no C .. My PC apps are mostly VB.NET now - that said - I have used C# for a number of apps (pretty nice). In terms of hardware - customers now seem to be more results driven - what the app was written in seems to be of lesser concern than before. I suppose I have been lucky that my customers have embraced the Propeller and thus SPIN/PASM as 'new technology' early on - based purely on results of the initial installations - since then it has been plain sailing! I wouldn't 'write off' the idea of using C - just wait until you want to 'port' some code to SPIN/PASM - it'd be pretty damn handy then. One of the best examples of this would be the Microchip enc28j60 - all available documentation and sample code was C based once the basic concepts were understood it was easier to port to SPIN .. I am sure 'Harrison' would agree. - Put simply - if you can program in SPIN you will have no issue with C - so why not !
Regards,
John Twomey
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
'Necessity is the mother of invention'
Those who can, do.Those who can’t, teach.
After using the drag-and-drop language from Lego for about 2 weeks, then I threw it away and started with a C variation NQC (Not Quite C).
The possibilities of the Lego Mindstorms kit where not enough for me, so I bought a Javelin Stamp in 2007.
The Java language turned out to be a great language to structure sensor objects, behaviours and artificial routines.
One BIG downside: the price, $90 for just the processor.
In 2008 I bought a Propeller ProtoBoard, because of the active forum (Javelin forum is really quiet), low costs and high processing speeds.
The Propeller architecture is a great way to get things done in no-time but sometimes results in mind-breaking code constructions.
Now, in 2009 I study Electrotechnics in the Netherlands and have to learn about the ATmega32 microcontroller from Atmel with the C programming language.
The interrupts seemed very difficult because of all previous controllers didn't have them. Now I'm used to it.
Being back to the C programming language, I like it for the simplicity and the fact that it is available on almost all systems.
One microcontroller costs $3!!!
That looks a lot like I'm just posting my CV, but the above is just an explanation for the lists below.
My list of favourite languages:
- Java
- C
- Spin
- Drag-and-drop
My list of cost-efficient languages:
- C
- Spin
- Drag-and-drop
- Java
My list of nice-concept languages:
- Spin
- Drag-and-drop
- Java
- C
Wow! Mind-breaking?
I guess I'm lucky in that I come from a Pascal and assembler background, but I find SPIN incredibly natural. I've really not come up against anything I had to try and mangle the language to work around. PASM is so simple, deterministic and orthogonal it's a doddle compared to most of the other chips I've played with.
C is great 'n all, and I've learned it so I could do some linux kernel stuff and a few other open source projects here and there, but I've never found much of a use for it myself outside of that.
Frankly I tend to think if the only tool you know how to use is a hammer, everything looks like a nail. Learn everything you can get your hands on and always use the right tool for the right job. I don't *always* do that, and I have a ~2,500 line bash script here to prove it [noparse];)[/noparse]
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Cardinal Fang! Fetch the comfy chair.
I hate data types, after you know enough to understand every thing at the lowest level I find them quite reprehensible.
I mean, when you just waht to pass bits in a long arround spin beats plain old C.
No casting, no data type mismatch, just pass variables.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Nyamekye,
Type checking has benefits even though it seems to create more work. I've written large programs in C and in an extended Pascal designed for systems programming. The type checking in the Pascal helped me with bugs more times than you might expect. There's a sort of "do you really mean to do that?" that the compiler can provide with the additional information and it also helps with the compiler's ability to optimize the generated code. This is particularly important when you use pointers ... a major source of bugs ... and power.
When I got my first pic, I found C to be pretty simple to understand after having taken java, but everywhere I turned their was some sort of error. This library, that library, blah, blah. I actually finished one app with C, but then along came the prop!!!!!
I can honestly say now that I don't know how to use C. Or java for that matter! Ocassionally I play with Pbasic and VB6 and VB.net but even if I knew C I don't have all the other credentials that would get me hired as a C programmer. If ever I got to where one Propeller couldn't handle the situation I would throw another prop at it before I put my head thru C again. Not because of it's syntax, but because of all it's parameters. Large code, small code. It was basically the fact that the compiler IDE itself assumed that I knew what it was saying. Yes there were some explanations of stuff in the compiler, but what they didn't explain made me feel like a real dumb...
I'm not saying anything about Imagecrafts attempts towards the prop, frankly I haven't looked at it. But spin is good and Pasm is better.
I just want to have fun and make killer apps! Going back to the drawing board just to keep my anti-drug hobby makes arobic walking look alot more appealing!
Type checking has helped me too before when working in C, but for the most part its added overhead I have to think about when writing code.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Nyamekye,
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
For me, the past is not over yet.
Hang on to Spin. I've climbed mount C several times for specific projects but it has it's limitiations too. I've never seen a successful uProcessor controller product that did not have a couple of levels of languages to meet different development demands.
Jim-
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Signature space for rent!
Send $1 to CannibalRobotics.com.