Re: Unable to link using libm.a and libc.a
Rolf Ebert <[email protected]>
| Newsgroups | gmane.comp.hardware.avr.gcc |
|---|---|
| Message-ID | <[email protected]> |
Am 13.04.2013 07:49, schrieb Sean:
> I’ve been attempting to compile and link an Ada programme for the Arduino.
>
You obviously managed to master the most difficult part, that is
building the Ada cross compiler.
> I have managed to get a simple programme compiled linked and running on
> an AtMega328p board.
OK
> But when I start to use some of the more complex functions I obviously
> had to start using avrlibc.
Yes, all gcc compiled programs - independent of the source language -
use the builtin functions from libgcc.a. AVR-Ada only rarely uses
functions from AVR-LibC explicitely.
> I’ve down loaded and built avrlibc and I have then attempted to link my
> programme.
>
> But no matter how I try to tell the compiler/linker to use libc or libm
> I keep getting link issues:
>
> avr-gnatbind --RTS=C:\GNAT\2012\lib\gcc\avr\4.5.4\rts-zfp -nostdlib -I-
> -x C:\Arduino\Arduino_Ada\BMP085\obj\main.ali
>
> avr-gnatlink C:\Arduino\Arduino_Ada\BMP085\obj\main.ali
> C:\Arduino\Arduino_Ada\BMP085\\obj\crtm328p._o -nostdlib -lgcc -lc -lm
> -mavr5 -Tdata=0x00800200 -mmcu=avr5 -g -nostdlib
> C:\avr-ada-1.2.0_bin\avr\onewire\lib\libonewire.a
> C:\avr-ada-1.2.0_bin\avr\debug\lib\libdebug.a C:\avr-ada-1.2.0_bin\avr\crc
>
> \lib\libcrc.a
> C:\avr-ada-1.2.0_bin\avr\avr_lib\atmega328p\lib\libavrada.a -o
> C:\Arduino\Arduino_Ada\BMP085\main.elf
>
> C:\avr-ada-1.2.0_bin\avr\onewire\lib\libonewire.a(one_wire-search.o): In
> function `one_wire__search__verify':
>
> C:\avr-ada-1.2.0_bin\avr\onewire/one_wire-search.adb:238: undefined
> reference to `memcmp'
>
> C:\avr-ada-1.2.0_bin\avr\avr_lib\atmega328p\lib\libavrada.a(avr-int_img.o):
> In function `avr__int_img__u8_img_c':
>
> C:\avr-ada-1.2.0_bin\avr\avr_lib/avr-int_img.adb:82: undefined reference
> to `itoa'
>
This is a function from AVR-LibC
> C:\avr-ada-1.2.0_bin\avr\avr_lib\atmega328p\lib\libavrada.a(avr-int_img.o):
> In function `avr__int_img__u8_img_right':
>
> C:\avr-ada-1.2.0_bin\avr\avr_lib/avr-int_img.adb:98: undefined reference
> to `__udivmodqi4'
This is a function from libgcc
The linker neither finds the libc nor the libgcc functions. You have a
problem with your installation. Did you specify the same PREFIX for
your avr-gcc and avr-libc installation?
Try a simple C program first.
It might be that you mix the Ada compiler from AdaCore (installed in
C:\GNAT\2012) with AVR-Ada. AVR-Ada relies on its own run time system
(RTS). Except for Ada tagged types the AVR-Ada RTS is more capable than
the one from AdaCore.
You might get better help at the avr-ada-devel mailing list
Rolf
_______________________________________________
AVR-GCC-list mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/avr-gcc-list