[Top][All Lists]

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

Re: [avr-gcc-list] Re: optimizer removes volatile pin access code. why?

From: Erik Christiansen
Subject: Re: [avr-gcc-list] Re: optimizer removes volatile pin access code. why?
Date: Wed, 28 Oct 2009 23:29:59 +1100
User-agent: Mutt/1.5.15+20070412 (2007-04-11)

On Wed, Oct 28, 2009 at 12:44:48PM +0100, Joerg Desch wrote:
> I've talked to an colleague this morning. He had the same problems with
> WinAVR a few months ago. His solution was adding a asm volatile("nop")
> between cbi() and sbi(). He had to generate a bus timing by software.

When generating output pulses of only a few cpu cycles, I've always
preferred to do it in an asm file, linked in with the rest of the code.
That does cost a function call and return, but the timing cannot be
changed by gcc or command-line option vagaries. (In an embedded system,
protection against experiences like yours is why I don't like to leave
such critical things in the hands of compiler coders. YMMV, however.)


P.S. If this somehow doesn't make it to the list, could you please
     forward it?

reply via email to

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