Main Site Documentation

Linking problem math.h makefile


#1

When i want to create my ELF file i’m getting the following errors
undifned reference to 'cos’
undifned reference to …

I think the problem is in the makefile that is not linking to math.h.
But i dont know how to fix it.


 ####################################################
 ###### Copyright(c) GHI Electronics, LLC ######
 ####################################################

OUTFILE=SPA
LINKERSCRIPT = RLP_LinkScript.lds


INCL=./include

CC		=arm-none-eabi-gcc
LD		=arm-none-eabi-gcc

CCFLAGS=  -g -mlittle-endian -mcpu=arm7tdmi  -Wall -I. -I$(INCL)
CCFLAGS+= -mapcs-frame -fno-builtin

LDFLAGS =-nostartfiles -Wl,--Map -Wl,./Output/$(OUTFILE).map
LDFLAGS+=-lc -lgcc -Wl,--omagic
LDFLAGS+=-T $(LINKERSCRIPT)

OBJS+= spa.o 
       

rebuild: clean all del_o

all: $(OBJS)
	$(LD) $(LDFLAGS) -o ./Output/$(OUTFILE).elf $(OBJS)
	

spa.o: spa.c 
	$(CC) -c $(CCFLAGS) spa.c -o spa.o

clean:
	-rm *.o ./Output/*.elf ./Output/*.map

del_o:
	-rm *.o

del_map:
	-rm ./Output/*.map


#2

Lockup the gcc compiler documentation to find the name of the built in math lib. Another option is to use any other math lib that is suitable.


#3

Hi Bart,

I am doing exactly the same thing.

can’t get it working either, this is really crappy… :frowning:

Greetings,

Marcel
http://www.nrg2u.nl.nu


#4

If you have problems with one compiler you might want to test another. I was playing around with Yagarto but I didnt go so smoothly. I changed to Sourcery GNU and now I compile with no problems. Math libs and all the other libs.
One more tip get a professional IDE, a Evaluation version to get you started, like uVision there you dont have to worry so much with the makefile, and it works great with GNU compiler. Im using arm-2007q3-53-arm-none-eabi CodeSourcery GNU and Keil ARM Evaluation Software.


#5

Thanks for your advice,

I am a noobee when it comes to embeded programming. What did work for me was adding the following when playing with Yagarto makefile:
(added the -lm switch) link math library.

all: $(OBJS)
$(LD) $(LDFLAGS) -o ./Output/$(OUTFILE).elf $(OBJS) -lm


#6

Thanks mon11
the -lm fixes the linking problem.
now I got allot of other errors but thats for another time for me to fix.


#7

Bart,

I think you are working on the same project (Solar tracker).
Maybe we can help each other (if you want). You need to add RLP.h for youre specific
embeded chipset. Next thing to do is talk to the Spa.h structure.

You can find my email address @ http://www.youR2Power.com

Regards,

Mon11


#8

Yes im also working on a a solar tracker its a school project.
I already emailed you

I changed the chipset already.
still having problem with the make i’m getting a overflow.
SPA.elf section ‘.text’ will not fit in region 'SDRAM’
see screenshot

I think the SPA algoritm is just to large to work on my fez domino


#9

Try using an other compiler. I’ve seen assembly code generated by yagarto, and the output is just not optimised. It keeps moving values from one cpu register to another while that is not necessary.