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

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

Re: [avr-gcc-list] 2 tricky questions


From: Iztok Zupet
Subject: Re: [avr-gcc-list] 2 tricky questions
Date: Tue, 17 Jun 2003 14:54:36 +0200
User-agent: KMail/1.4.3

On Tuesday 17 June 2003 13:33, Marko Panger AGB Lab wrote:
> > #define dosomething asm volatile("do something")

I normally use the above trick, like:
#define high(x) \
 ({unsigned char t;  asm volatile ("lds %0,  (%1+1)" :"=r"(t) :"m"(x)); t;})

>
> By the "user point of view" calling an inline function is the same as
> calling a normal function. The syntax is the same. In fact I was looking
> for this. What does the compiler is another issue. I wanted the syntax of a
> normal function, but implemented as a macro - inline functions.
>
> > > The best soultion would be to replace the interrupt pro/epi
> > > functions with my functions or to call an assembler defined macro.
> >
> > By default, they aren't functions but are generated explicitly within
> > each function.  Are you using -mcall-prologues?  Then you're getting
> > them as functions.
>
> Off course, pro/epi sequences aren't functions. I want to change these
> sequences (use mine), but only for interrupts, not for normal functions.
> So, is it possible to do this ?
>
> > For normal prologue /functions/, yes, they are really getting their
> > return addresses pushed onto the stack.  How else is the function
> > supposed to return to the caller?  You probably don't want a function
> > for this, but your wording is a bit ambiguous here, sorry.
>
> The returning from the interrupt is managed by me. We misunderstood here.
>


BTW, the PROCESSOR iself pushes the return addres to stack when interrupted 
not the GCC!!! That's why it's there in a  _naked_ function.

 If the return from interrupt has to be mingled with, just pop it from stack 
and push another address there  (Like the old PDP11/RSX11 used to do).

Iztok 


reply via email to

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