在进入嵌入式开发时,只要包含有sin,cos,sqrt 等三角函数的时候总是无法正常的编译,而且会产生一些很奇怪的错误
lcd.o(.text+0x85c): In func
tion `draw_heart':
: undefined reference to `cos'
lcd.o(.text+0x870): In function `draw_heart':
: undefined reference to `__muldf3'
lcd.o(.text+0x874): In function `draw_heart':
: undefined reference to `__fixdfsi'
lcd.o(.text+0x884): In function `draw_heart':
: undefined reference to `sin'
lcd.o(.text+0x898): In function `draw_heart':
: undefined reference to `__muldf3'
lcd.o(.text+0x89c): In function `draw_heart':
: undefined reference to `__fixdfsi'
lcd.o(.text+0x8b0): In function `draw_heart':
: undefined reference to `__floatsidf'
lcd.o(.text+0x8b4): In function `draw_heart':
: undefined reference to `sqrt'
lcd.o(.text+0x8b8): In function `draw_heart':
: undefined reference to `__fixdfsi'
lcd.o(.text+0x8e0): In function `draw_heart':
: undefined reference to `__adddf3'
lcd.o(.text+0x8fc): In function `draw_heart':
: undefined reference to `__ltdf2'
make: *** [lcd.bin] Error 1
我要怎样才能正常编译呢?makefile如下:
CFLAGS := -Wall -Wstrict-prototypes -O2 -fomit-frame-pointer -ffreestanding
lcd.bin : start.S lcd.c
ARM-linux-gcc $(CFLAGS) -c -o start.o start.S
arm-linux-gcc $(CFLAGS) -c -o lcd.o lcd.c
arm-linux-ld -Ttext 0x0000000 start.o lcd.o -o lcds_elf
arm-linux-ld -Tlcd.lds start.o lcd.o -o lcds_elf
arm-linux-objcopy -O binary -S lcds_elf lcd.bin
arm-linux-objdump -D -m arm lcds_elf > lcd.dis
clean:
rm -f lcd.dis lcd.bin lcds_elf *.o