Compilation error during array declaration.

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

I got the following errors after compiling a code.

E:\Try\earlier_working>make test_web_client
avr-gcc -g -mmcu=atmega128 -Wall -W -Os -mcall-prologues -o test_web_client.elf -Wl,-Map,test_web_client.map test_web_client.o ip_arp_udp_tcp.o enc28j60.o websrv_help_functions.o dnslkup.o i2cmaster.o
c:/winavr-20100110/bin/../lib/gcc/avr/4.3.3/../../../../avr/lib/avr51\libc.a(log.o): In function `log':
(.text.avr-libc.fplib+0x46): relocation truncated to fit: R_AVR_13_PCREL against symbol `__addsf3' defined in .text section in c:/winavr-20100110/bin/../lib/gcc/avr/4.3.3/avr51\libgcc.a(_addsub_sf.o)
c:/winavr-20100110/bin/../lib/gcc/avr/4.3.3/../../../../avr/lib/avr51\libc.a(log.o): In function `log':
(.text.avr-libc.fplib+0x4e): relocation truncated to fit: R_AVR_13_PCREL against symbol `__addsf3' defined in .text section in c:/winavr-20100110/bin/../lib/gcc/avr/4.3.3/avr51\libgcc.a(_addsub_sf.o)
c:/winavr-20100110/bin/../lib/gcc/avr/4.3.3/../../../../avr/lib/avr51\libc.a(modf.o): In function `modff':
(.text.avr-libc.fplib+0x3e): relocation truncated to fit: R_AVR_13_PCREL against symbol `__subsf3' defined in .text section in c:/winavr-20100110/bin/../lib/gcc/avr/4.3.3/avr51\libgcc.a(_addsub_sf.o)
make: *** [test_web_client.elf] Error 1

The only change which i made was declared an array, which was given as an argument to a function in the main function.

When i comment the array declaration line, this error goes and a simple error of array undeclared is shown.

Can anyone help me to solve the issue.

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

What on earth made you post this but decide to omit the actual code that generates the error?

If you deliberately make it hard for people to help, then why posst at all? :roll:

As of January 15, 2018, Site fix-up work has begun! Now do your part and report any bugs or deficiencies here

No guarantees, but if we don't report problems they won't get much of  a chance to be fixed! Details/discussions at link given just above.

 

"Some questions have no answers."[C Baird] "There comes a point where the spoon-feeding has to stop and the independent thinking has to start." [C Lawson] "There are always ways to disagree, without being disagreeable."[E Weddington] "Words represent concepts. Use the wrong words, communicate the wrong concept." [J Morin] "Persistence only goes so far if you set yourself up for failure." [Kartman]

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

I did the one minute search for "relocation truncated to fit: R_AVR_13_PCREL" (don't forget to tick the option Search for all words). You will find that the usual solution is to:

Add -lm to the linker flags.

(How you do this depends on what build system you use (AVR Studio 4, AVR Studio 5, your own makefile etc etc..).

As of January 15, 2018, Site fix-up work has begun! Now do your part and report any bugs or deficiencies here

No guarantees, but if we don't report problems they won't get much of  a chance to be fixed! Details/discussions at link given just above.

 

"Some questions have no answers."[C Baird] "There comes a point where the spoon-feeding has to stop and the independent thinking has to start." [C Lawson] "There are always ways to disagree, without being disagreeable."[E Weddington] "Words represent concepts. Use the wrong words, communicate the wrong concept." [J Morin] "Persistence only goes so far if you set yourself up for failure." [Kartman]

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

I am using makefile to compile the code.

Actually the code is of a web client on Atmega128 (little modified version of tuxgraphics code).

http://tuxgraphics.com/electroni...

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

OK, so add

-lm

to the options on your linker command in the makefile. For the details, do the search and read a few hits.

As of January 15, 2018, Site fix-up work has begun! Now do your part and report any bugs or deficiencies here

No guarantees, but if we don't report problems they won't get much of  a chance to be fixed! Details/discussions at link given just above.

 

"Some questions have no answers."[C Baird] "There comes a point where the spoon-feeding has to stop and the independent thinking has to start." [C Lawson] "There are always ways to disagree, without being disagreeable."[E Weddington] "Words represent concepts. Use the wrong words, communicate the wrong concept." [J Morin] "Persistence only goes so far if you set yourself up for failure." [Kartman]

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

Quote:
What on earth made you post this but decide to omit the actual code that generates the error?
And why did you post it in the Trading Post forum?

[moved from Trading to GCC]

Regards,
Steve A.

The Board helps those that help themselves.

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

JohanEkdahl wrote:
Add -lm to the linker flags.
That might help, but is no guarantee.

I see that error even with -lm (in avr-gcc testsuite).

BTW, with the compiler output you know what the problem is, the source won't give you any indication...

Problem is explicit RJMP/RCALL in avr-libc that might come out of reach.

avrfreaks does not support Opera. Profile inactive.