avr-gcc-list
[Top][All Lists]
Advanced

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

[avr-gcc-list] Gcc bug??


From: Brian Cuthie
Subject: [avr-gcc-list] Gcc bug??
Date: Tue, 2 Mar 2004 20:09:18 -0500

I'm having some problems with an app that uses AvrX and gcc (v. 3.3.1) on an
ATmega16. In the interrupt routine for the TWI  I write a static with a code
that indicates its current state. In an effort to debug a different problem
I compiled the code without any optimization. 

While I did discover the original problem I had been hunting, I started to
see some very unreliable behavior with the TWI. After some investigation I
determined that the state variable (mentioned above) was getting written
with an unreasonable value (not a valid state). The correct state value that
should have been written into the variable is "0". Further experiments
revealed that memory corruption (at least directly into the variable's
memory location) was not the problem. 

What I then determined is that the "0" register (r1) contained the value 8!
This, not coincidentally (and looking at the disassembled code) is exactly
the value that's being incorrectly written into the static state variable.
Interestingly, turning on any level of optimization seems to fix it, at
least as observed by the TWI port handler not hanging.

I was wondering if anyone else has seen anything like this, or has any
advice or suggestions.

Thanks

-brian
_______________________________________________
avr-gcc-list mailing list
address@hidden
http://www.avr1.org/mailman/listinfo/avr-gcc-list


reply via email to

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