On Apr 16, 2006, at 1:24 PM, John Regehr wrote:

I seem to be running afoul of a bug in the avr-gcc that is packaged up
with avr-gcc-3.4.3-1.i386.rpm. The bug is nasty and results in indirect
calls to neverneverland.

...

The problem occurs when the Z register is loaded with the address of
foo().  In the buggy (-Os) version, the literal address of foo() is
loaded.  This is wrong because the Atmega128 PC addresses 16-bit
locations, in order to reach all 2^17 bytes of flash.  In the correct
(-O) version, Z is loaded with 1/2 of the address of foo().

I'll demonstrate my lack of knowledge of avr codegen and ask a clueless question: Does this ever happen in standard calls, or is it only when you load an address from memory? That is, if you follow the TinyOS guideline of not using function pointers, will you ever encounter this? I assume that 1.x can tickle the bug due to the task queue, but 2.x uses static binding, so would be safe, right?

Phil
_______________________________________________
Tinyos-help mailing list
[email protected]
https://mail.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help

Reply via email to