[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[avr-libc-dev] RE: [bug #24231] AVR Mistakes Value in Register
From: |
Weddington, Eric |
Subject: |
[avr-libc-dev] RE: [bug #24231] AVR Mistakes Value in Register |
Date: |
Tue, 9 Sep 2008 16:44:00 -0600 |
> -----Original Message-----
> From: Chris Troutner [mailto:address@hidden
> Sent: Tuesday, September 09, 2008 3:27 PM
> To: Eric Weddington
> Cc: Weddington, Eric; address@hidden
> Subject: Re: [bug #24231] AVR Mistakes Value in Register
>
> I'm using the latest, 1.6.2 of AVR Libc. As to the rest, I'm
> using whatever comes with the latest 20080610 release of WinAVR.
>
> I've noticed some discrepancy in simulation behavior in AVR
> Studio between the Simulator, Simulator 2, and use of JTAG
> mkII for emulation.
>
> If you set a break point at the "service = 0" line, and then
> go to dissassebly when the simulator reaches that point, you
> should see it call the "STS 0x0100,R1" instruction. Are you
> not seeing it on your machine?
>
> I was able to get around it by using the instruction "service
> &= ~(1<<0)".
>
One thing at a time.
At this point I'm only concerned about the compiler, not the AVR Studio
Simulator 1/2, or JTAG debugging.
I see the instruction in e.g., the .lss file:
//Clear service variable
service = 0;
230: 10 92 00 01 sts 0x0100, r1
What I do *not* see in the assembly is r1 getting set to some other value other
than 0. So I'm still not sure about your claim that this a compiler error.
Are you compiling with -Os and then debugging? If so, then turn of
optimizations by specifying -O0, and then debug.
Can you find in the assembly where r1 gets set to 1?