[Top][All Lists]

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

Re: [avr-gcc-list] Code space minimazation in avr-gcc

From: Christoph Plattner
Subject: Re: [avr-gcc-list] Code space minimazation in avr-gcc
Date: Mon, 12 Mar 2001 14:01:40 +0100

I also worked hard on this topic.

First of all try to use only few points accessing arrays.
For example I used following:

struct xxx_ 
        aaa_t aaa;
        aaa_t aab;
        bbb_t bbb;
} xxx_t;

xxx_t xxx_array [ XXX_NUM ];

xxx_t * __xxx (int id)
    /*  no checks in ID are done.
        you can add them.
        On the other hand, using xxx_array [id] directly,
        also no checks are used
   return xxx_array [ XXX_NUM ];

In the body of other function I access the array structrue
        __xxx (k)->aaa = x;

If the array is often use, then you can spare much memory
in this way (FLASH !)

Further there is a compiler switch
using common prolog/epilog sequences to spare space.

If you really want hard to save some bytes you can also use
-mint8 only using 8 instead of 16bit basic values. This saves
space on every "return" as the basic return value is always 
casted on the base of the basic type (16bit). But not all of the
libc stuff can handle this (setjump/longjump).

I hope I could help ...

With friendly regards

Robert Rozman wrote:
> Hello,
> I'd like to hear some general hints from avr-gcc experts how to minimize
> code space of a program. Obviously this could become a general problem,
> since AVR products aren't growing so fast with program memory space.
> Thanks in advance,
> Robert Rozman
> _______________________________________________
> avr-gcc-list mailing list
> address@hidden
> http://avr.jpk.co.nz/mailman/listinfo/avr-gcc-list

  +--------V--------+   address@hidden
  |  A L C A T E L  |   -----------------------------
  +-----------------+   Phone: +43 1 27722 3706 
         T A S          Fax:   +43 1 27722 3955

reply via email to

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