Go Down

Topic: Bug in Arduino v1.0.1? (Read 3910 times) previous topic - next topic


When I try to compile a sketch I have written, I get the following error message:

Error compiling.
c:/program files (x86)/arduino-1.0.1/hardware/tools/avr/bin/../lib/gcc/avr/4.3.2/../../../../avr/lib/avr6/crtm2560.o: In function `__vector_default': (.vectors+0xd8): relocation truncated to fit: R_AVR_13_PCREL against symbol `__vector_54' defined in .text.__vector_54 section in core.a(HardwareSerial.cpp.o)

The code I am using contains the following function definition which is where the error is coming from:


boolean parseDelay(String str){
  byte fractions[3] = {48,48,48};
  for(int i = 0; i < 2; i++){
    if(fractions < 48 || fractions > 57){
    else {
      fractions -+ 48;
  temp2 = 10*fractions[0] + fractions[1];
  if(temp2 >15){
  nextEventDelay += temp2;

I am pretty sure this is a bug and not just an error on my part because if I change the length of the fractions array to either 2 or 4 I get no error, and the sketch compiles properly.

I don't know enough to interpret the error message, and haven't found anything in the forum that mentions it, so I thought I would bring it up here.

Has anyone else seen this type of error?


In trying to debug my code, I came across the same error again. This time, with the functions array length at 4, I get the error message, but if I add in a line somewhere that writes a value to the serial monitor, or if I change the array length back to 3, the error goes away again.

Now I'm very confused.



So obviously I forgot my indices on the functions array, and -+ means nothing, so now it is fixed. If I get the error again when my code is free of such bugs, I will re-post.

Peter Vranken

The problem seems to be more than a wrong error message because of a syntax error. I got the same error message during development. So far I've no clue where it comes from and this makes me nerveous. By comparison of a still well compiling and working revision of my project and one which produces this error message I found out that -- in my case -- it depends on the compiler settings. If the only change of -O1 into -Os (optimzation level one to optimization for minimum code size) the project runs and compiles well.

I use a makefile project, where the settings for compiler and linker and the set of compiled C files are taken one by one from the Arduino 1.0.1 IDE (command lines copied from the IDE's output window). My only modifications are enabling of some more output files (linker map file, assembler listings) and adding some more include folders. And for some reasons I tried different optimization levels (resulting in -O1 which made compilation fail).

The code size of the well working compilation with -Os is about 6 or 7 kByte (the value shown by avrdude at download) thus far below the absolute code size maximum of my ATmega2560. There seems to be a more  tricky problem with the linker. Is there a specific section, which must not grow beyond e.g. 8k or something like this?

By the way, getting thisproblem, I wondered in which way the linker would report section exceeded problems and purposely declared a much too large array in RAM, which definitely doesn't fit into my RAM. And got no problem indication from the linker at all! Is it really possible that it doesn't keep track of memory overflow?


Go Up

Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

via Egeo 16
Torino, 10131