relocation truncated Arduino Bug

I’ve been using the Arduino Mega 2560 recently for my robotics project and after getting a fair way through some code I found that I started to receive this error:

relocation truncated to fit: R_AVR_13_PCREL

It turns out there is a bug in the arduino IDE or at least the compiler it uses. The solution was to Download the Beta Arduino IDE which has the bug fixed in it.

That fixed it for me. Happy tinkering.

 

For anyone that is interested: I think that the bug was due to a compiler flag or config error which disabled the option for the compiler to use long jumps. So as your code grows you gradually fill more memory and the device cannot use its short (more efficient) jump instructions to move around memory as you have now used more than 4kB which I believe is the limit of the short jump instruction on those chips.

Leave a Reply

Your email address will not be published. Required fields are marked *