EmbDev.net

Forum: ARM programming with GCC/GNU tools memcpy problem


Author: ezequiel (Guest)
Posted on:

Rate this post
0 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

Author: Martin Thomas (mthomas) (Moderator)
Posted on:

Rate this post
0 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

Author: Guest (Guest)
Posted on:

Rate this post
0 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

Author: Martin Thomas (mthomas) (Moderator)
Posted on:

Rate this post
0 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

Author: Dmitry Timas (cryon)
Posted on:

Rate this post
0 useful
not useful
Hi!

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

Author: Clifford Slocombe (clifford)
Posted on:

Rate this post
0 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?

Author: Dmitry Timas (cryon)
Posted on:

Rate this post
0 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!

Reply

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.