[Top][All Lists]

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

[avr-gcc-list] Reenabling interrupts in epilogue of interrupt function

From: Christian Troedhandl
Subject: [avr-gcc-list] Reenabling interrupts in epilogue of interrupt function
Date: Fri, 23 Aug 2002 12:03:17 +0200 (METDST)

If the following code is compiled with
'avr-gcc -O0 -mmcu=atmega103 -S test.c' (I use version 3.2.0 (20020708)
#include <io.h>

extern void bar(int *i);
void foo() __attribute__ ((interrupt));

void foo()
  int i;

the following epilogue is generated for function foo():

/* epilogue: frame size=2 */
        adiw r28,2
        out __SP_H__,r29
        out __SP_L__,r28
        pop r29
[some pop's deleted]
        pop r18
        pop __tmp_reg__
        out __SREG__,__tmp_reg__
        pop __tmp_reg__
        out __SREG__,__tmp_reg__
        pop __tmp_reg__
        pop __zero_reg__

The problem with this is, that the interrupt is not reenabled after
updating the stack pointer, and so interrupts are blocked for 41
clock ticks, which is not acceptable for our purposes.

Is there a possibility to tell the compiler to insert a 'sei'
instruction after the 'out __SP_H__,r29' instruction, like it is done in
the prologue of the function?


Christian Troedhandl                   mailto:address@hidden
Real-Time Systems Group                     voice:+43 (1) 58801-18224
Vienna University of Technology
A-1040 Wien, Treitlstr. 3/182-1        http://www.vmars.tuwien.ac.at/

avr-gcc-list at http://avr1.org

reply via email to

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