avr-gcc-list
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [avr-gcc-list] refactoring to reduce code size


From: Volkmar Dierkes
Subject: Re: [avr-gcc-list] refactoring to reduce code size
Date: Wed, 29 Jan 2003 10:18:51 +0100

Alex,

"Alex Shepherd" <address@hidden> schrieb am 29.01.03 05:36:00:
>
> In an effort to try and find the biggest functions, I have tried looking at
> the list files that the compiler produces

Try a look at avr-sizex. This tool provides you an option to list the n biggest 
functions. Maybe this helps you to get a faster overview. You find this tool on 
the avrfreaks web site:
http://www.avrfreaks.com/phorum/download.php?f=2&file=avr-sizex-03.zip

As I remember, if you look at the % of used flash, it uses the application 
flash with biggest bootloader section. To get it to the whole flash range, you 
have to set the desired option.

> but alas I find them a bit hard to
> follow and after the optimiser has rearranged things I find it hard to
> recognise which does what and wonder if there are any other tools that I can
> use to more easily determine the sizes of functions etc to maybe highlight
> where I should look first. Hopefully I can find some obvious things to free
> up space.
> 
> I would also appreciate any other suggestions about the sorts of things to
> do or avoid doing to generally reduce code size or how others go about
> analysing code on embedded systems to reduce code space.

I have only three hints at this time:
- Try the different optimization levels (-O1, -O2, -O3, -Os) to look which one 
results in the smallest code.
- Don't use float, long if possible.
- Also don't use printf. Even it is easy to use and gives great improvement, it 
needs about 2-2.5KB.

> Having come from coding on bigger machines (PCs) I may well be doing some
> expensive (code size wise) things that I need to change.

Yes, that is a big step from a big machine with (nearly) no problems on 
available ram to an embedded processor.

Volkmar


______________________________________________________________________________
Ihre Freunde sind in Italien? Schicken Sie ihnen trotzdem eine SMS
mit WEB.DE FreeMail http://freemail.web.de/features/?mc=021172

avr-gcc-list at http://avr1.org



reply via email to

[Prev in Thread] Current Thread [Next in Thread]