[Top][All Lists]

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

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

From: Joerg Wunsch
Subject: Re: [avr-gcc-list] 2 tricky questions
Date: Tue, 17 Jun 2003 12:08:05 +0200 (MET DST)

"Marko Panger AGB Lab" <address@hidden> wrote:

> 1) In fact I would like to call a macro defined in assembler

Well, then do it that way. ;-)  Write a macro that declares some
inline asm.

#define dosomething asm volatile("do something")

> 2) The trick with naked attribute should work, but calling
> "myIntEnter" function puts the return addres onto the stack which is
> not excatly what I want. I should call an inline function, but as I
> read there are some troubles with inline functions in GCC.

You cannot ``call'' an inline function.  Remember, an inline function
is something that is replaced by the compiler verbatim.

> 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.

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.

> 3) I also tried to define a static inline function and it worked
> until the function had about 20 instructions, when I have passed
> this limit the compiler called the function as a normal function.

That's a known issue.  The outcome was, if you don't like this, don't
use inline functions but macros.
J"org Wunsch                                           Unix support engineer
address@hidden        http://www.interface-systems.de/~j/

reply via email to

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