Forum: ARM programming with GCC/GNU tools Linking standard libc.a and libg.a in arm-none-eabi

von venkat k. (Company: none) (venkat)

Rate this post
0 useful
not useful
Hi All,

My code works fine without any std lib calls. If I make any std lib 
the linking fails. for e.g. undefined reference to 'malloc'.

I have used
GROUP(-lc -lg) in .ld file.

I have also added the lib file in arm-none-eabi-ld...

arm-none-eabi-ld -v 
-T../CodeSourcery/Sourcery_G++_Lite/arm-none-eabi/lib/bco_setup2.ld -L 
../CodeSourcery/Sourcery_G++_Lite/arm-none-eabi/lib -lc -lg -o image.elf 
demo.o  asm-vector.o asm-isr.o start.o

Do you see anything missing?


von ZiZi (Guest)

Rate this post
0 useful
not useful
Better to use the *-gcc command rather than the *-ld command for linking 
too, as it knows what std libs need to be linked to a C program without 
explicitely mentioning it on the command line.



von venkat k. (Company: none) (venkat)

Rate this post
0 useful
not useful
This solved the problem.


Entering an e-mail address is optional. If you want to receive reply notifications by e-mail, please log in.

Rules — please read before posting

  • Post long source code as attachment, not in the text
  • Posting advertisements is forbidden.

Formatting options

  • [c]C code[/c]
  • [avrasm]AVR assembler code[/avrasm]
  • [code]code in other languages, ASCII drawings[/code]
  • [math]formula (LaTeX syntax)[/math]

Bild automatisch verkleinern, falls nötig
Note: the original post is older than 6 months. Please don't ask any new questions in this thread, but start a new one.