Shop OBEX P1 Docs P2 Docs Learn Events
Closing in on BETA ImageCraft C — Parallax Forums

Closing in on BETA ImageCraft C

ImageCraftImageCraft Posts: 348
edited 2008-03-28 14:25 in Propeller 1
The compiler, assembler, linker and the LMM kernel are code complete. We have run (very slowly since it involves manual loading the code and checking of the blinking LED in the end for a *pass* status (*)) 2000+ trivial, non-sensible, but useful compiler tests. They look something like this:

void main()

{
unsigned int a = { 4352};
unsigned int *p, b, c, d, i, j, sum, x, *s;
d = *(p + i);
sum = a[noparse][[/noparse]i + j] + *(a + i + j)+ *(p + i + j);
b = *(s + i);
}

This one is not an execution test so no need to tell me it won't run smile.gif The generated code is decent but definitely can be improved with peephole optimizations which we will be adding. Function calls etc. are working. As are variables in COG registers, COG local stack, HUB stack, and HUB direct data. Pretty much within limits of the hardware, any C integer code should work (we do have a couple failure cases to go through). No benchmark figure yet, but there is no reason to believe it is out of whack of back of envelope estimate. Lack of index mode means addressing even COG stack locals are more expensive than simple register references so there will be further tweaking later.

We are waiting for our software partner to finish the programming code, to be integrated to our IDE. All in all, moving along. Still no firm date yet, but we definitely hope to have a beta soon...

(*) We normally write an instruction set simulator for testing purpose but since the Propeller is unique in so many ways, we thought we will do the testing the hard way until we have enough experience with the hardware before doing the simulator.

// richard
«134

