uint8_t SRAM variable for ATmega328p allocated at 0x060 (instead of 0x0100) in avr-gcc 4.6.2, 7.3.2

Kirill Shklovsky <[email protected]>
Newsgroups gmane.comp.hardware.avr.gcc
Message-ID <CABhZC8OQYGTO5-TiCTizh+99ZS320V=SnO0PYesQtFukTp7CWw@mail.gmail.com>
Dear avr-gcc-ers:

It appears that a global SRAM uint8_t variable is placed at address
0x060 by avr-gcc versions 4.6.2 and 7.3.2. The avr-gcc compiler was
compiled on cygwin. For example, given the followign AVR cpp code:

volatile uint8_t latchingFlag;

int main() {

    LED_PORT &= ~(1<<LED_BIT);
    DDRD = 0xFF;
    for (;;) {
        latchingFlag=1;
        if (latchingFlag==0) {
            LED_PORT ^= 1<<LED_BIT;    // Toggle the LED
            _delay_ms(100);
            latchingFlag = 1;
        }
    }
}

The disassembly for the conditional looks as follows:

        if (latchingFlag==0) {
  a0:    80 91 60 00     lds    r24, 0x0060
  a4:    81 11           cpse    r24, r1
  a6:    fa cf           rjmp    .-12         ; 0x9c <main+0xc>

At the same time, compiling this on avr-gcc 4.7.0 on Ubuntu I get:

lds r24, 0x0100

Presumably 0x0100 is correct, since on ATmega 0x0060 is actually
mapped to the WDTCSR register, if I understand it correctly.  Is this
a problem with the way I built avr-gcc or is this not an avr-gcc
issue?

Any help would be appreciated.

Kirill
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.