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

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

Re: [avr-gcc-list] RE __attribute__((naked)) isn't doing fine!


From: Julius Luukko
Subject: Re: [avr-gcc-list] RE __attribute__((naked)) isn't doing fine!
Date: Thu, 1 Jul 2004 11:32:37 +0300
User-agent: KMail/1.6.2

On Thursday 01 July 2004 10:50, sebastian meuren wrote:
> but because it's the entry-function (like main), the compiler doesn't have
> to save any registers or so. I haven't thought about the stack-frame yet,
> so that has to be considered (a remark @ avrfreaks.net - forum). But thr
> real problem is loading the arg-pointer to r24/r25 __befor__ any task-code
> gets executed! So I tried to declare the function as naked (no compiler
> prologue!) and wrote my onwn one like "pop r25, pop r24" because my
> stack-entry-frame looks like that: register - return/entry-address - void
> *arg-pointer. 

Hi,

How are your tasks initially called? Couldn't the tasks' contexts (=registers) 
be initialized so that r24,r25 contains the pointer argument and the context 
switch routine "restores" the context before jumping to the first address of 
your task. r24 and r25 would then contain the argument when the task starts. 
No actual C function call is used to call the task. That way your tasks could 
be normal functions without the hassle with naked attribute and two 
functions. This is how it is done e.g. in uC/OS-II.

-- 
D.Sc. Julius Luukko
Laboratory of Control Engineering/Department of Electrical Engineering
Lappeenranta University of Technology, FINLAND
phone:+358-5-621 6713, fax:+358-5-621 6799, www: http://www.ee.lut.fi


reply via email to

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