[Top][All Lists]

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

[avr-gcc-list] uint8_t SRAM variable for ATmega328p allocated at 0x060 (

From: Kirill Shklovsky
Subject: [avr-gcc-list] uint8_t SRAM variable for ATmega328p allocated at 0x060 (instead of 0x0100) in avr-gcc 4.6.2, 7.3.2
Date: Wed, 17 Apr 2013 20:52:57 -0400

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 (;;) {
        if (latchingFlag==0) {
            LED_PORT ^= 1<<LED_BIT;    // Toggle the LED
            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

Any help would be appreciated.


reply via email to

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