Yahoo Groups archive

Lpc2000

Index last updated: 2026-04-28 23:31 UTC

Thread

Problem with makefile

Problem with makefile

2005-02-21 by joelteply

I am having newbie problems getting the core gcc functions defined in 
my program. I need to get the gcc functions linked in. Right now I 
can't do division or string functions. Here is an example of the 
errors: 

"undefined reference to memcpy"
"undefined reference to __udivi" (or something like that)

Those are defined in libgcc.a, but I can't link them in correctly.

What changes do I need to make to this makefile?

 NAME   = test io

CC      = arm-elf-gcc
LD      = arm-elf-ld -v
AR      = arm-elf-ar
AS      = arm-elf-as
CP      = arm-elf-objcopy

.SUFFIXES : .o .c .s

CFLAGS  = -I./ -c -O3
AFLAGS  = -ahls -mapcs-32
CAFLAGS = $(CFLAGS) -Wa,-ahls,-mapcs-32
LFLAGS  =  -Map main.map -nostartfiles -T simple.cmd
CPFLAGS = -O ihex

test: main.out
	@ echo "...copying"
	$(CP) $(CPFLAGS) main.out main.hex

main.out: start.o ivt.o main.o simple.cmd 
	@ echo "..linking"
	$(LD) $(LFLAGS) -o main.out  start.o ivt.o main.o
.c.o:
	@ echo ".compiling"
	@ $(CC) $(CAFLAGS) $<  > a.lst

mainin: start.s ivt.s main.c
	@ echo ".compiling"
	$(CC) $(CFLAGS) start.s ivt.s main.c


Any help would be greatly appreciated. Thanks in advance.

Re: [lpc2000] Problem with makefile

2005-02-21 by Anton Erasmus

Hi,

You can explicitly add them to your link command. e.g. -lc
for libc, -lgcc for libgcc etc.

Regards
   Anton Erasmus

On 21 Feb 2005 at 15:17, joelteply wrote:

> 
> 
> I am having newbie problems getting the core gcc functions defined in
> my program. I need to get the gcc functions linked in. Right now I
> can't do division or string functions. Here is an example of the
> errors: 
> 
> "undefined reference to memcpy"
> "undefined reference to __udivi" (or something like that)
> 
> Those are defined in libgcc.a, but I can't link them in correctly.
> 
> What changes do I need to make to this makefile?
> 
>  NAME   = test io
> 
> CC      = arm-elf-gcc
> LD      = arm-elf-ld -v
> AR      = arm-elf-ar
> AS      = arm-elf-as
> CP      = arm-elf-objcopy
> 
> .SUFFIXES : .o .c .s
> 
> CFLAGS  = -I./ -c -O3
> AFLAGS  = -ahls -mapcs-32
> CAFLAGS = $(CFLAGS) -Wa,-ahls,-mapcs-32
> LFLAGS  =  -Map main.map -nostartfiles -T simple.cmd
> CPFLAGS = -O ihex
> 
> test: main.out
>  @ echo "...copying"
>  $(CP) $(CPFLAGS) main.out main.hex
> 
> main.out: start.o ivt.o main.o simple.cmd 
>  @ echo "..linking"
>  $(LD) $(LFLAGS) -o main.out  start.o ivt.o main.o
> .c.o:
>  @ echo ".compiling"
>  @ $(CC) $(CAFLAGS) $<  > a.lst
> 
> mainin: start.s ivt.s main.c
>  @ echo ".compiling"
>  $(CC) $(CFLAGS) start.s ivt.s main.c
> 
> 
> Any help would be greatly appreciated. Thanks in advance.
> 
> 
> 
> 
> 
> 
> 
> 
> Yahoo! Groups Links
> 
> 
> 
> 
> 
> 
> 

-- 
A J Erasmus

Re: Problem with makefile

2005-02-21 by ntfreak2000

--- In lpc2000@yahoogroups.com, "Anton Erasmus" <antone@s...> wrote:
> Hi,
> 
> You can explicitly add them to your link command. e.g. -lc
> for libc, -lgcc for libgcc etc.
> 
> Regards
>    Anton Erasmus

Why not just use gcc as the driver for linking, it will sort out the 
libs/paths for you? It is much easier than calling ld directly

Regards
Spen

Re: Problem with makefile

2005-02-22 by joelteply

Thanks. This worked well.

--- In lpc2000@yahoogroups.com, "ntfreak2000" <ntfreak2@h...> wrote:
Show quoted textHide quoted text
> 
> --- In lpc2000@yahoogroups.com, "Anton Erasmus" <antone@s...> wrote:
> > Hi,
> > 
> > You can explicitly add them to your link command. e.g. -lc
> > for libc, -lgcc for libgcc etc.
> > 
> > Regards
> >    Anton Erasmus
> 
> Why not just use gcc as the driver for linking, it will sort out the 
> libs/paths for you? It is much easier than calling ld directly
> 
> Regards
> Spen

Move to quarantaine

This moves the raw source file on disk only. The archive index is not changed automatically, so you still need to run a manual refresh afterward.