Comments

  • kittmasterkittmaster Posts: 77
    edited 2008-03-01 03:08
    this will be epic if it flies......no offense to parallax, but spin is not a resellable skillset, but if it can be programmed in C, then the prop could see a major foot hold in reference designs since it can be universally programmed........sweet!

    Can't wait > Good luck!
  • Bob Lawrence (VE1RLL)Bob Lawrence (VE1RLL) Posts: 1,720
    edited 2008-03-01 03:35
    Cool! I guess it's time to order a development board so I'll be ready. jumpin.gif

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Aka: CosmicBob
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2008-03-01 04:06
    kittmaster said...
    no offense to parallax, but spin is not a resellable skillset
    I don't wish to diminish ImageCraft's efforts and accomplishments here, which I'm sure are considerable and will be incremental to the Propeller's further acceptance. But demonstrable programming abilities are, in general, a "resellable skillset". Being multilingual only enhances one's value. Companies whose HR managers focus narrowly on experience in a particular language will probably, and in like measure, constrain one's career path. Avoiding the situations they pitch should be of paramount importance to forward-thinking job-seekers.

    -Phil
  • deSilvadeSilva Posts: 2,967
    edited 2008-03-01 08:47
    I like your sermon, Phil, as I am also extremely polyglot - but this had never been an advantage within any company smile.gif

    Fact is that the Propeller will not stand the slightest chance for a major project done by anyone else but a Propeller addict, without a "professional" integrated development environment, which generally consists of:
    - (optimizing) C Compiler
    - Configuration/Version Management (or at least a simple link to one, SVN being the barest minimum)
    - Reliable debugging (best hardware supported)
    - Error free PC-simulation

    ---
    Edit:I am fully aware that this community has done a lot in that direction. However this is far from being acceptable to a project manager having deadlines his annual bonus depends upon meeting them smile.gif

    Edit2: I LIKE the Propeller Tool... I would not have been able to completed my classes with something much more complex!

    Post Edited (deSilva) : 3/1/2008 9:20:40 AM GMT
  • deSilvadeSilva Posts: 2,967
    edited 2008-03-01 09:20
    I wonder why there are no benchmark results available....
  • ImageCraftImageCraft Posts: 348
    edited 2008-03-01 10:39
    Mr. deSilva, the number one priority is a full functional release. We will tune as we go and we will tune more after the initial release once we gain more experience. I found your posts sometimes humorous "a compiler is a 3 month job," "a professional IDE with..." No offense, we have been in business for over 10, and I have been writing compilers since 1984. I think I have some experience in the area. I am sure you do too, but please do not presume to speak for the whole industry.
  • deSilvadeSilva Posts: 2,967
    edited 2008-03-01 10:51
    ImageCraft said...
    .. "a compiler is a 3 month job,"....
    This is a misquotation; I think you have not been aware of it but rather quoted from memory...
    ImageCraft said...
    ..but please do not presume to speak for the whole industry.
    Sorry, for the misunderstanding. I ONLY utter my very personal experience; sometimes -maybe. maybe - just a little bit provocative...
  • LeonLeon Posts: 7,620
    edited 2008-03-01 12:36
    A simple compiler can be written in a day or so using Snobol - in only a page of code. 8-)

    Leon

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Amateur radio callsign: G1HSM
    Suzuki SV1000S motorcycle
  • Bob Lawrence (VE1RLL)Bob Lawrence (VE1RLL) Posts: 1,720
    edited 2008-03-01 13:01
    deSilva said...
    This is a misquotation; I think you have not been aware of it but rather quoted from memory...

    deSilva
    Registered Member

    Posted 2/17/2008 6:51 PM (GMT -4)

    Porting a C compiler made for this takes an experienced developer exactly 3 person months:
    1 for the code generator
    1 for the run time system
    1 for testing and integration

    When the developer is not so experienced and he or she is not acqainted with details of the compiler kit or of the target architecture this can easily double.

    When the person does not do it full time there goes easily a year..
    So I think everthing is still in best order..

    Taken from here:
    http://forums.parallax.com/forums/default.aspx?f=25&m=254114


    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Aka: CosmicBob

  • Jim ColemanJim Coleman Posts: 52
    edited 2008-03-01 22:22
    richard

    I also can't wait to buy your new propeller product. Could you please include a reliable terminal program in your IDE that works with both XP and VISTA for output and keyboard input. Thanks for your consideration.

    Jim
  • ImageCraftImageCraft Posts: 348
    edited 2008-03-02 08:40
    Jim Coleman said...
    richard

    I also can't wait to buy your new propeller product. Could you please include a reliable terminal program in your IDE that works with both XP and VISTA for output and keyboard input. Thanks for your consideration.

    OK, this should be easy as we have a terminal in our IDE since forever. It definitely works under XP and I haven't heard that it breaks under Vista. Actually, serial comm under Windows is one of those few things that are fairly straight forward, unless you are pushing for msec accuracy type of thing, so it should be all good there.

    Hi deSilva, sorry for misquoting. Anyway, we are working hard on this release, and our goal is to be as reasonably fast as possible giving the constraints of support Standard C on the Propeller. No doubt about it, besides the normal compiler tuning (eliminating unnecessary register copies etc.) my guess is that there will be a lot of tuning WRT the LMM and runtime architecture. I haven't thought abotu it fully yet, but since the LMM kernel and the HUB timing is "out of sync" sometimes, *possibly* there may even be opportunities for rearranging instructions to take advantage of that kind of thing, but that needs investigation.
  • deSilvadeSilva Posts: 2,967
    edited 2008-03-02 11:26
    Phil Pilgrim devised a devilishly clever system for improved LMM throughput some months ago. It has some drawbacks for the assembly programmer but nothing that could not be handled decently by a code generator!

    Post Edited (deSilva) : 3/2/2008 2:27:25 PM GMT
  • Jim ColemanJim Coleman Posts: 52
    edited 2008-03-02 14:35
    richard

    Ok, all well and good, now we have a proper terminal program. More problems: Will there be a separate Object Exchange for programs written in ImageCraft C. Will ImageCraft provide full time coverage to answer all our website questions. I personally will need a great deal of instructional material to get started. Will this be provided by you or will it be necessary for deSilva or Mr. deSilva (depending on your level of formality) to write another tutorial. If it is the latter than Mr. D should get started now. Another issue, I am afraid there is a rush to release and it could be very sloppy. How will the first versions of your program be updated for error corrections. How will we be notified about corrected versions and of course, there is always the issue of additional cost of corrected versions. The propeller, in my opinion, is very complicated due to cog interaction. I can visualize many cases where spin programs work and ImageCraft C programs do not work. All these issues will have to be sorted out. In the end, if you are not careful, it could be determined that if your program is relatively simple, than Image Craft C is fine, but if your program is complicated than it is better to stick with the native propeller language. I hope there is enough antacid and patience to overcome this nightmare. It might be better to let Mr. D test your software before it is released to us common folk.

    Jim
  • Mike GreenMike Green Posts: 23,101
    edited 2008-03-02 14:55
    Jim,
    I suggest you have a look at ImageCraft's website. They have a number of other C compilers for other microprocessors. I think you'll find that they are in the business of providing professionally done C compilers. They're not in the business of teaching people to program. There are all sorts of books on this written by others. Many of the issues that show up around multiprocessing also occur in writing I/O drivers for Linux and there are lots of books on just that subject.

    If you feel like you will need a great deal of instructional material, you will not find it included with the compiler. You will need to invest in existing C language introductions and you will need to wait for others to write specific books on using ImageCraft's C to program the Propeller. It's a lot of work to do this sort of thing (writing a textbook) and the market is not very large, so you may have to wait a while.

    I suggest you get some kind of general C introduction and work through it using a C compiler available for whatever kind of PC you have. There are several free C compilers and interpreters available for Windows, Linux, and the MacOS. After that, try working through the introduction using ImageCraft's compiler for the Propeller. At that point, you should be familiar enough with C and ImageCraft's compiler that you could apply what's already documented on multprocessor programming in Spin to C.
  • Jim ColemanJim Coleman Posts: 52
    edited 2008-03-02 15:11
    Mike

    I am not talking about " learning C ", I am talking about cog interaction problems involving programs written in ImageCraft C. Unfortunately, there are no books about this subject. The propeller is unique.

    Jim
  • Mike GreenMike Green Posts: 23,101
    edited 2008-03-02 16:33
    The Propeller is not as unique as you might think. Multiple processors with shared memory have been around for many years in the "mainframe" business and, as I mentioned, the same issues show up in single processors with interrupts. There have been many textbooks and papers published on various aspects of multi-processing from really basic introductory texts to sophisticated analyses of "lock" algorithms and scheduling. The unique thing about the Propeller is the combination of features at a reasonable cost and speed on a single chip that's well designed.
  • deSilvadeSilva Posts: 2,967
    edited 2008-03-02 17:04
    Mike, although I generally second your sound opinions, there is more in Jim's concern but RTFM...

    Look back at the SPIN language: simple, streamlined, well documented (really!), an excellent tutorial (though you might know my quibbles WRT Blinker2..). It seems that it took this community around a year to find out to sort the different data types in VAR, to avoid things as COGNEW(obj.method,..) or to well understand the difference between data in DAT and VAR.

    This with a language where a wealth of most specific examples had been written for, as EVERY Propeller user needs SPIN..

    This will be different with the C compiler. I expect that MANY will use the "free" version of the C compiler, but also MANY will stop using it when the learning curve becomes too steep...
    Some of Jim's question will be addressed in Imagecraft documentation, but might also need to be extracted... Efficient use of DIRA,OUTA, INA? Interface to other COGs? References to stack-variables, WHAT stack in the first place, fast "Register Variables", usage of something like "VOLATILE".

    Mike is right that something similar is in every "embedded C", but what the hell is "similar" when it comes down to debugging smile.gif

    In a very mature C-System you will expect to find the most needed features as linkable modules (Keyboard, Mouse, TV, VGA,...) Of course I expect some of them readily available, as they are needed for integration and testing at Imagecraft. I also expect many holes there during the first months. In contrast to the situation with the early SPIN, I am not so optimistic that all our gifted programmers will at once start porting everything from SPIN/PASM to C...

    It has been observed many times here that for efficient Propeller programming, a combination of SPIN and PASM is unbeatable.

    The merrits of C lay otherwhere... And it's there where Jim's questions lead to... I think..

    Post Edited (deSilva) : 3/2/2008 6:02:14 PM GMT
  • Jim ColemanJim Coleman Posts: 52
    edited 2008-03-02 17:36
    deSilva

    Beautifully said, please get to work on your tutorial.

    Mike

    My fear is that if the ImageCraft effort is not successful, the Propeller will get a bad reputation.

    Jim
  • hippyhippy Posts: 1,981
    edited 2008-03-02 18:35
    I'm all in favour of ImageCraft's efforts ( anything which is useful for the Propeller community in fact ) but I don't see how any potential failings in what ImageCraft produce could get the Propeller a bad reputation, nor do I believe the Propeller is really being held back by a lack of C compiler ( I can think of other reasons though ).

    I'm aware there are issues regarding the use of C with the Propeller which remain unanswered, particularly as to how things will be done from a programmer's perspective, and I'm sure ImageCraft are equally aware of that. It's somewhat jumping the gun though to second guess whether ImageCraft provide perfect, adequate or lacking documentation - I'd personally prefer a C compiler available even if documentation is minimal or not finished ( is it ever ? ).

    ImageCraft's primary role is to provide the tools to do the job and enough documentation to use the tools and to develop the programs people want to write. Beyond that anything else is a bonus, and it's largely up to the community using the tools to determine the best practice, tricks of the trade and example code to illustrate such things.

    Will ImageCraft's C compiler fail to deliver what's needed ? I guess we'll have to wait and see but I cannot imagine they have set out on this project with such a destination in mind.
  • deSilvadeSilva Posts: 2,967
    edited 2008-03-02 19:01
    There are many aspects of the C compiler that I am not really interested in... We all know the code will take much more RAM than SPIN and that the speed will not be that of PASM... This could be a good trade-off...

    What I am interested in is teaching people to use a microcontroller (electronic interfacing and algorithms) without having to impose a (new) programming language on them in the beginning. A standard C with the least of deviations would be perfect, including my requests for an IDE as I listed further above smile.gif

    Of course there will be never something as short, simple, and useful as the SPIN "MainDeSilva" in "C"
    PUB mainDeSilva
        DIRA ~~
        REPEAT
           OUTA++
    

    Post Edited (deSilva) : 3/2/2008 7:07:10 PM GMT
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2008-03-02 20:06
    I may be in a minority, but if I were just learning to use a microcontroller, having to learn C at the same time would only steepen the learning curve. Conversely, knowing C ahead of time seems more a disadvantage if it fosters preconceived ideas about how a particular micro should behave. A language which exposes the hardware's peculiarities rather than camoflaging them in the folds of a universal Esperanto should foster a more efficient mastery of its capabilities. For the Propeller, that language is Spin.

    -Phil
  • deSilvadeSilva Posts: 2,967
    edited 2008-03-02 20:24
    Phil, there are two practical aspects, I knew before, but which hit me during my classes:

    (1) Negative: The avarage attendee of such courses is not able to grasp concepts of a new language in a short time, even if he is fluent in another, but this is rare. The closer the new language is to what he already believes to know for sure, the worse... Software Engineers don't program any longer... Something you and me - being "polyglot" - tend to underestimate. The additional amount of time to teach a "new" language before it can be usefully applied the next weeks in the class is considerable.

    (2) Positive: I do not aggree with you that the Propeller needs any specific language. The beauty of its architecture is that it needs nothing at all! It has three variables called DIRA, INA, OUTA. Period. This simplification cannot be emphazised enough!
    The timers/counters are hardly more difficult.Video logic is, though...
    The missing interrupt system makes it complient to every language!

    Post Edited (deSilva) : 3/2/2008 8:34:22 PM GMT
  • ImageCraftImageCraft Posts: 348
    edited 2008-03-02 20:54
    Jim:

    - Product updates: these will be handled as our current product - you download the latest demo and install.
    - Object Exchange: currently our product web pages have lists of sample code projects contributed by users. They send them to us, we upload them. For Propeller, may be we can negotiate with Parallax to use their site, but we will see.
    - Programming Propeller C efficiently: the goal is to provide seamless optimal code generation for Standard C. That is, our model is always as much as possible, the users do not worry about the specific device underneath and write programs with the semantic they have in mind and we will do our best. What this translates to on the Propeller C, for example, is that local variables will be allocated to registers automatically and goes to COG RAM stack automatically if not enough register is available, and goes to HUB stack RAM if their addresses are taken or if the variable size is too large. This leaves the programmers to worry about the core programming task and not optimizing by hand.

    Of course, this will only staisfy 90%+ of the users, there will be some who want to figure out the best way to write an expression to get the best performance.

    I hope this addresses (some of) your questions. From our point of view, as obvious as it is, we enter this market to be successful, make lots of money and retire to Tahiti (*). Will Release One be perfect? No, probably not. You guys are kind of gloomy lot though. What's the point of speculating how far a product can fall, and possibly dragging down Propeller, and by implication, Parallax, will do?


    (*) OK< the latter part has not happen yet....
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2008-03-02 21:51
    @deSilva: I'll gladly defer to your practical teaching experience, since I have almost none. There are, however, some things we can probably agree upon that make a good beginner's language:

    1) A minimum of prior declarations. Too much fol-de-rol at the beginning of a program inhibits "getting down to business" with the coding. Ideally, all variables will auto-vivify, and arrays and strings will automagically grow and shrink as necessary. This, of course, entails dynamic heap management and garbage colleciton, the latter being hypothesized in the forum as too complex to fit a 32K RAM footprint. I'm not sure I agree, since the original 16KB TRS-80 Level II BASIC had garbage collection. Once this teething stage has passed, though, I do believe that enforced declarations — or at least a compiler that flags singular variable instances as possible typos — leads to more reliable code. --C --Spin ++QBASIC ++Perl

    2) Weak typing (as a corollary to #1): yes, even autoconversion between strings and numbers, where appropriate. Beginners don't need the additional burden that strong typing forces upon them. --C --Spin --QBASIC ++Perl

    3) Simple control structures. REPEAT i from 1 to 10 is simple to understand and easy on the eye. FOR (i = 1; i <= 10; i++) {, on the other hand, is rather more intimidating. --C ++Spin ++QBASIC --Perl

    4) No GOTOs. Early encouragement of structured thinking, rather than spaghetti-code thinking, has to be a Good Thing. --C ++Spin --QBASIC --Perl

    5) No distinction between "procedures" and "functions". There's no difference. Why complicate matters with an arbtrary distinction? ++C ++Spin --QBASIC ++Perl

    6) Simple I/O structures with variable-length argument lists. PRINT and printf are much less burdensome than a multitude of pr.dec(var). ++C --Spin ++Perl ++QBASIC

    I'm sure there are others, but these are the first that come to mind. I've yet to see an "ideal" beginner's language.
    ____________________________

    @Richard: Don't be discouraged by any "gloominess" you read in the forum. Your primary market won't be the people who currently haunt its recesses but, rather, those still waiting to discover the Propeller through a familiar paradigm. I wish you success and hope you do get to retire to Tahiti!

    -Phil
  • Beanie2kBeanie2k Posts: 83
    edited 2008-03-02 22:19
    Well I for one want to thank the people at Imagecraft for taking the time and effort to write a C compiler for the prop. This is a lot of work and money that they could have put into another product. Also I have yet to see any compiler that is perfect regardless of version. If anyone thinks they can do a better job than Imagecraft well.... there is nothing stopping them.

    I do have one question though. I understand that some determinism is lost by going to the LMM but how much? Specifically if I were to run a program like the following:
    #include <anything_missing.h>
    
    int i;
    
    int main(void)
    {
    i = 0;
    
    for(;;)
        {
        outp(ADDRESS, i);
        i++;
        delay(ONE_MS);
        if (i == 0x100)
            {
            i = 0;
            }
        }
    
    return 0;
    }
    
    


    About how much jitter would I see in the output? I am asking because I have a project in the works that reads a serial data stream at a reasonably slow rate (10.4kbps) but has an utterly bizarre waveform which requires close timing accuracy to parse correctly. I realize an accurate number is impossible but a ballpark estimate would be great. Thanks again for the work you are doing for us and I am looking forward to your product.
    Somebody said...

    Post Edited (Beanie2k) : 3/2/2008 10:25:58 PM GMT

  • Jim ColemanJim Coleman Posts: 52
    edited 2008-03-02 23:03
    richard

    It was good to hear from you. I am very encouraged by what you said and look forward to my contribution to your trip to Tahiti. My apologies for being a " gloomy gus " about your effort and henceforth my thoughts will only be directed at meeting you in heaven.

    Jim
  • ImageCraftImageCraft Posts: 348
    edited 2008-03-02 23:39
    Beanie2k said...

    About how much jitter would I see in the output? I am asking because I have a project in the works that reads a serial data stream at a reasonably slow rate (10.4kbps) but has an utterly bizarre waveform which requires close timing accuracy to parse correctly. I realize an accurate number is impossible but a ballpark estimate would be great. Thanks again for the work you are doing for us and I am looking forward to your product.
    Somebody said...

    Thanks for the kind words. Re: timing, the main thing to be careful about is that between releases, the compiler may generate (hopefully better) code or may be the the LMM kernel would be different. In other words, if you care about the precise timing, then measure it and measure it again if you move to a new system.

    Of course you may also change how the algorithm works. In this particular case, perhaps you can use the CNT register, or one of the counter registers for this purpose.
  • Beanie2kBeanie2k Posts: 83
    edited 2008-03-03 02:24
    @Imagecraft

    Yeah I would certainly use a counter or timer in the delay() routine rather than relying on processor speed (I've written too many PC programs to do it that way smile.gif). I was mostly concerned about the overhead of the other lines. But I understand from your response that for a given code segment and compiler release the time will be consistent? In other words if I compiled my example above using Version 1.0 of the compiler I would not see any real-time jitter in the output? That would be great news if true smile.gif .
  • hippyhippy Posts: 1,981
    edited 2008-03-03 02:31
    @ Beanie2k : In terms of jitter ( variations in execution time from one loop to the next ) I wouldn't have expected any. Hitting or missing rdlong fetch 'sweet spots' while getting the LMM instruction to execute will affect execution time but it should be consistent through every loop.
  • acantostegaacantostega Posts: 105
    edited 2008-03-03 02:47
    @PhiPi: regarding computer languages, I think Python scores ++ in all 6 categories. I believe it's a pretty good language for beginners.

    Regarding C vs. Spin, I don't think I'd shell out $ for a C compiler, but I know a lot of people that would. For example, a friend that's in mechanical engineering has a project that requires a microcontroller, but he isn't really interested in learning more than what's necessary to get the job done. Since he already knew C (and barely; no pointers or structs, etc) he's using a PIC16 with a CCS C compiler. He also likes the whole IDE point and click thing. I think most people who'd rather use the C compiler than SPIN/Assembly are like that, and not really that interested in all the optimizations and standard compliance.
Sign In or Register to comment.