[Top][All Lists]

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

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

From: Joerg Desch
Subject: [avr-gcc-list] optimizer removes volatile pin access code. why?
Date: Tue, 27 Oct 2009 12:39:44 +0100

Hello all.

I' using gcc version 4.3.2 (Ubuntu Jaunty) to compile some simple code. The 
makefile is one of these standard AVR makefile. The optimization is set to -Os 

For some historic reasons, I use the following macros:

#ifndef BV
#define BV(bit)                 (1<<(bit))
#ifndef cbi
#define cbi(reg,bit)            reg &= ~(BV(bit))
#ifndef sbi
#define sbi(reg,bit)            reg |= (BV(bit))

So far so good.

In my current sandbox project, I've tried to mark the occurrence of an 
interrupt by setting an "debug pin" high. For now, the ISR is empty.

    // ...

With -Os enables, the setup of the port pin is removed! Without optimization 
the pin toggles as expected.

Why does the compiles removes the pin access code? It shouldn't do this, 
because the SFR pointer are declared volatile. Aren't they?

What's my fault?

Email: Joerg Desch <jd DOT vvd AT web DOT de>

reply via email to

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