Go Down

Topic: Eclipse integration (Read 3462 times) previous topic - next topic

Aeturnalus

Nov 21, 2010, 12:09 am Last Edit: Nov 21, 2010, 02:06 am by rbtying Reason: 1
Hey all,
    Following the playground tutorial on eclipse works except when using a HardwareSerial object - if it is included, this error shows up:
Code: [Select]
Description      Resource      Path      Location      Type
make: *** [BlinkenLights.elf] Error 1      A2PI            line 0      C/C++ Problem
relocation truncated to fit: R_AVR_13_PCREL against symbol `__addsf3' defined in .text section in /usr/lib/gcc/avr/4.3.5/avr51/libgcc.a(_addsub_sf.o)      A2PI            line 94, external location: /usr/lib/avr/lib/libm/fplib/log.S      C/C++ Problem
relocation truncated to fit: R_AVR_13_PCREL against symbol `__addsf3' defined in .text section in /usr/lib/gcc/avr/4.3.5/avr51/libgcc.a(_addsub_sf.o)      A2PI            line 98, external location: /usr/lib/avr/lib/libm/fplib/log.S      C/C++ Problem
relocation truncated to fit: R_AVR_13_PCREL against symbol `__divsf3' defined in .text section in /usr/lib/gcc/avr/4.3.5/avr51/libgcc.a(_div_sf.o)      A2PI            line 50, external location: /usr/lib/avr/lib/libm/fplib/inverse.S      C/C++ Problem
relocation truncated to fit: R_AVR_13_PCREL against symbol `__floatsisf' defined in .text section in /usr/lib/gcc/avr/4.3.5/avr51/libgcc.a(_si_to_sf.o)      A2PI            line 114, external location: /usr/lib/avr/lib/libm/fplib/log.S      C/C++ Problem
relocation truncated to fit: R_AVR_13_PCREL against symbol `__mulsf3' defined in .text section in /usr/lib/gcc/avr/4.3.5/avr51/libgcc.a(_mul_sf.o)      A2PI            line 212, external location: /usr/lib/avr/lib/libm/fplib/pow.S      C/C++ Problem
relocation truncated to fit: R_AVR_13_PCREL against symbol `__subsf3' defined in .text section in /usr/lib/gcc/avr/4.3.5/avr51/libgcc.a(_addsub_sf.o)      A2PI            line 88, external location: /usr/lib/avr/lib/libm/fplib/modf.S      C/C++ Problem


This problem does not occur when Serial.println and Serial.print are commented out.  Serial.begin does not seem to trigger the error.  

The Eclipse workspace is here: http://s.tpmo.im/error-eclipse.tar.gz

Host OS: Ubuntu 10.10 (linux)
IDE: Eclipse
Device: Arduino Mega (ATMega1280)

Has anyone else had this error before?  

--edit-- problem appears to be on libm.a... and only on SOME floating point operations.

Andy Brown

Try modifying the linker "Command line pattern" in (C/C++ Build -> Settings -> AVR C++ Linker) to look like this:

${COMMAND}  -lc -lm ${FLAGS} ${OUTPUT_FLAG}${OUTPUT_PREFIX}${OUTPUT}  ${INPUTS}  -lc

This should convince the linker to get math functions from libc and not libgcc. Apparently there is some bad code in the libgcc math functions that assumes all inter-library jumps are reachable with an RJMP when in fact the linker can put functions anywhere in .text that it feels fit.

The above workaround works for me.
Home of the Nokia QVGA TFT LCD hacks: http://andybrown.me.uk

Aeturnalus

Thanks! That worked for me, too.  Kind of a lame error =(.

Go Up