N. Coesel wrote:
----- Original Message ----- From: "Peter Jansen" <[email protected]> To: "Ivan Shcherbakov" <[email protected]>; "GCC for MSP430 - http://mspgcc.sf.net"; <[email protected]>; <[email protected]>
Sent: Wednesday, September 09, 2009 8:52 AM
Subject: Re: [Mspgcc-users] Announcement: MSP430-GCC 4.3.4


Hi Ivan,

Excellent news..

I tested it on a large code base I have, and it makes bigger code that 3.2.3 even with -Os.

For example with the MSP430_169_forweb project from http://www.olimex.com/dev/soft/msp430/MSP430-169LCD.zip

The size with 3.2.3 is

  text       data        bss        dec        hex    filename
  6048        522       1026       7596       1dac    main.elf

With 4.3.4,

  text       data        bss        dec        hex    filename
  8398          4       1542       9944       26d8    main.elf

I have had similar results on the H8 platform. Perhaps its better to concentrate on porting to the latest version of GCC 3.x. The biggest problem in GCC 3.x in general is that the long long (64 bit) type support is broken (can lead to unexpected results).


There are a great many advantages to gcc 4.3 over gcc 3.x, and this is a huge positive step for msp430-gcc.

It is a known issue that gcc 4.x can produce larger code than gcc 3.x in some circumstances, and the effect is particularly noticeable for small devices. One reason is, as Ivan pointed out, inlining of functions that are used only once in a file. The correct handling of this is to either declare the function "static" if it is internal to the file (in which case only the inline version is generated), or "extern" (in which case only the non-inline version is generated).

More generally, gcc 4.x is more aggressive in inlining functions than previous generations. This is because function call overhead is typically a bigger issue than a little extra code size on most of gcc's targets. There are parameters used to tune gcc into getting a balance here, which may not be ideal for small micros. Certainly in the case of avr-gcc, users have found that a few command-line options can make a big difference to the code size. Here are some options that are commonly used with avr-gcc, to try out with msp430-gcc:

--param inline-call-cost=3" (or 2),
"-fno-split-wide-types" and "-fno-inline-small-functions"

mvh.,

David


Reply via email to