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

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

Re: [avr-gcc-list] incorrect function prolog/epilog?


From: Michal Grégr
Subject: Re: [avr-gcc-list] incorrect function prolog/epilog?
Date: Fri, 01 Sep 2006 16:25:07 +0200 (CEST)

Thanks for reply, I'll post my next comments in appropriate threads. The reason 
I asked is that I have real hw/sw problem, it's not just my curiosity that 
makes me analyze the avr-gcc output. In short, the out instruction to SPL in 
the function epilog overwrites the EIMSK register instead of SPL and my 
suspection is that it is due to invalid processing of that out instruction 
right before an interrupt occurs and if interrupts were enabled after the SPL 
restore it would work correctly.

mike

------------ Původní zpráva ------------
Od: Paulo Marques <address@hidden>
Předmět: Re: [avr-gcc-list] incorrect function prolog/epilog?
Datum: 01.9.2006 13:12:58
----------------------------------------
Michal Grégr wrote:
> [...]
> I think it should restore SREG after both SPH and SPL is updated,
> otherwise an incorrect stack is used if an interrupt occurs between SPH
> and SPL write. Or am I wrong?

This is starting to be a FAQ ;)

Even if there are interrupts pending, the AVR will always execute _one_
more instruction after enabling interrupts before jumping to the
interrupt vector, so that code is safe.

Search the archives for "problem with stack" from June for a similar thread.

--
Paulo Marques
Software Development Department - Grupo PIE, S.A.
Phone: +351 252 290600, Fax: +351 252 290601
Web: www.grupopie.com

"The face of a child can say it all, especially the
mouth part of the face."







reply via email to

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