Solution to PCREL error for avr25/ATTiny84/ATTiny85/ATTiny88.

fungus:
Download WinAVR here, extract the files (it's a zip file)

WinAVR download | SourceForge.net

a) Find the "bin" folder in the extracted files.

b) Find a similar looking folder in your Arduino installation.

Copy all files from (a) to (b).

The only BIN folder I find in the Arduino-1.0.3 dir is in the java folder. is that it?

kculm:
The only BIN folder I find in the Arduino-1.0.3 dir is in the java folder. is that it?

No. You want a folder with the same files in it as winavr's 'bin'.

Mine is: ./arduino-1.0.1/hardware/tools/avr/bin

fungus:

kculm:
The only BIN folder I find in the Arduino-1.0.3 dir is in the java folder. is that it?

No. You want a folder with the same files in it as winavr's 'bin'.

Mine is: ./arduino-1.0.1/hardware/tools/avr/bin

Yep, found it. I was looking in the wrong place. It looks like it works now. Thanks everyone's help.

Worked for me.
Thank you very much.

Cheers Tom. A nice quick fix!

Thank you, thank you, thank you, Tom. The Id patch worked perfectly with Arduino 1.0.4 on Mac os X 10.6.8. Now I can program my attiny85!

Mario

Dear Tom

I'm having the same problems at everybody in this thread but your fix unfortunately hasn't helped. I'm using Arduino Uno and ATtiny85. Here's my error:

c:/program files (x86)/arduino/hardware/tools/avr/bin/../lib/gcc/avr/4.3.2/../../../../avr/bin/ld.exe: inf_mirror.cpp.elf section .text will not fit in region text
c:/program files (x86)/arduino/hardware/tools/avr/bin/../lib/gcc/avr/4.3.2/../../../../avr/bin/ld.exe: region text overflowed by 4440 bytes
c:/program files (x86)/arduino/hardware/tools/avr/bin/../lib/gcc/avr/4.3.2/../../../../avr/lib/avr25/crttn85.o: In function `__vector_default':
(.vectors+0x8): relocation truncated to fit: R_AVR_13_PCREL against symbol `__vector_4' defined in .text.__vector_4 section in core.a(wiring.c.o)
c:/program files (x86)/arduino/hardware/tools/avr/bin/../lib/gcc/avr/4.3.2/../../../../avr/lib/avr25/crttn85.o:(.init9+0x0): relocation truncated to fit: R_AVR_13_PCREL against symbol `main' defined in .text.main section in core.a(main.cpp.o)
c:/program files (x86)/arduino/hardware/tools/avr/bin/../lib/gcc/avr/4.3.2/../../../../avr/lib/avr25/crttn85.o:(.init9+0x2): relocation truncated to fit: R_AVR_13_PCREL against symbol `exit' defined in .fini9 section in c:/program files (x86)/arduino/hardware/tools/avr/bin/../lib/gcc/avr/4.3.2/avr25\libgcc.a(_exit.o)
inf_mirror.cpp.o: In function `__static_initialization_and_destruction_0':
C:\Program Files (x86)\Arduino/inf_mirror.ino:21: relocation truncated to fit: R_AVR_13_PCREL against symbol `Potentiometer::Potentiometer(unsigned char)' defined in .text._ZN13PotentiometerC1Eh section in Potentiometer\Potentiometer.cpp.o
C:\Program Files (x86)\Arduino/inf_mirror.ino:22: relocation truncated to fit: R_AVR_13_PCREL against symbol `Potentiometer::Potentiometer(unsigned char)' defined in .text._ZN13PotentiometerC1Eh section in Potentiometer\Potentiometer.cpp.o
inf_mirror.cpp.o: In function `AllOn()':
C:\Program Files (x86)\Arduino/inf_mirror.ino:1077: relocation truncated to fit: R_AVR_13_PCREL against symbol `digitalWrite' defined in .text.digitalWrite section in core.a(wiring_digital.c.o)
C:\Program Files (x86)\Arduino/inf_mirror.ino:1078: relocation truncated to fit: R_AVR_13_PCREL against symbol `shiftOut' defined in .text.shiftOut section in core.a(wiring_shift.c.o)
C:\Program Files (x86)\Arduino/inf_mirror.ino:1079: relocation truncated to fit: R_AVR_13_PCREL against symbol `shiftOut' defined in .text.shiftOut section in core.a(wiring_shift.c.o)
C:\Program Files (x86)\Arduino/inf_mirror.ino:1080: relocation truncated to fit: R_AVR_13_PCREL against symbol `digitalWrite' defined in .text.digitalWrite section in core.a(wiring_digital.c.o)
C:\Program Files (x86)\Arduino/inf_mirror.ino:1081: relocation truncated to fit: R_AVR_13_PCREL against symbol `delay' defined in .text.delay section in core.a(wiring.c.o)
inf_mirror.cpp.o: In function `Checker()':
C:\Program Files (x86)\Arduino/inf_mirror.ino:47: additional relocation overflows omitted from the output

