[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [avr-libc-dev] eeprom_read_byte and clr ret_hi
From: |
Dmitry K. |
Subject: |
Re: [avr-libc-dev] eeprom_read_byte and clr ret_hi |
Date: |
Sun, 22 Nov 2009 17:21:10 +1000 |
User-agent: |
KMail/1.5 |
> > eeprom_read_byte returns a uint8_t. Why does it clear r25?
> > eerd_byte.S:
> > clr ret_hi
> >
> > Does the AVR ABI require that r25 be zeroed in a function returning a
> > single byte? If not, this instruction could be removed.
This is a misty point.
Look an example:
unsigned char foo1 (unsigned char *p)
{
return *p;
}
extern unsigned char ext2 (void);
int foo2 (void)
{
return ext2() + 1;
}
Old Avr-gcc (3.3 - 4.2) are clear R25 in both cases: foo1()
and foo2(). The new Avr-gcc (4.3.3 and 4.4.2) are not
clear R25 in foo1().
Note, the function return value is present only in expression.
So it is promoted to integer. So it would be better to clear
R25 in foo1() only (at one place).
Possibly, it is needed to change eeprom_read_byte() definition
to int return value. This can reduce summary size. Opinions?
Regards,
Dmitry.
- [avr-libc-dev] eeprom_read_byte and clr ret_hi, Shaun Jackman, 2009/11/18
- Re: [avr-libc-dev] eeprom_read_byte and clr ret_hi, Frédéric Nadeau, 2009/11/18
- Re: [avr-libc-dev] eeprom_read_byte and clr ret_hi,
Dmitry K. <=
- RE: [avr-libc-dev] eeprom_read_byte and clr ret_hi, Weddington, Eric, 2009/11/22
- Re: [avr-libc-dev] eeprom_read_byte and clr ret_hi, Dmitry K., 2009/11/22
- [avr-libc-dev] Re: eeprom_read_byte and clr ret_hi, David Brown, 2009/11/23
- RE: [avr-libc-dev] Re: eeprom_read_byte and clr ret_hi, Weddington, Eric, 2009/11/23
- [avr-libc-dev] Re: eeprom_read_byte and clr ret_hi, David Brown, 2009/11/23
- Message not available
- Message not available
- Re: [avr-libc-dev] Re: eeprom_read_byte and clr ret_hi, Wouter van Gulik, 2009/11/24
- Re: [avr-libc-dev] Re: eeprom_read_byte and clr ret_hi, David Brown, 2009/11/24
- Re: [avr-libc-dev] Re: eeprom_read_byte and clr ret_hi, Wouter van Gulik, 2009/11/24