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

[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: Wed, 10 Jul 2002 16:41:36 +0200

Hi,

Yes my kernel is a full preemptive-mulititasking one. It is written in C and
only a part wich is processor specific is written in assembly code. It is very
easy to port and it will be open source.

Primary it is planned for ARM cores but I am using AVR now just for testing,
but it runs stable and very quick on AVR too.

(To Robert:
I don't like ucos-ii bacause of the way the kernel works. Also the interrupt
rutines can't be written in C if I remember well. Correct me if I am wrong.)

I plan to finsih(hehhe..hope so) my work on september.

Some of the features:
semaphores with timeout
mailboxes w/ timeout
user defined events w/ timeout
timer manager(task delay,user defined SW timers, timer delayed call-back
functions,...)
fifo buffers manager
interrupts
basic memory managment
and maybe more....

Anyway thanks you all. Finnaly I solved my problem in the same way as Larry
did. In the ISR I call the ISR handler function wich build its stack frame.

Regards,
Marko P.

----- Original Message -----
Sent: Tuesday, July 09, 2002 11:35 PM
Subject: RE: [avr-gcc-list] GCC guru question (progue/epilogue sequences)

Hey,
 
will your rtos be kind of free? perhaps open-source?
I'd volunteer to test, if you like or need people to
 
I'm primarily using the atmega128 devices.
 
How is your arm7tdmi rtos going on?
 
/Marc
-----Original Message-----
From: address@hidden [mailto:address@hidden]On Behalf Of Marko Panger
Sent: Tuesday, July 09, 2002 11:24 PM
To: address@hidden
Cc: AVR Mailing List
Subject: Re: [avr-gcc-list] GCC guru question (progue/epilogue sequences)

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 -----
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...
 
/Marc
-----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]