[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: Thu, 29 Oct 2009 21:44:05 +1100
User-agent: Mutt/1.5.15+20070412 (2007-04-11)

On Wed, Oct 28, 2009 at 11:14:08AM -0700, df_welch wrote:
> I'm mainly an assembly language user and not a heavy weight C user but
> this thread has peaked my interest.

I must admit to having a similar relationship with the AVR, thus far. So
much can be done with macros that it isn't always necessary to use C.

> Basically as shown below in the Data sheet excerpt, a NOP is necessary 
> following a write to DDRB(n), and prior to seeing the change on pin(n).

That sounds very plausible. Having mostly set direction in an .init
section, and then used the port much later, I've not experienced it
though. If Joerg Desch could possibly post the relevant assembler
snippet, either from an objdump or list file, the risk of that could be
seen. A dump would also confirm that the expected instructions are there
at all.

> I'm not sure that this extends to the entire 8 bit family but it might be 
> worth looking at.

ISTR seeing something related in other AVR datasheets, even if only

Placing a few nops between sbi and cbi also makes it easier to see
the output pulse with less sophisticated equipment than Joerg has [1], and
could speed up finding the assembler code snippet if no labels exist
in the vicinity.

[1] I remember doing that on my first AVR project, even at 1MHz, just to
    give it every chance of working the first time.


reply via email to

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