"Is avr-gcc for avr6 ready to use?" Yes, with warnings. Since gcc insists on the size of a function pointer to be 2 bytes, anything using function pointers must be used with caution. If the function resides in the lower half of flash, the 2 byte pointer works fine.
The problem is when the function resides in upper memory. Then, the 2 byte pointer will point to the wrong place. Note that normal function calls work fine. Avr-gcc has been modified to handle that case, through the use of the linker "trampoline" section. It is just function pointers that give problems. I've been using avr-gcc with the ATmega2560 for over 2 years now. Although I'm picky about how my modules are linked (so the functions that have pointers reside in low flash), the code is successful. I will admit that I would not recommend the avr6 to people with little experience in programming. Best regards, Stu Bell DataPlay (DPHI, Inc.) -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Dmitry K. Sent: Wednesday, April 09, 2008 12:24 AM To: [email protected] Subject: Re: [avr-libc-dev] [bug #22878] eeprom_*_word/dword/block cause hangin ATmega256x Hm... Is avr-gcc for avr6 ready to use? I have try avr-gcc 4.4-20080404 (4.3.0 does not support avr6) with binutils 2.18. In result the small program without any EEPROM usage and without any inline functions gives incorrect code: /* avr-gcc 4.4-20080404 + binutils 2.18 produce incorrect code: the foo4() function stores 0 value to 'vp' variable. Options: -W -Wall -Os -mmcu=atmega2560 */ #define BIGCODE() asm volatile (".rept 30000\n\tnop\n\t.endr") void (* volatile vp) (void); __attribute__((noinline)) void foo1 (void) { BIGCODE(); vp = foo1; } __attribute__((noinline)) void foo2 (void) { BIGCODE(); vp = foo2; } __attribute__((noinline)) void foo3 (void) { BIGCODE(); vp = foo3; } __attribute__((noinline)) void foo4 (void) { BIGCODE(); vp = foo4; } int main () { foo1 (); foo2 (); foo3 (); foo4 (); return 0; } I will see the bug report later. Dmitry. _______________________________________________ AVR-libc-dev mailing list [email protected] http://lists.nongnu.org/mailman/listinfo/avr-libc-dev _______________________________________________ AVR-libc-dev mailing list [email protected] http://lists.nongnu.org/mailman/listinfo/avr-libc-dev
