Forum Menu




 


Log in Problems?
New User? Sign Up!
AVR Freaks Forum Index

Post new topic   Reply to topic
View previous topic Printable version Log in to check your private messages View next topic
Author Message
teddyj50
PostPosted: Jun 17, 2011 - 04:28 AM
Newbie


Joined: Apr 15, 2011
Posts: 13
Location: Sydney, Australia

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
 
 View user's profile Send private message  
Reply with quote Back to top
wek
PostPosted: Jun 17, 2011 - 05:38 AM
Raving lunatic


Joined: Dec 16, 2005
Posts: 3217
Location: Bratislava, Slovakia

Now you DID use -relax, right?


JW
 
 View user's profile Send private message Visit poster's website 
Reply with quote Back to top
teddyj50
PostPosted: Jun 17, 2011 - 12:13 PM
Newbie


Joined: Apr 15, 2011
Posts: 13
Location: Sydney, Australia

Sorry, I don't know how or where to check or set that -relax option.
Could you please explain it?
Thanks.
 
 View user's profile Send private message  
Reply with quote Back to top
clawson
PostPosted: Jun 17, 2011 - 06:24 PM
10k+ Postman


Joined: Jul 18, 2005
Posts: 71137
Location: (using avr-gcc in) Finchingfield, Essex, England

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

_________________
 
 View user's profile Send private message  
Reply with quote Back to top
SprinterSB
PostPosted: Jun 17, 2011 - 07:54 PM
Posting Freak


Joined: Dec 21, 2006
Posts: 1733
Location: Saar-Lor-Lux

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-g ... 00022.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.
 
 View user's profile Send private message Visit poster's website 
Reply with quote Back to top
wek
PostPosted: Jun 18, 2011 - 01:10 PM
Raving lunatic


Joined: Dec 16, 2005
Posts: 3217
Location: Bratislava, Slovakia

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
 
 View user's profile Send private message Visit poster's website 
Reply with quote Back to top
Johnny6
PostPosted: Jan 05, 2012 - 12:46 AM
Newbie


Joined: Jan 04, 2012
Posts: 1


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
 
 View user's profile Send private message  
Reply with quote Back to top
Display posts from previous:     
Jump to:  
All times are GMT + 1 Hour
Post new topic   Reply to topic
View previous topic Printable version Log in to check your private messages View next topic
Powered by PNphpBB2 © 2003-2006 The PNphpBB Group
Credits