2013-07-13 133 views
2

我想在我的功能之一來使用標準的C函數臂的Sourcery工具鏈鏈接錯誤

void print(const char* format,...) {  
    char buffer[256]; 
    va_list args; 
    va_start (args, format); 
    vsnprintf (buffer,256,format, args); 
    va_end (args); 
    sendString(buffer); 
} 

錯誤來是

arm-none-eabi-ld -o check.elf -T /home/sanju/Arm/check/other/ROM.ld Serial.o irq.o lowlevel.o main.o startup.o \ 
-L/usr/arm-none-eabi/lib -lc -lg -lm 
/usr/arm-none-eabi/lib/libc.a(lib_a-svfprintf.o): In function `_svfprintf_r': 
vfprintf.c:(.text+0x688): undefined reference to `__aeabi_dcmplt' 
vfprintf.c:(.text+0xdfc): undefined reference to `__aeabi_dcmpeq' 
vfprintf.c:(.text+0x10b4): undefined reference to `__aeabi_dcmpeq' 
vfprintf.c:(.text+0x168c): undefined reference to `__aeabi_uldivmod' 
vfprintf.c:(.text+0x16a8): undefined reference to `__aeabi_uldivmod' 
vfprintf.c:(.text+0x1a48): undefined reference to `__aeabi_dcmpeq' 
vfprintf.c:(.text+0x1eac): undefined reference to `__aeabi_dcmpeq' 
/usr/arm-none-eabi/lib/libc.a(lib_a-dtoa.o): In function `quorem': 
dtoa.c:(.text+0x3c): undefined reference to `__aeabi_uidiv' 
/usr/arm-none-eabi/lib/libc.a(lib_a-dtoa.o): In function `_dtoa_r': 
dtoa.c:(.text+0x274): undefined reference to `__aeabi_dcmpeq' 
dtoa.c:(.text+0x360): undefined reference to `__aeabi_ui2d' 
dtoa.c:(.text+0x37c): undefined reference to `__aeabi_dsub' 
dtoa.c:(.text+0x388): undefined reference to `__aeabi_dmul' 
dtoa.c:(.text+0x394): undefined reference to `__aeabi_dadd' 
dtoa.c:(.text+0x3a4): undefined reference to `__aeabi_i2d' 
dtoa.c:(.text+0x3b0): undefined reference to `__aeabi_dmul' 
dtoa.c:(.text+0x3c4): undefined reference to `__aeabi_dadd' 
dtoa.c:(.text+0x3d0): undefined reference to `__aeabi_d2iz' 
dtoa.c:(.text+0x3e8): undefined reference to `__aeabi_dcmplt' 
dtoa.c:(.text+0x418): undefined reference to `__aeabi_dcmpgt' 
dtoa.c:(.text+0x5a8): undefined reference to `__aeabi_ddiv' 
dtoa.c:(.text+0x5ac): undefined reference to `__aeabi_d2iz' 
dtoa.c:(.text+0x5b4): undefined reference to `__aeabi_i2d' 
dtoa.c:(.text+0x5c0): undefined reference to `__aeabi_dmul' 
dtoa.c:(.text+0x5d4): undefined reference to `__aeabi_dsub' 
dtoa.c:(.text+0x608): undefined reference to `__aeabi_dmul' 
dtoa.c:(.text+0x61c): undefined reference to `__aeabi_dcmpeq' 
dtoa.c:(.text+0x650): undefined reference to `__aeabi_dmul' 
dtoa.c:(.text+0x664): undefined reference to `__aeabi_dcmpeq' 
dtoa.c:(.text+0x684): undefined reference to `__aeabi_ddiv' 
dtoa.c:(.text+0x688): undefined reference to `__aeabi_d2iz' 
dtoa.c:(.text+0x690): undefined reference to `__aeabi_i2d' 
dtoa.c:(.text+0x69c): undefined reference to `__aeabi_dmul' 
dtoa.c:(.text+0x6b0): undefined reference to `__aeabi_dsub' 
dtoa.c:(.text+0x6fc): undefined reference to `__aeabi_dadd' 
dtoa.c:(.text+0x718): undefined reference to `__aeabi_dcmplt' 
dtoa.c:(.text+0x73c): undefined reference to `__aeabi_dcmpeq' 
dtoa.c:(.text+0xa94): undefined reference to `__aeabi_i2d' 
dtoa.c:(.text+0xaa0): undefined reference to `__aeabi_dcmpeq' 
dtoa.c:(.text+0xbf8): undefined reference to `__aeabi_ddiv' 
dtoa.c:(.text+0xc2c): undefined reference to `__aeabi_dmul' 
dtoa.c:(.text+0xc58): undefined reference to `__aeabi_ddiv' 
dtoa.c:(.text+0xc80): undefined reference to `__aeabi_dcmplt' 
dtoa.c:(.text+0xc90): undefined reference to `__aeabi_i2d' 
dtoa.c:(.text+0xc9c): undefined reference to `__aeabi_dmul' 
dtoa.c:(.text+0xca8): undefined reference to `__aeabi_dadd' 
dtoa.c:(.text+0xce8): undefined reference to `__aeabi_ddiv' 
dtoa.c:(.text+0xcf4): undefined reference to `__aeabi_dsub' 
dtoa.c:(.text+0xd08): undefined reference to `__aeabi_d2iz' 
dtoa.c:(.text+0xd10): undefined reference to `__aeabi_i2d' 
dtoa.c:(.text+0xd24): undefined reference to `__aeabi_dsub' 
dtoa.c:(.text+0xd54): undefined reference to `__aeabi_dcmpgt' 
dtoa.c:(.text+0xd78): undefined reference to `__aeabi_dsub' 
dtoa.c:(.text+0xd8c): undefined reference to `__aeabi_dcmpgt' 
dtoa.c:(.text+0xdd0): undefined reference to `__aeabi_dsub' 
dtoa.c:(.text+0xddc): undefined reference to `__aeabi_dcmplt' 
dtoa.c:(.text+0xe00): undefined reference to `__aeabi_dmul' 
dtoa.c:(.text+0xe1c): undefined reference to `__aeabi_dmul' 
dtoa.c:(.text+0xe28): undefined reference to `__aeabi_d2iz' 
dtoa.c:(.text+0xe30): undefined reference to `__aeabi_i2d' 
dtoa.c:(.text+0xe44): undefined reference to `__aeabi_dsub' 
dtoa.c:(.text+0xe64): undefined reference to `__aeabi_dcmplt' 
dtoa.c:(.text+0xef0): undefined reference to `__aeabi_i2d' 
dtoa.c:(.text+0xefc): undefined reference to `__aeabi_dmul' 
dtoa.c:(.text+0xf08): undefined reference to `__aeabi_dadd' 
dtoa.c:(.text+0xf24): undefined reference to `__aeabi_dsub' 
dtoa.c:(.text+0xf38): undefined reference to `__aeabi_dcmpgt' 
dtoa.c:(.text+0xf54): undefined reference to `__aeabi_dcmplt' 
dtoa.c:(.text+0x10c0): undefined reference to `__aeabi_dmul' 
dtoa.c:(.text+0x10e8): undefined reference to `__aeabi_dmul' 
dtoa.c:(.text+0x1130): undefined reference to `__aeabi_dmul' 
dtoa.c:(.text+0x1144): undefined reference to `__aeabi_d2iz' 
dtoa.c:(.text+0x114c): undefined reference to `__aeabi_i2d' 
dtoa.c:(.text+0x1160): undefined reference to `__aeabi_dsub' 
dtoa.c:(.text+0x119c): undefined reference to `__aeabi_dmul' 
dtoa.c:(.text+0x11a8): undefined reference to `__aeabi_d2iz' 
dtoa.c:(.text+0x11b0): undefined reference to `__aeabi_i2d' 
dtoa.c:(.text+0x11c8): undefined reference to `__aeabi_dsub' 
dtoa.c:(.text+0x1200): undefined reference to `__aeabi_dadd' 
dtoa.c:(.text+0x120c): undefined reference to `__aeabi_dcmplt' 
dtoa.c:(.text+0x12cc): undefined reference to `__aeabi_dmul' 
dtoa.c:(.text+0x12d8): undefined reference to `__aeabi_dcmpge' 
dtoa.c:(.text+0x158c): undefined reference to `__aeabi_dmul' 
dtoa.c:(.text+0x159c): undefined reference to `__aeabi_i2d' 
dtoa.c:(.text+0x15b0): undefined reference to `__aeabi_dmul' 
dtoa.c:(.text+0x15bc): undefined reference to `__aeabi_dadd' 
dtoa.c:(.text+0x15ec): undefined reference to `__aeabi_dsub' 
dtoa.c:(.text+0x15f8): undefined reference to `__aeabi_dcmpgt' 
/usr/arm-none-eabi/lib/libc.a(lib_a-mprec.o): In function `__ratio': 
mprec.c:(.text+0xbc0): undefined reference to `__aeabi_ddiv' 
/usr/arm-none-eabi/lib/libc.a(lib_a-mprec.o): In function `_mprec_log10': 
mprec.c:(.text+0xbf0): undefined reference to `__aeabi_dmul' 
/usr/arm-none-eabi/lib/libc.a(lib_a-svfiprintf.o): In function `_svfiprintf_r': 
vfprintf.c:(.text+0xf30): undefined reference to `__aeabi_uldivmod' 
vfprintf.c:(.text+0xf4c): undefined reference to `__aeabi_uldivmod' 
make: *** [all] Error 1 
*** Failure: Exit code 2 *** 

我的Makefile這個

TOOLCHAIN=arm-none-eabi- 

ARM_CPU=arm7tdmi 

VPATH= /home/sanju/Arm/check/src /home/sanju/Arm/check/other /home/sanju/Arm/check/include 

INCLUDE= /home/sanju/Arm/check/include 

CCFLAGS= -mcpu=$(ARM_CPU) -mthumb-interwork -ffunction-sections -Os -Wall 

ASFLAGS= -mcpu=$(ARM_CPU) -mthumb-interwork -mfpu=softfpa -Wall 


all: Serial.o irq.o lowlevel.o main.o startup.o 

    $(TOOLCHAIN)ld -o check.elf -T /home/sanju/Arm/check/other/ROM.ld Serial.o irq.o 
lowlevel.o main.o startup.o \ 

    -L/usr/arm-none-eabi/lib -lc -lg -lm 

    $(TOOLCHAIN)objcopy -O ihex check.elf check.hex 

    $(TOOLCHAIN)objcopy -O binary check.elf check.bin 



Serial.o : Serial.c Serial.h 

    $(TOOLCHAIN)gcc $(CCFLAGS) -I$(INCLUDE) -c $< 


irq.o : irq.c irq.h lpc214x.h 

    $(TOOLCHAIN)gcc $(CCFLAGS) -I$(INCLUDE) -c $< 


lowlevel.o : lowlevel.c lowlevel.h 

    $(TOOLCHAIN)gcc $(CCFLAGS) -I$(INCLUDE) -c $< 



main.o : main.c lpc214x.h timer0.h Asm.h lowlevel.h type.h Serial.h 

    $(TOOLCHAIN)gcc $(CCFLAGS) -I$(INCLUDE) -c $< 

startup.o : startup.S 

    $(TOOLCHAIN)as $(ASFLAGS) -o startup.o $< 




.PHONY: clean 

clean : 

    rm -rf *.o *.elf *.hex *.o *.bin 

在鎖定所有鏈接失敗。我試圖用手臂精靈工具鏈也有我得到一些errors.I已經GOOGLE了很多關於它,但沒有找到任何解決方案的例子。

回答

5

嘗試使用gccld前端。 變化:

$(TOOLCHAIN)ld -o check.elf [...] 

$(TOOLCHAIN)gcc -o check.elf [...] 

GCC知道調用ld時添加一些必要的選項。

+0

我用來代替LD GCC,但我得到了一些人因爲gcc嘗試將它與一些crt.o鏈接並且該文件的某些符號未定義。 – sanjay

+0

我發現這個問題,通過谷歌,這實際上解決了我的問題。 「gcc」比'ld'更聰明嗎?我們不應該停止使用'ld'來支持'gcc'嗎? – Multisync

+0

注意'gcc'僅僅是'ld'這裏前端。它可以告訴你實際使用的'ld'命令行。 –

3

做事情更好加入「-lgcc」到-L什麼時候?

+0

我試過,但我使用Linux操作系統,而不是使-LG -lgcc的是存在的,我們已加入 – sanjay

1

而不是使用ld鏈接我用gcc但它包括提供的crt.o目標文件,所以我用-nostartfiles它爲我工作。