memcpy problem

Guest #1174262
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
Moderator #1174263
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
Guest #1174264
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
Moderator #1174265
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
#1174268
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!

Reply

A question of your own? This thread is over 19 years old. Ask it in a thread of its own – more people read along there, and it gets answered more often and sooner.

Start a new thread

A fix, an addition or feedback on this thread? Then reply here.

Formatting
  • [c]C-Code[/c]
  • [code]code in other languages, ASCII drawings[/code]
  • [math]formula (LaTeX syntax)[/math]
  • [[Title]] – link to an article
  • Link to another post: right-click its post ID (#8078628), copy the address, paste it into the text

More about formatting

Post long source code as an attachment, not in the text.

Already registered? Log in

Not shown to anyone. We send you a link; your post appears once you confirm it there.

By submitting you create a free account and accept the terms of use.