ezieragabriel / arduino

Automatically exported from code.google.com/p/arduino
Other
0 stars 0 forks source link

sketches fail to link with R_AVR_13_PCREL due to interrupt service routine too far for startup rjmp in vector #1071

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Write large program on Mega2560 with Arduino IDE 1.0.1 (typically with lots 
of library code)
2. Get unlucky with linker placement of code making interrupt service routine 
too far from location 0.
3. Get link error in the startup code:
"c:/arduino-1.0.1/hardware/tools/avr/bin/../lib/gcc/avr/4.3.2/../../../../avr/li
b/avr6/crtm2560.o: In function `__vector_default': (.vectors+0x5c): relocation 
truncated to fit: R_AVR_13_PCREL against symbol `__vector_23' defined in 
.text.__vector_23 section in core.a(wiring.c.o)"

What is the expected output? What do you see instead?
It should link properly, wiring.c and crtm2560.o haven't been modified and the 
user hasn't done anything wrong.

What version of the Arduino software are you using? On what operating
system?  Which Arduino board are you using?
Arduino 1.0.1 on Windows 7 with Arduino Mega2560 board.

Please provide any additional information below.
Google for "R_AVR_13_PCREL crtm2560" and see others have reported this (and 
mention regressing to Arduino 1.0.0 fixes it).  Since the crtm2560.o appears to 
have "jmp 0", but the compiled elf executable appears to have "rjmp 0 ; nop" 
perhaps this is a linker optimization causing this problem?  I am reporting 
this for a user on freenode IRC #arduino channel, so I cannot post full source 
(and I could see this being hard to replicate as adding or removing "random" 
lines of code can make it crop up or disappear).

Original issue reported on code.google.com by Xarq...@gmail.com on 15 Oct 2012 at 12:12

GoogleCodeExporter commented 9 years ago
I have this problem as well.  I can make the compile error come and go by 
changing the "USB Type:" option from the "Tools" menu OR by commenting out one 
method call.

Original comment by todd.pic...@gmail.com on 26 Oct 2012 at 3:43

GoogleCodeExporter commented 9 years ago
I have this problem as well. Backing out of Arduino IDE versions from 1.0.3 to 
1.0.2 to 1.0.1 back to 1.0.0 shows that the bug was introduced in 1.0.1. It is 
not present in 1.0.0.

Original comment by alasdair...@gmail.com on 15 Jan 2013 at 10:09

GoogleCodeExporter commented 9 years ago
I also have this problem. I am using ATMEL Sudio6 with Visual Micro and Arduino 
1.0.x.
I have this after making changes to some PROGMEM arrays. It is 'fixed' by 
random changes to the arrays, but also caused by random changes to arrays. I 
have literally spent days trying to find the cause and permanent fix.

Original comment by rod...@gmail.com on 29 Jul 2014 at 8:43

GoogleCodeExporter commented 9 years ago
This is a bug of the avr-gcc compiler distributed with the old releases of the 
Arduino IDE.
The compiler has been updated with Arduino IDE 1.5.7 and the bug should be 
solved from that version.

Original comment by c.mag...@arduino.cc on 30 Jul 2014 at 10:05