[Top][All Lists]

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

Re: [avr-gcc-list] GCC guru question (progue/epilogue sequences)

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;
    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
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*/
    IntExit();        /* here I    swap context*/
void UserFunction(void);
Thanks for helping me !
Marko P.
----- Original Message -----
Sent: Tuesday, July 09, 2002 11:05 PM
Subject: RE: [avr-gcc-list] GCC guru question (progue/epilogue sequences)

Did you had a look at ethernut? Something very useful is already there. This project
looks always for contributors.
To your question:
if an interrupt occurs your kernel has no chance to save any registers. so the pro/epilogue is very helpful.
your kernel will be interrupted and it is not clear -- when.
Look at the ethernut-way: it uses a kind of wrapper for any possible interrupt source available.
and if you attach an real interrupt-handler to it, it will be called.
Hopefully I understand your question right...
-----Original Message-----
From: address@hidden [mailto:address@hiddenOn Behalf Of Marko Panger
Sent: Tuesday, July 09, 2002 10:56 PM
To: AVR Mailing List
Subject: [avr-gcc-list] GCC guru question (progue/epilogue sequences)

Hi all !!
I realy hope somebody could answer the following question. I will try to explain the situation and my problem.
So... I am writting a RTOS and I would like to have interrupt handlers written in C language. If I define a function as a INTERRUPT or SIGNAL the compiler generates the prologue/epilogue sequence automaticaly. But I don't need this. Registers saving an restoring is managed by my kernel.
There is another possibility. I could decalre the interrupt function with NAKED attribute. This would be fine for me since the compiler doesn't generate the prologue/epilogue sequence. But here comes the problem. What will happen if I decalare some local variables wich are putted on the stack ?
I was wondering if is possible to write my own pro/epi sequences ? How will I now how many variables are putted onto the stack ?

reply via email to

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