[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: [avr-gcc-list] Advice on R_AVR_13_PCREL errors linkingforTiny85_and_
From: |
Weddington, Eric |
Subject: |
RE: [avr-gcc-list] Advice on R_AVR_13_PCREL errors linkingforTiny85_and_ Mega168?! |
Date: |
Fri, 30 Jan 2009 18:01:38 -0700 |
> -----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
begin 666 41-binutils-2.19-avr25-wraparound-reloc.patch
M+2TM(&)F9"]E;&8S,BUA=G(N8RYO;&0),C P.2TP,2TS," Q-#HT,3HT,2XP
M,3(X,S,T,# @+3 W,# **RLK(&)F9"]E;&8S,BUA=G(N8PDR,# Y+3 Q+3,P
M(#$T.C0S.C$Y+C<R,38T,S<P," M,#<P, I 0" M.#4T+#$P("LX-30L,3$@
M0$ @879R7V9I;F%L7VQI;FM?<F5L;V-A=&address@hidden')E;&]C7VAO=W1O7W1Y< H@
M"7L*(" @(" @(" @(" O*B!296QA=&EV92!D:7-T86YC92!I<R!T;V\@;&%R
M9V4N(" J+PH@"BT)(" O*B!!;'=A>7,@87!P;'address@hidden)!4$%23U5.1"!F;W(@
M879R,B!A;address@hidden"X@("HO"BL)(" O*B!!;'=A>7,@87!P;'address@hidden)!4$%2
M3U5.1"!F;W(@879R,address@hidden,C4L(&%N9"!A=G(T+B @*B\*( D@('-W:71C
M:" H8F9D7V=E=%]M86-H("AI;G!U=%]B9F0I*0H@"2 @("!["B )(" @(&-A
M<address@hidden,CH**PD@(" @8V%S92!B9F1?;6%C:%]A=G(R-3H*
K( D@(" @8V%S92!B9F1?;6%C:%]A=G(address@hidden@"2 @(" @(&)R96%K.PH@"@``
`
end