Error after updating to winAVR 20100110

Last post
7 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

My application compiled and run OK with the WinAVR 20081205, then I update to version 20100110.
I am getting these errors:

Quote:
c:/winavr-20100110/bin/../lib/gcc/avr/4.3.3/../../../../avr/lib/avr6\libc.a(isspace.o): In function `isspace':
(.text.avr-libc+0x2): relocation truncated to fit: R_AVR_13_PCREL against symbol `__ctype_isfalse' defined in .text.avr-libc section in c:/winavr-20100110/bin/../lib/gcc/avr/4.3.3/../../../../avr/lib/avr6\libc.a(cty_isfalse.o)
c:/winavr-20100110/bin/../lib/gcc/avr/4.3.3/../../../../avr/lib/avr6\libc.a(fp_powsodd.o): In function `__fp_powsodd':
(.text.avr-libc.fplib+0x16): relocation truncated to fit: R_AVR_13_PCREL against symbol `__fp_powser' defined in .text.avr-libc.fplib section in c:/winavr-20100110/bin/../lib/gcc/avr/4.3.3/../../../../avr/lib/avr6\libc.a(fp_powser.o)

and some more

Any clue what went wrong?

Thanks.
Teddy

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Now you DID use -relax, right?

JW

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Sorry, I don't know how or where to check or set that -relax option.
Could you please explain it?
Thanks.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

You ned to link with libm.a, that is "-lm" to the linker

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

avr-libc contains RCALL/RJMP instructions to extern functions for devices >= 16K and hopes for the best: that offsets will be small enough to fit into RJMP/RCALL.
However, if there is much code (maybe drawn from avr-libc), offsets can get too big as to fit and the linker truncates them. The resulting code will crash because jump target addresses are incorrect.

Linking against libm might help to get smaller code so that the offsets fit again. But that is not bullet proof, see

http://lists.gnu.org/archive/html/avr-gcc-list/2011-06/msg00022.html

Linker relaxing might help in some corner cases (because, again, it might lead to smaller code and offset fits).

But linker can only relax from JMP/CALL to RJMP/RCALL, not the other way round because increasing code might exceed branch offsets.

avrfreaks does not support Opera. Profile inactive.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Indeed, this has nothing to do with -relax and is result of linker moving the library functions around in a strange, illogical way. Funny, this does not happen with my favourite 2007-vintage WinAVR stuff.

Any reason why does the linker do this?
Any way how to influence this behaviour of linker?

Jan

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Had a really long day looking for an answer to my problem and the -relax tip did it for me, linking with libm.a made no difference. Thanks a lot!!! I just hope the solution lasts as my project grows. If it is of help to anybody I am using AVR Studio 5 and I checked the "Relax Branches (-mrelax)" box under Project>Properties>Toolchain>AVR/GNU C++Linker>Optimization.

Johnny