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

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

RE: [avr-gcc-list] ATmega2560 and r30/31 save in function prologue


From: Stu Bell
Subject: RE: [avr-gcc-list] ATmega2560 and r30/31 save in function prologue
Date: Fri, 2 May 2008 16:23:10 -0600

I have chased this down.  The problem occurs on any processor (okay, I
checked the m128 and m2560 and it occurred on both - YMMV).

If you have an ISR that calls a function, but that function is defined
in a different compile module (file.c), the compiler will not save the
"call-used" registers.  In my case, this means r30 and r31.

Interestingly enough, if the called function is in the same compile
module (file.c), then the call-used registers *are* saved in the ISR!

This appears to have changed as of WinAVR 2008*.

I have attached (I hope) a zip file of my test.  The file test5.c
contains the all-in-one compile that works.  The file test5.bad.c
contains just the references to serial.h, which refers to queue.h.  You
need to tweak the Makefile to make the associated files.

I'm sending it here because I can't figure out to how to submit an
AVR-GCC bug.  I can do the AVR-LIBC stuff no problem.  I'm sending this
to myself at home so I can log it this evening or tomorrow.

Caveat emptor!

Best regards, 

Stu Bell 
DataPlay (DPHI, Inc.) 


-----Original Message-----
From: address@hidden
[mailto:address@hidden On Behalf Of
Stu Bell
Sent: Friday, May 02, 2008 1:24 PM
To: avr-GCC
Subject: [avr-gcc-list] ATmega2560 and r30/31 save in function prologue

Hi all,

I'm chasing down a problem with WinAVR 20080430 and my ATmega2560 code.
In generated code comparisons of an ISR between 20071221 and 20080430, I
noticed that r30 and r31 are not saved on the stack.  Normally, this
wouldn't be a problem as the ISR itself does not use r30/r31.

However, this ISR calls a function that does use r30/r31.  Again, it
*should* be no problem, since the function has the responsibility to
stor r30/r31 if it uses it....

Attachment: test5.zip
Description: test5.zip


reply via email to

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