[Top][All Lists]
[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 15:20:15 -0600 |
Preston Wilson wrote:
> "Stu Bell" wrote:
>
> > 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
> > store r30/r31 if it uses it.
>
> It is the callers responsibility to save r30 and r31 registers if they
> are needed across a function call. At least that is my reading of the
> following FAQ.
>
> http://www.nongnu.org/avr-libc/user-manual/FAQ.html#faq_reg_usage
>
> I admit I do not know what is supposed to happen if an ISR is using a
> call-used register.
>
> -Preston
Up until WinAVR 2008*, the ISR took the monkey to save those registers.
This appears to be a breakdown of the ISR prologue, although I have not
confirmed that yet with a test case.
Best regards,
Stu Bell
DataPlay (DPHI, Inc.)