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

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

Re: [avr-gcc-list] Urgent Queries about AVR-GCC


From: Joerg Wunsch
Subject: Re: [avr-gcc-list] Urgent Queries about AVR-GCC
Date: Tue, 3 Jun 2003 12:12:57 +0200 (MET DST)

"Suresh B Joshi" <address@hidden> wrote:

> (1) Any function whose return value is only 8 bits
>     (i.e. unsigned char), the GCC-AVR compiler still
>     clears the R25 register using eor R25,R25 instruction.

This is a documented feature.

See
http://savannah.nongnu.org/download/avr-libc/doc/avr-libc-user-manual/FAQ.html#faq_reg_usage
(last paragraph).

> (2) When using the switch statement, even if the control
>     expression is an unsigned char variable, it is promoted
>     to 16 bit unsigned int, by eor R25,R25 instruction.

IMHO, this is required by the C standard.  Also, you quote enums as an
example, they are (unfortunately) always equivalent to type "int".

Using -mint8 should avoid it, but almost completely prevents the
generated code from being compatible with avr-libc anymore (and it
violates the C standard, anyway).

> (3) When calling functions within same source files, the
>     use of "call" instruction need not be employed for
>     AVR processors with memory higher than 8K bytes.

The code generator would need to ensure that no single source file
could generate more than 8 KB of code then.  A single source file does
not automatically guarantee any specific code size limit.

Perhaps the code generator could make an ``educated guess'' for which
call/jump targets would safely be within the rjmp/rcall limits.  That
might sound like a worthwhile optimization to me (but i have no clues
about whether that's doable inside gcc).
-- 
J"org Wunsch                                           Unix support engineer
address@hidden        http://www.interface-systems.de/~j/


reply via email to

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