[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [avr-libc-dev] Re: gcc's avr implementation does not appear to be in
From: |
Björn Haase |
Subject: |
Re: [avr-libc-dev] Re: gcc's avr implementation does not appear to be interrupt safe! |
Date: |
Wed, 19 Jan 2005 21:25:26 +0100 |
User-agent: |
KMail/1.7.1 |
Am Mittwoch, 19. Januar 2005 19:07 schrieb E. Weddington:
> Paul Schlie wrote:
> >Hey guys, just to give you a heads up, as there are routines implemented
> >in both avr.c and avr.md that temporarily utilize r1 without disabling
> >interrupts around these sections;
Hi, you are right, that an IRQ may happen at such a situation. IIUC, this
however is handeled by the fact, that avr-gcc assumes all IRQ functions to be
declared with the __signal__ or __interrupt__ attribute. If a function
carries one of these two attributes, the function prologue is generated by
if (interrupt_func_p || signal_func_p)
{
fprintf (file, "\t"
AS1 (push,__zero_reg__) CR_TAB
AS1 (push,__tmp_reg__) CR_TAB
AS2 (in,__tmp_reg__,__SREG__) CR_TAB
AS1 (push,__tmp_reg__) CR_TAB
AS1 (clr,__zero_reg__) "\n");
prologue_size += 5;
}
So, there is no problem as long as your initial interrupt function is carrying
the appropriate attributes.
In my opinion, this solution is far from ideal since this makes IRQ service
routines larger even when R1 is never used. There has a very recent thread on
this topic on one of the avr mailing lists. But I do not see another simple
workaround.
Yours,
Björn