|
From: | Marko Panger |
Subject: | Re: [avr-gcc-list] GCC guru question (progue/epilogue sequences) |
Date: | Tue, 9 Jul 2002 23:23:34 +0200 |
HI again !
My INT handler looks like
RTOS_INTERRUPT(VECTOR_NUMBER)
/*naked attribute*/
{
uint16_t var1;
/* this is a variable used by the user*/
IntEnter(); /*here I save registers*/
User code
bla...bla;
bla;
bla;
IntExit();
/* here I swap context*/
}
As you can se I am doing a sort of pro/epi by my
own. I should save the entire context in IntEnter() because the user code could
make an another task ready to run, so the context is swapped in IntExit(). Now
the extra code generated by the compiler is redundant and more - it wastes ram (PUSH, POP).
After IntEnter() Y and the SP are the same. My prologue sequence should
be:
in r28, SPL
in r29, SPH
sbiw r28, NUMBER OF BYTES REQUIRED BY USER LOCAL VARIABLES
out SPL, R28
out SPH, R29
-------------------------------------------------------------------------------------
Anyway I have just solved the problem with a little
trick:
RTOS_INTERRUPT(VECTOR_NUMBER)
/*naked attribute*/
{
IntEnter(); /*here I save registers*/
UserFunction();
IntExit();
/* here I swap context*/
} void UserFunction(void);
Thanks for helping me !
Regards,
Marko P.
----- Original Message -----
|
[Prev in Thread] | Current Thread | [Next in Thread] |