Comparing different AVR complier considering size of space.

Started by rahmatoolah abedini August 24, 2010
Hi
Do you have any experience for comparing the value of compiled program if
different compiler such as Codevision ,WINAVR or AVRGCC, when you select the
compiler for optimizing in size.
 In other word I write a program that the needed flash space is a little more
than the flash space of my microcontroller, when I compile it with
codevision with optimizing in size model, and I don’t want to change my
microcontroller.
Best regards
ALi




If you are concerned about size, write in assembler.

With all the assembly languages I've used (Z-80, 8051, 8085, MC6800, PIC,
AVR, etc.) I have always learned some tricks that made the program much
shorter. I know some of the higher-level languages will ALMOST achieve the
smaller sizes you can accomplish with assembler, but not quite.

Zack

On Tue, Aug 24, 2010 at 8:48 AM, rahmatoolah abedini
wrote:

> Hi
> Do you have any experience for comparing the value of compiled program if
> different compiler such as Codevision ,WINAVR or AVRGCC, when you select
> the
> compiler for optimizing in size.
> In other word I write a program that the needed flash space is a little
> more
> than the flash space of my microcontroller, when I compile it with
> codevision with optimizing in size model, and I dont want to change my
> microcontroller.
> Best regards
> ALi
>
>
>
>
>


On Tue, Aug 24, 2010 at 06:48:38AM -0700, rahmatoolah abedini wrote:
> Hi
> Do you have any experience for comparing the value of compiled program if
> different compiler such as Codevision ,WINAVR or AVRGCC, when you select the
> compiler for optimizing in size.
> ? In other word I write a program that the needed flash space is a little more
> than the flash space of my microcontroller, when I compile it with
> codevision? with optimizing in size model, and I don???t want to change my
> microcontroller.

If you currently have CodeVision and the code size is too big then
download WinAVR and try it. The only thing that matters is what it does
for you and for your code.

However, if your code is that big then perhaps you need to write smaller
code rather than expect the tools to do it for you. A good way to
accomplish this is to eliminate printf() and all stdio functions.

--
David Kelly N4HHE, d...@HiWAAY.net
=======================================================================Whom computers would destroy, they must first drive mad.
On Tue, Aug 24, 2010 at 09:21:13AM -0500, Zack Widup wrote:
> If you are concerned about size, write in assembler.
>
> With all the assembly languages I've used (Z-80, 8051, 8085, MC6800,
> PIC, AVR, etc.) I have always learned some tricks that made the
> program much shorter. I know some of the higher-level languages will
> ALMOST achieve the smaller sizes you can accomplish with assembler,
> but not quite.

Once Upon A Time I found a couple of hand-coded assembly routines in
avr-libc that were something like 12 bytes each but my C versions were
only 11! So there! :-)

--
David Kelly N4HHE, d...@HiWAAY.net
=======================================================================Whom computers would destroy, they must first drive mad.
No doubt it happens now and then!
:-)

Zack

On Tue, Aug 24, 2010 at 12:11 PM, David Kelly wrote:

> On Tue, Aug 24, 2010 at 09:21:13AM -0500, Zack Widup wrote:
> > If you are concerned about size, write in assembler.
> >
> > With all the assembly languages I've used (Z-80, 8051, 8085, MC6800,
> > PIC, AVR, etc.) I have always learned some tricks that made the
> > program much shorter. I know some of the higher-level languages will
> > ALMOST achieve the smaller sizes you can accomplish with assembler,
> > but not quite.
>
> Once Upon A Time I found a couple of hand-coded assembly routines in
> avr-libc that were something like 12 bytes each but my C versions were
> only 11! So there! :-)
> --
> David Kelly N4HHE, d...@HiWAAY.net
> =======================================================================> Whom computers would destroy, they must first drive mad.
>


2010/8/24 David Kelly

>
> On Tue, Aug 24, 2010 at 09:21:13AM -0500, Zack Widup wrote:
> > If you are concerned about size, write in assembler.
> >
> > With all the assembly languages I've used (Z-80, 8051, 8085, MC6800,
> > PIC, AVR, etc.) I have always learned some tricks that made the
> > program much shorter. I know some of the higher-level languages will
> > ALMOST achieve the smaller sizes you can accomplish with assembler,
> > but not quite.
>
> Once Upon A Time I found a couple of hand-coded assembly routines in
> avr-libc that were something like 12 bytes each but my C versions were
> only 11! So there! :-)
>

That isn't possible since any AVR instructions takes at least 2 bytes (asm
guys should know this) ;)

Jan


On Aug 24, 2010, at 12:50 PM, Jan Tichavskwrote:

> 2010/8/24 David Kelly
>>
>> Once Upon A Time I found a couple of hand-coded assembly routines in
>> avr-libc that were something like 12 bytes each but my C versions were
>> only 11! So there! :-)
>
> That isn't possible since any AVR instructions takes at least 2 bytes (asm
> guys should know this) ;)

"Something like" is close enough to 1 or 2 bytes. This is what I said in February:
http://tech.dir.groups.yahoo.com/group/avrclub/message/2713

I no longer have access to that source code but it involved EEPROM access and CPU was an ATmega64. Compiler would have been avr-gcc 3-something. Whatever was current in 2005.

--
David Kelly N4HHE, d...@HiWAAY.net