-----Original Message-----
From:
address@hidden
[mailto:address@hidden
org] On Behalf Of Bill Roy
Sent: Friday, January 30, 2009 5:37 PM
To: address@hidden
Subject: Re: [avr-gcc-list] Advice on R_AVR_13_PCREL errors
linkingforTiny85_and_ Mega168?!
Hi, Eric:
Thanks for your kind followup. Here's the state of play as the sun
sets in Denver.
Hey, I'm west of the Springs up at 8500 feet in the mountains. ;-)
Used to live in the mountains west of Denver.
Still puzzled here.
<snip>
firmware bill$ make clean hex
rm -f main.hex main.lst main.obj main.cof main.list main.map
main.eep.hex main.elf *.o usbdrv/*.o main.s usbdrv/oddebug.s usbdrv/
usbdrv.s *.lst
avr-gcc -Wall -Os -DF_CPU=16500000 -Iusbdrv -I. -DDEBUG_LEVEL=0 -
mmcu=attiny85
Ok, stop right there.
It just so happens that a work colleague of mine ran into the very
same issue with R_AVR_13_PCREL and the tiny85. I was finally able to
track it down.
Unfortunately it looks like a bona fide bug in binutils. I have a
patch, that so far seems to fix the problem. I just submitted the
patch upstream.
Basically, the problem stems from the fact that the linker allows
all devices in only the avr2 and avr4 architectures to wrap around
the offsets. Devices in the avr25 architecture should be allowed to
do that too (as avr25 is the same as avr2, plus 2 extra
instructions), but for some reason it looks like the avr25 was
forgotten when it comes to this reloc. It just so happens that the
ATtiny85 belongs to the avr25 architecture. My work colleague
mentions that he doesn't have this problem when he uses an ATmega8
(with the same amount of code space). And that is because the
ATmega8 belongs to the avr4 architecture.
I see you're using a Mac. The patch for binutils is attached.
Feedback on how it works for you would be appreciated. This fix will
be in the next WinAVR release.
Eric Weddington
<41-binutils-2.19-avr25-wraparound-reloc.patch>