EmbDev.net

Forum: ARM programming with GCC/GNU tools memcpy problem


von ezequiel (Guest)


Rate this post
useful
not useful
Hello,

I have a little problem with memcpy,and eventhough I have read other
topics and try to solve it, I couldn't My WinARM Version is 4.1.1

I have an structure very basic, called Rect. I wanted to pass this
structure to a function this way:

void getRectSize (Rect rectangle){
}

but when compilling it says "undefined reference to `memcpy'". So I
added to my make file the option -lgcc -lc, in the linker part. But now
it says: c:\WinARM\bin\arm-elf-ld.exe: cannot find -lgcc

This is my makefile:

NAME       = M1
MCU    = arm7tdmi-s

CC        = arm-elf-gcc
LD        = arm-elf-ld -v
AR        = arm-elf-ar
AS        = arm-elf-as
CP        = arm-elf-objcopy
OD    = arm-elf-objdump
SIZE    = arm-elf-size

CFLAGS    = -mcpu=$(MCU) -I./include -c -fno-common -g
AFLAGS    = -mcpu=$(MCU) -ahls -mapcs-32 -o crt.s
LFLAGS    = -Map main.map -lgcc -lc -lm -T./src/2106.cmd
CPFLAGS   = -O ihex
ODFLAGS    = -x --syms

all: M1 size

main.out: crt.o delay.o main.o system.o ./src/2106.cmd
  @ echo "..linking Main"
  $(LD) $(LFLAGS) -o ./release/main.out ./release/crt.o
./release/delay.o ./release/main.o ./release/system.o

delay.o: ./src/delay.c
  @ echo ".compiling delay.c"
  $(CC) $(CFLAGS) ./src/delay.c -o ./release/delay.o

system.o: ./src/system.c
  @ echo ".compiling System.c"
  $(CC) $(CFLAGS) ./src/system.c -o ./release/system.o

main.o: ./src/main.c
  @ echo ".compiling Main.c"
  $(CC) $(CFLAGS) ./src/main.c -o ./release/main.o

crt.o: ./src/crt.s
  @ echo ".assembling CRT.S"
  $(AS) $(AFLAGS) ./src/crt.s > ./release/crt.lst -o ./release/crt.o

How can I solve this problem.. I cannot continue making a clear program
without the features that memcpy gives.

Thanks very much.
Ezequiel

von Martin T. (mthomas) (Moderator)


Rate this post
useful
not useful
ezequiel wrote:
> ...
> LD        = arm-elf-ld -v
> ...
>   $(LD) $(LFLAGS) -o ./release/main.out ./release/crt.o
> ...

Try to link thru the compiler-frontend (arm-elf-gcc). It "knows" the
needed search-path.

Martin Thomas

von Guest (Guest)


Rate this post
useful
not useful
Thanks very much Martin, What changes do I have to make on the make
file?


Martin Thomas wrote:
> ezequiel wrote:
>> ...
>> LD        = arm-elf-ld -v
>> ...
>>   $(LD) $(LFLAGS) -o ./release/main.out ./release/crt.o
>> ...
>
> Try to link thru the compiler-frontend (arm-elf-gcc). It "knows" the
> needed search-path.
>
> Martin Thomas

von Martin T. (mthomas) (Moderator)


Rate this post
useful
not useful
Guest wrote:
> Thanks very much Martin, What changes do I have to make on the make
> file?

Most (all?) of the examples I provide use the compiler-frontend to call
the linker, the makefiles in the examples can serve as templates.

Martin Thomas



>
> Martin Thomas wrote:
>> ezequiel wrote:
>>> ...
>>> LD        = arm-elf-ld -v
>>> ...
>>>   $(LD) $(LFLAGS) -o ./release/main.out ./release/crt.o
>>> ...
>>
>> Try to link thru the compiler-frontend (arm-elf-gcc). It "knows" the
>> needed search-path.
>>
>> Martin Thomas

von Dmitry T. (cryon)


Rate this post
useful
not useful
Hi!

Please, has anybody solved the problem?
I have the same error message...

von Clifford S. (clifford)


Rate this post
useful
not useful
Dmitry Timas wrote:
> Hi!
>
> Please, has anybody solved the problem?
> I have the same error message...

Did you try the solution Martin suggested?

von Dmitry T. (cryon)


Rate this post
useful
not useful
Clifford Slocombe wrote:
> Did you try the solution Martin suggested?

Thanks a Lot! Eventually I ended up using Martin’s solution (found in
the project lpc_2129_adc_stdio_20070313). It works fine for me!

Please log in before posting. Registration is free and takes only a minute.
Existing account
Do you have a Google/GoogleMail account? No registration required!
Log in with Google account
No account? Register here.