[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
(size).
For some historic reasons, I use the following macros:
#ifndef BV
#define BV(bit) (1<<(bit))
#endif
#ifndef cbi
#define cbi(reg,bit) reg &= ~(BV(bit))
#endif
#ifndef sbi
#define sbi(reg,bit) reg |= (BV(bit))
#endif
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.
ISR(TIMER2_COMP_vect)
{
sbi(PORTC,6);
// ...
cbi(PORTC,6);
}
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>
- [avr-gcc-list] optimizer removes volatile pin access code. why?,
Joerg Desch <=
- Re: [avr-gcc-list] optimizer removes volatile pin access code. why?, Joerg Wunsch, 2009/10/27
- [avr-gcc-list] Re: optimizer removes volatile pin access code. why?, Joerg Desch, 2009/10/28
- [avr-gcc-list] Re: optimizer removes volatile pin access code. why?, David Brown, 2009/10/28
- [avr-gcc-list] Re: optimizer removes volatile pin access code. why?, Joerg Desch, 2009/10/28
- Re: [avr-gcc-list] Re: optimizer removes volatile pin access code. why?, Erik Christiansen, 2009/10/28
- [avr-gcc-list] Re: optimizer removes volatile pin access code. why?, Joerg Desch, 2009/10/31
- [avr-gcc-list] Re: optimizer removes volatile pin access code. why?, Erik Christiansen, 2009/10/28
- [avr-gcc-list] Re: optimizer removes volatile pin access code. why?, David Brown, 2009/10/28
- RE: [avr-gcc-list] Re: optimizer removes volatile pin access code. why?, Stu Bell, 2009/10/28
- [avr-gcc-list] Re: optimizer removes volatile pin access code. why?, David Brown, 2009/10/29