Here's what I've done to try to fix it:

  1. Followed every step in Tiny85 PCREL error - #2 by Coding_Badly - Microcontrollers - Arduino Forum (I didn't have WinAVR previously so didn't have to replace anything, there was no tools folder)
  2. Downloaded the patch and replaced the ld.exe file in the hardware/tools/avr/avr/bin folder with the one from the patch zip

I definitely got the Windows version, not the Mac one.
I have restarted the IDE.

Let me know if I should post anything else, like my code (really long and essentially irrelevant to this problem if I understand correctly) or boards.txt. Thanks a bunch!

Does anybody have any tips for me? I'm making a birthday present for my little nephew for his party tomorrow and I'll be in quite a pickle if I can't get this sorted. Any help would be greatly appreciated!

icegooner:

  1. Followed every step in Tiny85 PCREL error - #2 by Coding_Badly - Microcontrollers - Arduino Forum (I didn't have WinAVR previously so didn't have to replace anything, there was no tools folder)

If you don't have WinAVR installed, how could you follow every step?

Navigate to this directory...
C:\Program Files (x86)\Arduino\hardware\tools\avr\avr\bin\

Is there a file named ld.exe in that directory?

Is the file dated 12/04/2008 or 3/14/2009?

I just set up Arduino IDE and did everything again according to instructions on a new computer (and there was stuff different between this and the one from before, like when I installed Arduino IDE on the previous one there was no tools directory, but now there was). And the ld.exe file was dated 03/14/2009.

Anyway, I've done everything and things are looking up, but there still one error (related to ld.exe).

e:/arduino in/arduino/hardware/tools/avr/bin/../lib/gcc/avr/4.3.2/../../../../avr/bin/ld.exe: infmirror.cpp.elf section .text will not fit in region text
e:/arduino in/arduino/hardware/tools/avr/bin/../lib/gcc/avr/4.3.2/../../../../avr/bin/ld.exe: region text overflowed by 4440 bytes

I've replaced the old ld.exe (dated 12/04/2008) with the one from the patch (dated 3/14/2009) but now this is the only error I get. Any ideas? :slight_smile:

EDIT: I've just discovered that now I'm just being dumb and I've exceded the ATtiny capacity... :stuck_out_tongue: So I'm all good now, I'll just have to try to shorten the code before the big birthday tomorrow. Thanks a bunch Coding Badly!

You are welcome. I'm glad you are back on track.

Thank you Tom !
My code is compiled perfectly on Attiny85 now !

You're welcome :slight_smile: Glad it works for you.

I have upgraded to latest version of Arduino IDE and again I was both glad and surprised.

Glad: for your solution - thanks Tom

Surprised: How it is possible, that the ld (linker) is not included in distribution already patched. Does anyone know why?

I know I'm resurrecting this post but I wanted to let the community know that I was having the same PCREL error while trying to verify code on an ATTiny85 using IDE 1.0.6 on a late 2014 mac. I downloaded the zip in post #4 and moved it to the mentioned directory, after deleting the old ID file first, and it worked like a charm. thanks for the fix Tom.

Weird that the Arduino team still has not addressed this yet seeing as there are plenty of people using ATTiny85s and the fix seems so simple, must be super busy.

I just updated IDE to 1.0.6 on windows and the problem came back... with 1.0.5 worked wonderfully.
Anyone have noticed the same problem?

ƎR:
I just updated IDE to 1.0.6 on windows and the problem came back... with 1.0.5 worked wonderfully.
Anyone have noticed the same problem?

Probably have to reapply the same fix; I'll bet it overwrote the working version of the compiler tools with the same non-working one the IDE came with.

Wow, I was scratching my head for a couple weeks thinking there was something wrong with my code, till I found this. THANK YOU! We need more people in this world such as yourself.