Problem in linking std libraries using arm-linux-ld

Do you have a question? Post it now! No Registration Necessary

Translate This Thread From English to

Threaded View
Hi Guys,

Problem in linking  my source code which uses std libraries like stdio,
string, stdlib using arm-linux-ld


my make file looks like this
------------------------------------------------------------------------------
TOPDIR := $(shell /bin/pwd)
export TOPDIR

export CC=arm-linux-gcc
export LD=arm-linux-ld
OBJCOPY=arm-linux-objcopy
OBJDUMP=arm-linux-objdump

export TOP_CFLAGS= -O2 -Wall -fPIC -mcpu=arm9tdmi -I../include

export LDFLAGS = -T SDcard_bootloader_fat16.lnk -Map
SDcard_bootloader_fat16.map -L/usr/local/arm/4.1.1-920t/lib -lc


ASFLAGS =

SDcard_bootloader:
    make -C main
    $(LD) $(LDFLAGS) -o SDcard_bootloader_fat16.elf main/mainrom.o
    $(OBJCOPY) -j rom -O binary SDcard_bootloader_fat16.elf
SDcard_bootloader_fat16.bin

    $(OBJDUMP) -D SDcard_bootloader_fat16.elf > SDcard_bootloader_fat16.diss

clean:
    make clean -C main
    rm -f $(OBJS) SDcard_bootloader_fat16.bin SDcard_bootloader_fat16.elf
SDcard_bootloader_fat16.diss SDcard_bootloader_fat16.map

------------------------------------------------------------------------------

if i remove -lc flag then it complains that it cannot find

main/mainrom.o: In function `start_C':
sd_raw.c:(rom+0x208): undefined reference to `puts'
main/mainrom.o: In function `myputhex':
sd_raw.c:(rom+0x338): undefined reference to `memcpy'
make: *** [SDcard_bootloader] Error 1


Can any one please tell me how to link to standard libraries.

I tried tow different version of tool chains
arm-linux-gcc 3.4.3
arm-linux-gcc 4.1.1

But no luck with any one of thoes.

Can some one please help.


      
                    
---------------------------------------        
Posted through http://www.EmbeddedRelated.com

Re: Problem in linking std libraries using arm-linux-ld

--snip--

Quoted text here. Click to load it

--snip--

Quoted text here. Click to load it

--snip--

Quoted text here. Click to load it

The -lc flag tells the linker to search the standard libraries.

Site Timeline