[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: [avr-gcc-list] WINAVR with GCC 4.3.3
From: |
Stu Bell |
Subject: |
RE: [avr-gcc-list] WINAVR with GCC 4.3.3 |
Date: |
Mon, 22 Jun 2009 12:13:09 -0600 |
> I have a project built around a Tiny26.
>
> [blah blah blah code bloat blah blah blah Imagine my shock blah blah
blah redesign my current Tiny2313 /
Tiny26 projects around a Mega128 blah blah blah]
This is old news. Without going into the reasons why it happens, the
following are some tips I picked up from several postings on this
subject:
------------------------------------------------------------------------
---------------
> On inspection I find that the compiler has 'in-lined' at least 3
> function calls that I had written as a function to achieve
compactness.
> Is there any way I can stop this, or is this a bug?
There has been some discussions about this before. After trying many
different optimization settings I concluded that
--param inline-call-cost=2
is -overall- the best setting for small projects. However, if you need
to minimize just one app, further reduction might be possible.
For example with things like:
-fno-inline-small-functions
-fno-split-wide-types
-fno-tree-scev-cprop
Also, you can prohibit the compiler to inline on a function by function
basis.
Just to be sure you have no dead code around, include:
-ffunction-sections -Wl,--gc-sections -Wl,--relax
Ruud Vlaming
---------------------
add "OS_main" attribute to main function,
and (for an ATTiny) use the compiler switch:
-mtiny-stack
Anatoly Sokolov
---------------------
Also you can use the gcc options:
-combine
-fwhole-program
To use the options, you must compile all of your source with one call to
the compiler:
avr-gcc ... -combine -fwhole-program ... main.c foo.c grunge.c
gort.c mylib.c ...
Best regards,
Stu Bell
DataPlay (DPHI, Inc.)