Shop OBEX P1 Docs P2 Docs Learn Events
Is the Propeller the right tool to Learn C — Parallax Forums

Is the Propeller the right tool to Learn C

JCeeJCee Posts: 36
edited 2009-12-20 05:35 in Propeller 1
I have become familiar with the Propeller+Spin, and a little Assembly over the past 2 years. ·Prior to the Propeller, I experimented with the Basic stamp, flashing LEDs.· As my exposure to microcontrollers and other embedded projects grows I find that C is the dominant language.·
·
I have read other posts asking “Is Spin hard to learn”,· my take is that once you know how to “program” learning different a syntax is not hard it just takes time.· I found the shift from Spin to ASM much harder than from Basic to Spin. ·I had to learn how to “program” all over again with Assembly.·
·
Getting on to the question; I need to learn C and I am wondering if the propeller is the right platform.· I know Catalina and ICC are available to compile C to run on the propeller but this is not the *native* language.
·
Should I try to learn C on the Propeller or (dare I say) Arduino.·
·
Don’t take this post the wrong way, I am not trying to promote another microcontroller just trying to get more tools in my toolbox.
«13

Comments

  • evanhevanh Posts: 16,147
    edited 2009-12-16 23:42
    C on the Prop will be fine.

    But to *really* learn C you want to be coding a whole GUI or something substantial with large quantities of dynamic objects.
  • RossHRossH Posts: 5,519
    edited 2009-12-17 00:03
    @JCee,

    Ok, I'm biased - but I think the Prop is a fantastic platform for C.

    C is at least as "native" to the Prop as SPIN. SPIN is an interpreted byte-coded language executed by a SPIN interpreter. C compiles to PASM instructions executed via an LMM Kernel. The only thing that makes SPIN appear more "native" is that the SPIN interpreter is built into every Prop while the LMM Kernel has to be explicitly loaded on boot. But such details are all hidden from you in either language.

    C for LMM programs is faster than SPIN, and for XMM programs C allows much larger programs to be run, and is still competitive with SPIN.

    Ross.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Catalina - a FREE C compiler for the Propeller - see Catalina
  • YodaYoda Posts: 132
    edited 2009-12-17 00:15
    @evanh I would have to strongly disagree - you seem to be describing C++ not C. Trying to do GUIs and dynamic objects will tend to introduce you to bad techniques for "bare metal" type programming that C is strong for. Learning to control hardware and managing memory by hand is a better way to learn. Then move to GUI's, objects, etc.
  • localrogerlocalroger Posts: 3,452
    edited 2009-12-17 00:43
    No. There are tools on the Prop to do C but they exist mainly for people who learned C elsewhere and are used to it. The Prop is highly optimized for a certain kind of programming which does not rely on hardware stack frames -- when you know enough to know what I mean by that, you'll be ready to use C on the Prop if you have a good reason.

    Editing to elaborate...

    C is widely regarded as "portable assembly language" (an assessment I disagree with) but it gives you maximum speed with some high level conveniences and some very low level dangers.· There are very low level C environments that don't use stack frames and other features common to high-level C environments, but if you "learn C" in such an environment you really don't "know C" compared to someone who learned C on an X86 processor or heck even an Arduino.

    The Prop C environments must make a variety of compromises to work at all, since the Prop has no native stack and everyone agrees trying to compile C to Pasm is a waste of time with 512 instructions per cog.· So it's either compiled to Spin bytecode, in which case Spin really works better and is more convenient, or to LMM in which case it's faster than Spin but also takes three or four times the Hub RAM to do the same thing.· (I am developing industrial controls, and have come to the conclusion that Hub RAM is the limiting factor, possibly by design on Chip Gracey's part.· Makes you learn some optimization strategy to get anything done.)· Or you can go to one of the external memory schemes which are slower than Hub RAM access but offer virtually unlimited memory, even with the efficiency hit, compared to the 32K boundary of Spin.· The problem there is that you're suddenly in seriously nonstandard territory -- you can't just buy a Demoboard and try out some code, or share what you write here with the hope that many of us can help you make it work.· Whereas with other processors for which C is native, you can do that.

    So what I'm getting at is, the Prop isn't a very good tool to learn C.· It's a much better tool for learning to program, if you start with its native languages Spin and Pasm, and if you get very far at all with that you'll be able to get into C very easily because many of the concepts are the same.··But for learning to program C is a horrible language full of bear traps and kludges.· If you want to learn to program, please pick another language.· If you need to learn C in particular, you will probably have more success with a platform which supports ICE debugging, which you will need to navigate past all the bear traps and kludges.

    Post Edited (localroger) : 12/17/2009 1:06:39 AM GMT
  • RossHRossH Posts: 5,519
    edited 2009-12-17 00:52
    @localroger,

    It is the compiler's job to take care of that level of detail.

    You need to know that kind of stuff to WRITE a C compiler - not to USE one.

    Writing C programs for the Prop is often easier than writing the equivalent program in SPIN.

    Ross.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Catalina - a FREE C compiler for the Propeller - see Catalina
  • Peter JakackiPeter Jakacki Posts: 10,193
    edited 2009-12-17 01:01
    RossH said...

    <snip>
    Writing C programs for the Prop is often easier than writing the equivalent program in SPIN.
    Ross.

    Do you have some examples to highlight where it is easier?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    *Peter*
  • localrogerlocalroger Posts: 3,452
    edited 2009-12-17 01:07
    Ross -- see edited comment which I was editing while you posted.

    I realize you have done an amazing job with Catalina, and for already written C code you have performed a miracle. But the poster was asking about learning C, and I really don't see how that's easier here than on one of the many platforms that have fully integrated debugging and tracing as well as native stack support and all the other stuff that makes C work better.
  • lonesocklonesock Posts: 917
    edited 2009-12-17 01:13
    In my opinion one of the most important factors when learning a language is picking *projects* that are fun. You will hit snags and rough patches when learning, and especially at those times it is good to have the project pull you back in after a break. Since you need to learn C, and assuming you find the propeller fun to work with, then yes, I think the prop would be a good platform on which to learn. If you haven't enjoyed the prop so far, or don't have a project that sparks your interest, then I would pick a different platform for learning (try game programming or similar [noparse][[/noparse]8^). (Note: debugging will almost certainly be easier on another platform.)

    Jonathan

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    lonesock
    Piranha are people too.
  • evanhevanh Posts: 16,147
    edited 2009-12-17 01:18
    Managing dynamic structures is the way to learn C. C++ extensions just standardise it, albeit in bloatware.
  • jazzedjazzed Posts: 11,803
    edited 2009-12-17 01:38
    It usually happens that some kind of big stink happens when C comes up around here. I'm not trying to start it or perpetuate it with the following, I'm just saying what I think would really be helpful for a newbie C programmer and what I wish someone had told me long, long ago.

    C on Propeller is fine, but you should first get comfortable with C language in a friendly environment which means use a world class compiler and a debugger that lets you see the effect of your program, then move to C on Propeller or other micro. Many C programming tutorial pages are on the net ... one of the first returned by Google search is www.cprogramming.com/tutorial/c/lesson1.html ... browse that or some other tutorial. When you're ready to get serious, install a world class compiler/tool chain like GNU or MSVC++, and have at it. Learn C first and not C++. C++ is important at some point, but has weird things that will confuse you as a beginner. When you're learning C forget about using C99 inline functions and dynamic sized arrays, because neither will be available on the C89 LCC based Propeller C variations. Books are nice if you like things to hold in your hand, but the help for library functions and other resources are available everywhere.

    Best of luck. C-ya!
    --Steve
  • Mike GreenMike Green Posts: 23,101
    edited 2009-12-17 01:51
    One recommendation for jazzed's suggestion, try Ch (www.softintegration.com/). It's free for non-commercial use and there are versions for Windows, Linux, and the MacOS. It's an interpreter, so debugging is easy and feedback is immediate. There are books on using it to learn C. Once you're comfortable with C, you can use it with the Propeller with Catalina.
  • RossHRossH Posts: 5,519
    edited 2009-12-17 03:01
    @all,

    I genuinely believe the Prop is a fantastic way for people who already know the hardware (and SPIN and PASM) to learn C (which was JCee's original question). JCee is quite correct that C is by far the dominant language for embedded work - so why not learn it on an embedded platform? The Prop is such a rewarding and interactive platform - one Prop chip and a couple bits of "glue" and you have a fully functional computer - but one that can also drive all sorts of real equipment. It really does bring the fun back into programming. Learning a new language is much more fun when you can actually see your program do real stuff - control motors, light LEDs - who cares what it actually does, as long as it does stuff? I'm not riding any Catalina hobbyhorse here - I'm sure much the same would be true of ICC.

    As for C being easier than SPIN - maybe that's just what I'm used to. But I can (and just have) coded this in about 30 seconds in C ...
    #include <stdio.h>
    main() {
       char name[noparse][[/noparse]11];
       printf("Enter your name: ");
       scanf("%10s", name);
       printf(" Hello %s", name);
    }
    


    ... and I'm fairly confident I can compile and run it on any Propeller platform regardless of the actual hardware devices that are connected. But it would probably take me half an hour to code the equivalent in SPIN - and even then it would probably only run on one particular Prop, and if I wanted to run it on another Prop I'd need to know what devices were connected and then change the software to suit.

    Ross.

    EDIT: Just read jazzed's reply and also localrogers edited reply - ok, I agree that C is a language that can get you into trouble faster than almost any other - but so what? That's the nature of C, and pretending otherwise is not teaching you about C. You may as well go say "go learn Java first, because its safer". Ys it is - but doing so won't teach you C. By the way, PASM is even worse than C in this respect - so would you also suggest to a Propeller-head who already knew the Propeller (and also knew SPIN) to go learn assembly on some other "safer" platform first and then come back and tackle PASM on the Prop? I think instead (and I've seen it happen in these forums several times) that you'd simply tell them about the Prop's specific pitfalls, point them in the direction of any documents that might help them, and then encourage them to experiment!

    On the other hand, the lack of a source level debugger is a problem on the Prop for newbies - one that I hope to rectify in Catalina at some point. But if ICC has one (I don't actually know) then I'd happily recommend a C newbie to use ICC instead of Catalina. They can come back to Catalina when they get serious about C turn.gif (<- that's me keeping an eye out behind in case Richard sneaks up and belts me!)

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Catalina - a FREE C compiler for the Propeller - see Catalina

    Post Edited (RossH) : 12/17/2009 4:17:38 AM GMT
  • jazzedjazzed Posts: 11,803
    edited 2009-12-17 04:24
    JCee wrote: >> Getting on to the question; I need to learn C and I am wondering if the propeller is the right platform.

    With Propeller or any other micro, you have to worry about things like having to download hardware, having to remember to disconnect your terminal program before testing code (not an issue with jtag enabled devices), or dealing with memory constraints (when you know better, you can deal with that).

    RossH with Catalina and Richard@ImageCraft have given a great deal of effort to making what you ask possible. In Richard's case, he spent a money and time on the project that will never pay him any return. RossH obviously has lots of personal pride in his product as evidenced by the platforms he is supporting. I appreciate the efforts of both.

    If you like Propeller enough to try it, then great ... knowing RossH and Richard, they will bend over backwards for you to help you succeed. It is exceedingly unlikely that anyone supporting GNU or at MS will help more than by delivering high quality industry standard products.

    For someone just starting out though, it's probably better to learn on a great and flexible IDE.

    There is nothing to get in the way of learning C on Windows/Linux/OSX PC. The finest possible world class PC/Linux/OSX tools exist to help you on your way. Things such as a good IDE, helpful compiler/linker, and vivid/simple debug tools exist there and work perfectly for understanding clearly what is happening. You don't have to wonder about whether or not the hardware is working. You don't have to have any hardware at all other than your PC to learn.

    I first learned C on Unix cc and TurboC. It took me years to realize there were bugs in the TurboC compiler ... all I knew for sure at the time was that the Unix cc seemed to work much better than TurboC on the PC. The PC "platform" was very immature compared to Unix. I'm not saying anything is wrong with Catalina or ICC. I'm just saying that learning on a very well known and unquestionably solid platform with no strings (or USB cables attached) is more productive than having to decide whether or not I have issues with my platform.

    Cheers.
    --Steve
  • JCeeJCee Posts: 36
    edited 2009-12-17 05:25
    Thanks for all good feedback. I think I will try to learn C through some other online tutorials and try back with the prop once I have a better understanding. Parallax is known for their excellent documentation I wish they had some material to introduce C.
  • RossHRossH Posts: 5,519
    edited 2009-12-17 06:32
    Lone Ranger: Blast - lost another one, Tonto!
    Tonto: What do you mean "we", kemosabee?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Catalina - a FREE C compiler for the Propeller - see Catalina
  • heaterheater Posts: 3,370
    edited 2009-12-17 07:26
    Q. Why did The Lone Ranger shoot Tonto dead.?
    A. He found out what "kimosabe" really meant.

    What ever you do take the advice here and whilst learning C do your exercises on a PC. Not sure what is the best compiler for a beginner to start with but that interpreting environment suggestion sounds great. The old Borland Turbo tools were great for this kind of thing. Something whwere you can quickly edit and compile and step through the code in a debugger.

    Never mind that stuff about dynamic structures and GUI's you want to learn C with a aim of using it on micro-controller I believe. In that world you are lucky to have any dynamic structures and GUIs are a large and complicated other world away.

    No, exercise those parts of C you want in an MCU, integer arithmetic, bit twiddling/shifting, the normal conditional, loops, functions, parameters etc etc. It's quite possible to use C in a very Spin like way.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    For me, the past is not over yet.
  • ImageCraftImageCraft Posts: 348
    edited 2009-12-17 07:32
    RossH said...
    ...

    On the other hand, the lack of a source level debugger is a problem on the Prop for newbies - one that I hope to rectify in Catalina at some point. But if ICC has one (I don't actually know) then I'd happily recommend a C newbie to use ICC instead of Catalina. They can come back to Catalina when they get serious about C turn.gif (<- that's me keeping an eye out behind in case Richard sneaks up and belts me!)

    We spec'ed a debugger for Propeller C, but with us moving to CodeBlocks as our V8 IDE, we will probably just go ahead and generate ELF/DWARF and use GDB instead. As we have a foot in the door, when the market is ready, we will be there. Right now, I am up to my eyeballs optimizing for the PSoC and making progress with CodeBlocks and the Dinkumware full standard compliant library. Never a dull moment.
  • Nick MuellerNick Mueller Posts: 815
    edited 2009-12-17 08:31
    And my comment! smile.gif
    The Prop isn't a bad platform for C. The missing stack-ops have absolutely nothing to do with that. SPIN also needs a stack. So this argument was worthless.
    The suggestions to start C on a different platform that does have a debugger are valid to some extend. But then, SPIN also doesn't have a debugger and you mastered (at least to some extend) that too.

    So, yes, learning C on the Prop is OK as long as you already learned some debugging techniques (in SPIN, PASM, whatever). C on a µC is different. Not from the language POV, but from the techniques. And *ANY* µC is quite the same to that respect. It's more bare-bones-programming than on a PC-platform.

    So take the plunge, do it on the Prop! You already have a Prop, no gain in investing into a different platform.


    Nick

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Never use force, just go for a bigger hammer!

    The DIY Digital-Readout for mills, lathes etc.:
    YADRO
  • LeonLeon Posts: 7,620
    edited 2009-12-17 10:39
    I'd advise buying a copy of Kernighan and Ritchie's excellent The C Programming Language and downloading the DJGPP port of gcc for the PC. The excellent gdb bugger is available and lots of code libraries. There is an IDE for it.

    Leon

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Amateur radio callsign: G1HSM
  • Nick MuellerNick Mueller Posts: 815
    edited 2009-12-17 10:55
    > and downloading the DJGPP port of gcc for the PC.

    DJGPP! OMG! The worst Smile I have ever used!
    Download the Open-Watcom compiler. The IDE is quite ... um ... antique, but the libs and the C-implementation is rock-solid and effective.


    Nick

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Never use force, just go for a bigger hammer!

    The DIY Digital-Readout for mills, lathes etc.:
    YADRO
  • AleAle Posts: 2,363
    edited 2009-12-17 11:51
    DJGPP Smile ? ! You should have used Moco$oft's C compilers (and the horrible Programmer's workbench) to know how good djgpp is!. While the watcom compiler is better at generating code, djgpp was free at the time and also used for commercial software (quake was compiled with it while the previous games used watcom). djgpp is better used with RHIDE, without it... well it is just not the same wink.gif.
    Now, the watcom compiler has been opensourced some years ago.. so maybe it is now an better alternative.
    But if you like gcc, then djgpp is the way to go.

    C compilers for the PC exist for DOS and for winblows. You can use Netbeans and the C compiler provided by cygwin for instance, but alternatives exist aplenty. (Or Moco$oft's Visual C(rap) I mean Studio, supposedly the "best" IDE ever blah blah ).

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Visit some of my articles at Propeller Wiki:
    MATH on the propeller propeller.wikispaces.com/MATH
    pPropQL: propeller.wikispaces.com/pPropQL
    pPropQL020: propeller.wikispaces.com/pPropQL020
    OMU for the pPropQL/020 propeller.wikispaces.com/OMU
  • LeonLeon Posts: 7,620
    edited 2009-12-17 12:08
    Nick Mueller said...
    > and downloading the DJGPP port of gcc for the PC.

    DJGPP! OMG! The worst Smile I have ever used!
    Download the Open-Watcom compiler. The IDE is quite ... um ... antique, but the libs and the C-implementation is rock-solid and effective.


    Nick

    What's wrong with it? It's gcc, which is a pretty good compiler.

    Leon

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Amateur radio callsign: G1HSM
  • Dr_AculaDr_Acula Posts: 5,484
    edited 2009-12-17 13:19
    I'm a BASIC programmer. I know nothing about C. Well, virtually nothing. I understand Printf but I get lost with Scanf. I am vaguely aware that C is probably the best language for bit manipulation. I also would hazard a guess that if you want a nifty function to do xyz, someone probably has it written in C.

    So, as a total newbie, let's see if this new-fangled 'C' language can run on a propeller.

    RossH has issued a challenge which I reproduce below


    As for C being easier than SPIN - maybe that's just what I'm used to. But I can (and just have) coded this in about 30 seconds in C ...

    #include <stdio.h>
    main() {
    char name[noparse][[/noparse]11];
    printf("Enter your name: ");
    scanf("%10s", name);
    printf(" Hello %s", name);
    }

    ... and I'm fairly confident I can compile and run it on any Propeller platform regardless of the actual hardware devices that are connected. But it would probably take me half an hour to code the equivalent in SPIN - and even then it would probably only run on one particular Prop, and if I wanted to run it on another Prop I'd need to know what devices were connected and then change the software to suit.


    Now remember, I don't understand C. Actually, I don't really understand Spin either, though I'm getting better with PASM. But I'm going to take RossH's program and I'm going to run it on a propeller.

    Actually, I'm going to do more than that. I'm going to compile it on a propeller too. And even more than that, I'm going to write it on a propeller as well.

    And I'll go even further. Even though I know RossH wrote is challenge for his own compiler, I'm going to use a different C compiler. Just to really test the intercompatability of this *tiny voice* language I'm quite coming to like...

    Hardware is a DracBlade, which is essentially a Prop plus a ram chip plus a vga screen, keyboard and an sd card for storage. So it is self contained and can run without a PC once all the software has been copied over.

    First, write the program. I'm using Wordstar. Next, save it as a .C file called ROSSH.C and TYPE it out to check it looks like RossH's original:

    B>type rossh.c
    
    #include <stdio.h>
    main() {
       char name[noparse][[/noparse]11];
       printf("Enter your name: ");
       scanf("%10s", name);
       printf(" Hello %s", name);
    }
    
    B>
    
    



    Drive B contains the disk image of the BDS C compiler which I obtained from the SIMH archive and dropped onto the sd card as a disk image. The instruction manual is available here www.bdsoft.com/resources/bdsc.html in the primary downloads section.

    To compile a program (I've not done this before on a propeller but I'm just following the instruction manual here), I understand I type something like "cc rossh"

    so, here is a trace of what it does:

    B>cc rossh
    
    BD Software C Compiler v1.60  (part I)
      36K elbowroom
    
    BD Software C Compiler v1.60 (part II)
      33K to spare
    
    B>
    
    



    Hmm - that seemed to work ok. So, the next instruction is something called a Linker (you could write a batch file to do this if you like, but this is fun and it doesn't seem to have gone wrong so far)
    "clink rossh"

    and here is the trace:
    B>clink rossh
    
    BD Software C Linker   v1.60
    
    Last code address: 175C 
    Externals start at 175D, occupy 0006 bytes, last byte at 1762 
    Top of memory: E405 
    Stack space: CCA3 
    Writing output...
      43K link space remaining
    
    B>
    
    



    Hey, that seemed to work. And I just noticed something nifty. I've got 43k left and I'm using a propeller with only 32k of ram. Groovy..

    Oh well, can't put it off any longer. Time to run this program and see if it crashes and burns...

    B>rossh
    
    Enter your name: Dr_Acula
     Hello Dr_Acula
    B>
    
    




    Well, there you go. It worked. Grr. Just wait till I tell my BASIC programmer friends...

    Not only did it work, but RossH seems to have his own compiler which does the above even more easily.

    So - is the prop a good platform for learning C? Well, I don't know any C and I just wrote a program and got it to work first time, so I reckon the answer is a resounding YES!

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    www.smarthome.viviti.com/propeller

    Post Edited (Dr_Acula) : 12/17/2009 1:29:02 PM GMT
  • heaterheater Posts: 3,370
    edited 2009-12-17 13:23
    JCee: I think from the responses here you have just discovered why Parallax went with Spin and their Prop Tool for the Prop rather than C [noparse]:)[/noparse]

    C has some tricky features to master but first you have to figure out how on earth to get your compiler to do anything!

    Then you get sucked into the wonderful world of Make files and such....

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    For me, the past is not over yet.
  • heaterheater Posts: 3,370
    edited 2009-12-17 13:32
    Dr_A: Funny I did not think of that. You really can learn C actually ON the Prop. No PC required at all !

    caveats:
    1) Setting yourself up with a Prop + RAM that runs CP/M may not be an option.
    2) The dialect of C that BDS implements is rather ancient now.

    When you are done with C you can move on to explore FORTRAN, ALGOL, PASCAL, PL/M, ADA and more. All with nothing much more than Prop + RAM + SD card + keyboard + VGA [noparse]:)[/noparse]

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    For me, the past is not over yet.
  • AleAle Posts: 2,363
    edited 2009-12-17 13:33
    heater: if you only have one big file... you can skip make. gcc will do it all for you wink.gif... other compilers may not. But if you are already programming in C, then using 2 or 3 command line tools shouldn't be a problem as far as you know which options to use in every case, something not always clear :-(.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Visit some of my articles at Propeller Wiki:
    MATH on the propeller propeller.wikispaces.com/MATH
    pPropQL: propeller.wikispaces.com/pPropQL
    pPropQL020: propeller.wikispaces.com/pPropQL020
    OMU for the pPropQL/020 propeller.wikispaces.com/OMU
  • heaterheater Posts: 3,370
    edited 2009-12-17 14:11
    Yeah, yeah, I know[noparse]:)[/noparse]

    Provided you know that when you compile hello.c with GCC the resulting executable is called "a.out" rather than anything sensible like "hello". Or provided you know how to tell GCC what to call the output. For a total newbie getting started with all this nonsense can be a trial. As you say "not always clear".

    Might I suggest, for first steps in C use the most wonderful "Tiny C Compiler" from here bellard.org/tcc/

    This thing is amazing. For example:
    1) Edit your first hello world program in file hello.c
    2) Compile and run it with one simple command: "tcc -run hello.c"

    Bingo! it compiles the thing and runs it before you can bat an eye.

    Also available for Windows.

    Edit: Blimey TCC can compile 10 times faster than GCC. And it can build a Linux kernel in 10 seconds!

    If this tiny thing can do that Linux on the prop cannot be far away[noparse]:)[/noparse]

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    For me, the past is not over yet.

    Post Edited (heater) : 12/17/2009 2:18:09 PM GMT
  • Nick MuellerNick Mueller Posts: 815
    edited 2009-12-17 16:07
    > What's wrong with it? It's gcc, which is a pretty good compiler.

    DJGPP used (last time I tried it was about 3 years ago) an outdated gcc. There was something with the memory-model (no choice or something like that). Compiler accepted bad constructs without warning or error, very little checking etc. don't remember that well. Only thing was that I was willing to $$$-buy one (for DOS) just to get rid of it. Code-size 20% more than Open-Watcom.


    Nick

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Never use force, just go for a bigger hammer!

    The DIY Digital-Readout for mills, lathes etc.:
    YADRO
  • Nick MuellerNick Mueller Posts: 815
    edited 2009-12-17 16:25
    > C has some tricky features to master but first you have to figure out how on earth to get your compiler to do anything!
    > Then you get sucked into the wonderful world of Make files and such....

    Try ImageCraft's ICCProp! I never had to make a make-file. And for the compiler to do something ... well ... click on an icon! smile.gif


    Nick

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Never use force, just go for a bigger hammer!

    The DIY Digital-Readout for mills, lathes etc.:
    YADRO
  • LeonLeon Posts: 7,620
    edited 2009-12-17 17:02
    Nick Mueller said...
    > What's wrong with it? It's gcc, which is a pretty good compiler.

    DJGPP used (last time I tried it was about 3 years ago) an outdated gcc. There was something with the memory-model (no choice or something like that). Compiler accepted bad constructs without warning or error, very little checking etc. don't remember that well. Only thing was that I was willing to $$$-buy one (for DOS) just to get rid of it. Code-size 20% more than Open-Watcom.


    Nick

    Just use switches like -Wall to get better source code checking. Checking can be about as strict as Lint with the correct switches.

    Code size and speed can be optimised, as with most compilers.

    Running gcc under Cygwin is another option - most of the GNU utilities are available.

    Leon

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Amateur radio callsign: G1HSM

    Post Edited (Leon) : 12/17/2009 5:09:09 PM GMT
Sign In or Register to comment.