avr-libc-dev
[Top][All Lists]
Advanced

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

Re: [avr-libc-dev] Inline assembler and compiler optimization


From: Joerg Wunsch
Subject: Re: [avr-libc-dev] Inline assembler and compiler optimization
Date: Mon, 23 Mar 2009 20:40:42 +0100
User-agent: Mutt/1.5.11

As Weddington, Eric wrote:

> If we do that, we might as well make it a public symbol, yes?:
> #define memory_barrier()  __asm__ __volatile__(""::"memory")

I hesitate to add stuff like that to existing header files.
memory_barrier belongs into the application namespace, so existing
applications could legitimately already use that name (and are likely
doing it in case they really need the functionality).

Would you like _MEMORY_BARRIER() more?  That's in the implementation
namespace.

Likewise, the same goes for using nop(), as tempting as it is.  Again,
_NOP() would be fine, as will __nop().

An alternative is to start a new header file for it, so users who want
these definitions can "opt-in" them.

Another definition that just came to mind: setting the JTD bit, a
timed sequence.  See here:

http://www.avrfreaks.net/index.php?name=PNphpBB2&file=viewtopic&p=553919#553836

for a sample implementation.  I wouldn't see any of the existing
header files where that really fits.  (It needs to be polished up, I
think some controllers use MCUCR, and some use MCUCSR for JTD.)


If we decide for a new header file, how to name it?  <avr/asm.h>?
<avr/misc.h>?

-- 
cheers, J"org               .-.-.   --... ...--   -.. .  DL8DTL

http://www.sax.de/~joerg/                        NIC: JW11-RIPE
Never trust an operating system you don't have sources for. ;-)




reply via email to

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