Shop OBEX P1 Docs P2 Docs Learn Events
C Compiler for SX — Parallax Forums

C Compiler for SX

inakiinaki Posts: 262
edited 2005-06-03 14:10 in General Discussion
Is there any cheap C compiler IDE for SX·?
I know people that·is using MPLAB··but one cannot debug within MPLAB IDE.
The Bytecraft SXC is too expensive.

Anyone there is using any·C compiler as a regular tool for SX development ?
·

Comments

  • BeanBean Posts: 8,129
    edited 2005-05-27 10:54
    I don't use C, but one free SX compiler I know is "C2C"

    http://www.picant.com/c2c/c.html

    Bean.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    "SX-Video·Module" Now available from Parallax for only $28.95 http://www.parallax.com/detail.asp?product_id=30012


    Product web site: www.sxvm.com

    "It's not getting what you want, it's wanting what you've got."
    ·
  • Paul BakerPaul Baker Posts: 6,351
    edited 2005-05-27 12:02
    Peter Verkaik released a porting of smallc for the SX in this thread. Is free cheap enough for you? Of course TANSTAFL (nothing is free), your not going to get the level of support that purchasing a commercial complier would likely provide.
  • inakiinaki Posts: 262
    edited 2005-05-27 12:37
    The picant does not allow to debug a SX within the IDE. It is basically the same problem that occurs with CSS or Hitech compilers.

    The smallc port converts C to ASM. While I can debug the ASM version, what I want to debug is the C version, not the ASM one. I can get a similar effect compiling to ASM in MPLAB.

    What I want is some IDE similar to MPLAB that allows me to debug in C within the IDE. In other words I want something similar to MPLAB with a C compiler. I suppose Bytecraft does all that, judging it for its price.

    I am pretty positive it would be possible to make a SX-Key pluggin for MPLAB for debugging. Anyone ? smile.gif
  • BreBre Posts: 1
    edited 2005-06-02 17:06
    CCS offers one - the info is at http://www.ccsinfo.com/sx.shtml
  • PLJackPLJack Posts: 398
    edited 2005-06-02 18:14
    I know where you are going with this inaki.
    I come from 12 years of C/C++ and when I started using the SX a thought
    "if only I could code in C I could crank out the code".

    I'll save you the trouble, learn ASM/SASM.
    I kept reading that advice in these forums and shrugged if off. But they are right.
    Even if you did use C its not the C you are thinking of. It is as cryptic a ASM.
    Same for SX/B. Parallax did a great job with SX Basic but I think they would be
    the first to tell you it is only to wean basic users into ASM.

    I'm learning ASM now and it really is not that hard.

    Instead of :

    If(I < 20)
    DoSomething

    its:

    CJAE I, #20, GoSomeWhereElse
    DoSomething

    CJAE is "Compare, Jump if above or equal". In this case jump to GoSomeWhereElse.

    Anyway, just my advice.
    Now, if I could just nail Arrays in ASM. [noparse]:)[/noparse]

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jack
  • BeanBean Posts: 8,129
    edited 2005-06-02 18:28
    Jack,
    That is one use of SX/B. Make a simple little program that uses arrays. Then see what code SX/B generates and learn from it.
    Bean.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    "SX-Video·Module" Now available from Parallax for only $28.95 http://www.parallax.com/detail.asp?product_id=30012


    Product web site: www.sxvm.com

    "It's not getting what you want, it's wanting what you've got."
    ·
  • PLJackPLJack Posts: 398
    edited 2005-06-02 18:50
    Bean (Hitt Consulting) said...
    Jack,
    That is one use of SX/B. Make a simple little program that uses arrays. Then see what code SX/B generates and learn from it.

    There you go Bean, good Idea.
    Although I did just now post a new topic on the question. [noparse]:)[/noparse]

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jack
  • CPUMANCPUMAN Posts: 55
    edited 2005-06-02 20:01
    The upshot to learning assembly also is that there is a lot of truth in "you know one you know them all".· I first learned assembly on the 68HC11, which is a completely diffrent chip from the SX in many ways, but when I want to go look at SX assembly code it all made a lot of sense.· Assembly will frustrate you to no end at first but once you know it, you know it well and it's very easy to learn another processor quickly after that.

    So as Jack put it learn assembly if you still want to use C after that you'll be able to at least make heads or tails of the compiler's output.

    Just my $0.02.

    Chris
  • pjvpjv Posts: 1,903
    edited 2005-06-02 21:25
    Hi There;

    I have the CCS compiler, and so far I'm not impressed. Since I have been using SX assembly for many years now, I can out code the compiler by almost a factor of 2 for ROM space, and sometimes a factor of 3 in variable space. Granted, the compiler does not know what tricks I'm up to, but then it's the job of a good compiler to figure that out.

    My principal compiler need was for convenient floating point math routines, and I found them too bloated and wasteful of RAM. Doing some fairly basic FP math in an SX28 doesn't leave much ROM nor RAM memory for the main tasks of the program. In my opinion its useless for an SX28. The SX48/52 of course will fare a bit better.

    So far I have rewritten a few of the FP routines in assembler, and compacted the code considerably as well as the RAM. The speed has also gone up significantly. I believe that I will be able to get quite a compact set of FP math routines (re)written, then I'll shelve the compiler permanently.

    Do realize though that the compiler from CCS is really geared to the PIC family, and the SX version is a bit of a wart. Support for this version is very poor; e-mailed requests are form-answered by a machine, and then you never hear again from them. Product updates for PIC are frequent, but extending those enhancements to SX happen only if you whine. Lots of bugs that clearly are a result of carelesness or lack of understanding the SX architecture. How tough can a clear-ram routine be?

    On the positive, telephone calls are answered by a considerate and helpful person.

    Having gone through this experience makes me a staunch believer in the applicability of assember for the SX.

    Man, can you ever make that puppy put out!

    Cheers,

    Peter (pjv)
  • inakiinaki Posts: 262
    edited 2005-06-03 08:15
    As for making *big* programs my conclusion is that it is far more interesting to stay with Microchip PICs. I use daily the HiTech C compiler and together with an ICE it is a powerful tool.
    Let me tell you that I do know assembler already. However assembler is not the best way to do complex progams in my opinion. And yes, I like to watch the code in assembler from time to time, even if I am working in C.

    So far the only interesting thing I can see on the SX family is speed which is very interesting to have but is not the only thing to have.

    I like the Parallax tools in general and appreciate its simplicity, clear docuementation and excellent support. Even after 25 years of programming I can realize that these tools are not only for beginners but are a joy to use for anyone. The SX/B tool is great, although debugging is impossible. It is pretty odd that one requests to an average user to switch from Basic to ASM for debugging!

    So, for serious development I think I will stay with PICs. For fun I will continue to use Parallax tools.
  • BeanBean Posts: 8,129
    edited 2005-06-03 10:58
    Peter (pjv),
    Would you be willing to share your FP routines ? Please...
    Bean.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    "SX-Video·Module" Now available from Parallax for only $28.95 http://www.parallax.com/detail.asp?product_id=30012


    Product web site: www.sxvm.com

    "It's not getting what you want, it's wanting what you've got."
    ·
  • pjvpjv Posts: 1,903
    edited 2005-06-03 14:10
    Hi Terry;

    I suppose so, but first I need to do a bunch more work on them, and right now my priorities are on a different front. Actually they are required for the project I'm currently working on, but are further down in the priorty list. It'll be a while.

    Peter (pjv)
Sign In or Register to comment.