I am compiling with optimization turned off. I couldn't find where in the assembly that r1 gets assigned the value of one. However, it appeared to me that the compiler expected register r1 to be zero, but when I simulate, it always contains the value of 1 when I get to the breakpoint, before the instruction "STS 0x0100, R1" is executed.
Chris On Tue, Sep 9, 2008 at 3:44 PM, Weddington, Eric <[EMAIL PROTECTED]>wrote: > > > > -----Original Message----- > > From: Chris Troutner [mailto:[EMAIL PROTECTED] > > Sent: Tuesday, September 09, 2008 3:27 PM > > To: Eric Weddington > > Cc: Weddington, Eric; [email protected] > > 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? > > _______________________________________________ AVR-libc-dev mailing list [email protected] http://lists.nongnu.org/mailman/listinfo/avr-libc-dev
