avr-libc-dev
[Top][All Lists]
Advanced

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

[avr-libc-dev] [bug #31768] Difference in address between using a direct


From: Lourens
Subject: [avr-libc-dev] [bug #31768] Difference in address between using a direct var or through a struct
Date: Thu, 25 Nov 2010 20:14:08 +0000
User-agent: Mozilla/5.0 (X11; U; Linux i686 (x86_64); nl; rv:1.9.2.12) Gecko/20101026 Firefox/3.6.12

URL:
  <http://savannah.nongnu.org/bugs/?31768>

                 Summary: Difference in address between using a direct var or
through a struct
                 Project: AVR C Runtime Library
            Submitted by: lourens
            Submitted on: Thu 25 Nov 2010 08:14:07 PM GMT
                Category: Library
                Severity: 3 - Normal
                Priority: 5 - Normal
              Item Group: None
                  Status: None
        Percent Complete: 0%
             Assigned to: None
             Open/Closed: Open
         Discussion Lock: Any
                 Release: 1.6.8
           Fixed Release: None

    _______________________________________________________

Details:

When I compile this code:
  ADCA.CH0.MUXCTRL = ADC_CH_MUXPOS_PIN0_gc;
The assembler result is:
 204: e0 e0         ldi r30, 0x00 ; 0
 206: f2 e0         ldi r31, 0x02 ; 2
 208: 13 8e         std Z+27, r1  ; 0x1b

And with this code:
  ADCA_CH0_MUXCTRL = ADC_CH_MUXPOS_PIN0_gc;
The result is:
 204: e1 e2         ldi r30, 0x21 ; 33
 206: f2 e0         ldi r31, 0x02 ; 2
 208: 10 82         st  Z, r1

Although I don't care about the difference in using st or std, the problem is
that the accessed addresses are different. The last one seems right as it
works while the first one isn't. I checked through the header files and
compared them with the datasheet. At first sight I don't see a problem there,
so maybe it is the compiler doing something incompatible?

My version of avr-libc is 1.6.8 and avr-gcc is 4.3.4.

The command was:
  avr-gcc -mmcu=atxmega64d3 -Wall -W -Wcast-align -Wcast-qual -Wimplicit
-Wpointer-arith -Wswitch -Wredundant-decls -Wreturn-type -Wshadow -Wno-unused
-Wstrict-prototypes -Wnested-externs -g -I. -DCPU_FREQ=10000000UL
-DF_CPU=CPU_FREQ -c main.c -o obj/main.o





    _______________________________________________________

Reply to this item at:

  <http://savannah.nongnu.org/bugs/?31768>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.nongnu.org/




reply via email to

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