Thomas Keller wrote: > On Thu, 2005-08-18 at 08:33 +1000, Don Ingram wrote: > >> Also, code efficiency and optimization differ between compilers. An >>Atmel FAE told me that most folks say that GCC-AVR is almost as good >>as IAR (who is the best currently). >>This was what I was lead to believe too, but an example shown here a >>few weeks ago dispelled that myth. If I recall correctly ( & I may >>not ;-) the particular example was the overhead in entering / exiting >>an interrupt ( fading memory.)... The particular example compared the >>overhead between GCC & CVAVR, the difference was substantial. Someone >>more knowledgeable may wish to clarify this. > > > On this specific issue I cannot comment, but I can say that avr-gcc is > quite inefficient in its handling of variables. Every time the compiler > references the value of an identifier, it loads it into r24,r25 (for a > 16 bit int), then transfers it to another register pair before > mainpulation of the value. Wastes execution time as well as memory > space for unnecessary instructions. I noticed that too. I mean, if I declare a variable volatile and make it global I WANT the compiler to treat it as special and not futz about in the ISR. GCC generated what I thought was really sloppy ISR code. But I'm used to PIC C (C18 from Microchip) which allowed you to make fantastically small ISR code. I just want the compiler to save the CCR and current working register and assume that I've taken care of the rest. What resulted was kind of ugly, I guess that I'll have to go in an hand tune that bit... Other that that, I find that GCC-AVR does a pretty good job of code density - I just don't like the variable referencing and sloppy (or perhaps overly hand-holding) job it does with ISR's. DLC -- --------------------------------------------------------------------- * Dennis Clark dlc@frii.com http://www.techtoystoday.com * * "Programming and Customizing the OOPic Microcontroller" Mcgraw-Hill * ---------------------------------------------------------------------
Message
Re: [AVR-Chat] Differences between C compilers
2005-08-18 by Dennis Clark
Attachments
- No local attachments were found for this message.