arm-linux/elf/eabi交叉编译器

本文介绍了ARM架构下三种主要的交叉编译器类型:arm-linux-、arm-elf- 和 arm-eabi。详细解释了它们的应用场景及特点,特别是arm-eabi对浮点运算的支持及其对硬件的影响。

原文:http://blog.chinaunix.net/uid-25871104-id-2950902.html

arm的交叉编译器有三种类型(命名方式):arm-linux-, arm-elf-, arm-eabi

arm-linux一般用于编译linux程序,使用glibc库,arm-linux-elf用于编译uclinux或其他程序,使用嵌入式库,如uclib或newlib等。

arm-eabi是符合eabi规范的交叉编译器。关于EABI,可以参考另一篇博文。简单的说,EABI定义了一系列规范,如过程调用规范aacp,系统调用规范等。
arm-eabi可以使用各种不同的lib。
arm-eabi相比较前两者,最大的特点是,它支持FPA(Floating Pointer Accelrator),可以有效的提高浮点运算速度。但是对于没有FPA单元的硬件,使用arm-eabi编译的程序运行会更慢,因为对FPA的指令会产生未知指令的异常。



另外还可以参考:

http://blog.youkuaiyun.com/wfing/article/details/5818227

“PREFIX = arm-none-eabi- CC = $(PREFIX)gcc STM32_Per_Src_Path = Libraries/STM32F10x_StdPeriph_Driver/src SOURCES = User/main.c SOURCES += User/stm32f10x_it.c #SOURCES += Libraries/CMSIS/core_cm3.c SOURCES += Libraries/CMSIS/system_stm32f10x.c SOURCES += $(STM32_Per_Src_Path)/misc.c SOURCES += $(STM32_Per_Src_Path)/stm32f10x_rcc.c SOURCES += $(STM32_Per_Src_Path)/stm32f10x_gpio.c ASM_SOURCES = Libraries/CMSIS/start.S OBJS = $(SOURCES:.c=.o) $(ASM_SOURCES:.S=.o) TARGET = build/stm32f103_project MCU=cortex-m3 CFLAGS = -mcpu=$(MCU) -mthumb CFLAGS += -Wall -Wextra -Wpedantic #CFLAGS += -Wmissing-prototypes -Wstrict-prototypes CFLAGS += -DSTM32F10X_MD CFLAGS += -DUSE_STDPERIPH_DRIVER #CFLAGS += --specs=nano.specs CFLAGS += --specs=nosys.specs INCLUDE = -IUser INCLUDE += -ILibraries\STM32F10x_StdPeriph_Driver\inc INCLUDE += -ILibraries\CMSIS INCLUDE += -Iinterrupt INCLUDE += -IAPP LDSCRIPT = STM32F103C8_FLASH.ld LDFLAGS = -mcpu=$(MCU) -mthumb #LDFLAGS += --specs=nano.specs LDFLAGS += --specs=nosys.specs LDFLAGS += -T$(LDSCRIPT) -Wl,--gc-sections LDFLAGS += -Wl,--print-memory-usage LDFLAGS += -Wl,-Map=Build/project.map all : $(TARGET).elf $(TARGET).bin $(TARGET).hex $(TARGET).elf: $(OBJS) @echo Linking... $(CC) $(LDFLAGS) -o $@ $^ @echo Size info: $(SIZE) $@ %.o: %.c @echo Compiling $<... $(CC) $(CFLAGS) $(INCLUDE) -c -o $@ $< %.o: %.s @echo Assembling $<... $(CC) $(CFLAGS) -c -o $@ $< $(TARGET).bin: $(TARGET).elf $(OBJCOPY) -O binary $< $@ $(TARGET).hex: $(TARGET).elf $(OBJCOPY) -O ihex $< $@ clean: rm -rf Build find . -name "*.o" -type f -delete find . -name "*.d" -type f -delete flash: $(TARGET).elf openocd -f interface/stlink.cfg -f target/stm32f1x.cfg \ -c "program $< verify reset exit" clean: -del /q $(subst /,\,$(OBJS)) 2>nul -del /q $(TARGET).elf $(TARGET).bin $(TARGET).hex $(TARGET).map 2>nul flash: $(TARGET).elf openocd -f interface/stlink.cfg -f target/stm32f1x.cfg -c "program $< verify reset exit" .PHONY: all clean flash”“PS C:\Users\13336\Desktop\test\vscode_stm32\model_02> mingw32-make all makefile:87: warning: overriding recipe for target 'flash' makefile:79: warning: ignoring old recipe for target 'flash' Compiling User/main.c... arm-none-eabi-gcc -mcpu=cortex-m3 -mthumb -Wall -Wextra -Wpedantic -DSTM32F10X_MD -DUSE_STDPERIPH_DRIVER --specs=nosys.specs -IUser -ILibraries\STM32F10x_StdPeriph_Driver\inc -ILibraries\CMSIS -Iinterrupt -IAPP -c -o User/main.o User/main.c Linking... arm-none-eabi-gcc -mcpu=cortex-m3 -mthumb --specs=nosys.specs -TSTM32F103C8_FLASH.ld -Wl,--gc-sections -Wl,--print-memory-usage -Wl,-Map=Build/project.map -o build/stm32f103_project.elf User/main.o User/stm32f10x_it.o Libraries/CMSIS/system_stm32f10x.o Libraries/STM32F10x_StdPeriph_Driver/src/misc.o Libraries/STM32F10x_StdPeriph_Driver/src/stm32f10x_rcc.o Libraries/STM32F10x_StdPeriph_Driver/src/stm32f10x_gpio.o Libraries/CMSIS/start.o C:/Users/13336/Desktop/test/arm-gnu-toolchain-14.3.rel1-mingw-w64-i686-arm-none-eabi/bin/../lib/gcc/arm-none-eabi/14.3.1/../../../../arm-none-eabi/bin/ld.exe: C:/Users/13336/Desktop/test/arm-gnu-toolchain-14.3.rel1-mingw-w64-i686-arm-none-eabi/bin/../lib/gcc/arm-none-eabi/14.3.1/../../../../arm-none-eabi/lib/thumb/v7-m/nofp\libc.a(libc_a-closer.o): in function `_close_r': closer.c:(.text._close_r+0xc): warning: _close is not implemented and will always fail C:/Users/13336/Desktop/test/arm-gnu-toolchain-14.3.rel1-mingw-w64-i686-arm-none-eabi/bin/../lib/gcc/arm-none-eabi/14.3.1/../../../../arm-none-eabi/bin/ld.exe: C:/Users/13336/Desktop/test/arm-gnu-toolchain-14.3.rel1-mingw-w64-i686-arm-none-eabi/bin/../lib/gcc/arm-none-eabi/14.3.1/../../../../arm-none-eabi/lib/thumb/v7-m/nofp\libc.a(libc_a-closer.o): note: the message above does not take linker garbage collection into account C:/Users/13336/Desktop/test/arm-gnu-toolchain-14.3.rel1-mingw-w64-i686-arm-none-eabi/bin/../lib/gcc/arm-none-eabi/14.3.1/../../../../arm-none-eabi/bin/ld.exe: C:/Users/13336/Desktop/test/arm-gnu-toolchain-14.3.rel1-mingw-w64-i686-arm-none-eabi/bin/../lib/gcc/arm-none-eabi/14.3.1/../../../../arm-none-eabi/lib/thumb/v7-m/nofp\libc.a(libc_a-lseekr.o): in function `_lseek_r': lseekr.c:(.text._lseek_r+0x14): warning: _lseek is not implemented and will always fail C:/Users/13336/Desktop/test/arm-gnu-toolchain-14.3.rel1-mingw-w64-i686-arm-none-eabi/bin/../lib/gcc/arm-none-eabi/14.3.1/../../../../arm-none-eabi/bin/ld.exe: C:/Users/13336/Desktop/test/arm-gnu-toolchain-14.3.rel1-mingw-w64-i686-arm-none-eabi/bin/../lib/gcc/arm-none-eabi/14.3.1/../../../../arm-none-eabi/lib/thumb/v7-m/nofp\libc.a(libc_a-lseekr.o): note: the message above does not take linker garbage collection into account C:/Users/13336/Desktop/test/arm-gnu-toolchain-14.3.rel1-mingw-w64-i686-arm-none-eabi/bin/../lib/gcc/arm-none-eabi/14.3.1/../../../../arm-none-eabi/bin/ld.exe: C:/Users/13336/Desktop/test/arm-gnu-toolchain-14.3.rel1-mingw-w64-i686-arm-none-eabi/bin/../lib/gcc/arm-none-eabi/14.3.1/../../../../arm-none-eabi/lib/thumb/v7-m/nofp\libc.a(libc_a-readr.o): in function `_read_r': readr.c:(.text._read_r+0x14): warning: _read is not implemented and will always fail C:/Users/13336/Desktop/test/arm-gnu-toolchain-14.3.rel1-mingw-w64-i686-arm-none-eabi/bin/../lib/gcc/arm-none-eabi/14.3.1/../../../../arm-none-eabi/bin/ld.exe: C:/Users/13336/Desktop/test/arm-gnu-toolchain-14.3.rel1-mingw-w64-i686-arm-none-eabi/bin/../lib/gcc/arm-none-eabi/14.3.1/../../../../arm-none-eabi/lib/thumb/v7-m/nofp\libc.a(libc_a-readr.o): note: the message above does not take linker garbage collection into account C:/Users/13336/Desktop/test/arm-gnu-toolchain-14.3.rel1-mingw-w64-i686-arm-none-eabi/bin/../lib/gcc/arm-none-eabi/14.3.1/../../../../arm-none-eabi/bin/ld.exe: C:/Users/13336/Desktop/test/arm-gnu-toolchain-14.3.rel1-mingw-w64-i686-arm-none-eabi/bin/../lib/gcc/arm-none-eabi/14.3.1/../../../../arm-none-eabi/lib/thumb/v7-m/nofp\libc.a(libc_a-writer.o): in function `_write_r': writer.c:(.text._write_r+0x14): warning: _write is not implemented and will always fail C:/Users/13336/Desktop/test/arm-gnu-toolchain-14.3.rel1-mingw-w64-i686-arm-none-eabi/bin/../lib/gcc/arm-none-eabi/14.3.1/../../../../arm-none-eabi/bin/ld.exe: C:/Users/13336/Desktop/test/arm-gnu-toolchain-14.3.rel1-mingw-w64-i686-arm-none-eabi/bin/../lib/gcc/arm-none-eabi/14.3.1/../../../../arm-none-eabi/lib/thumb/v7-m/nofp\libc.a(libc_a-writer.o): note: the message above does not take linker garbage collection into account C:/Users/13336/Desktop/test/arm-gnu-toolchain-14.3.rel1-mingw-w64-i686-arm-none-eabi/bin/../lib/gcc/arm-none-eabi/14.3.1/../../../../arm-none-eabi/bin/ld.exe: warning: build/stm32f103_project.elf has a LOAD segment with RWX permissions C:/Users/13336/Desktop/test/arm-gnu-toolchain-14.3.rel1-mingw-w64-i686-arm-none-eabi/bin/../lib/gcc/arm-none-eabi/14.3.1/../../../../arm-none-eabi/bin/ld.exe: User/main.o: in function `main': main.c:(.text+0x4): undefined reference to `SetSysClock' C:/Users/13336/Desktop/test/arm-gnu-toolchain-14.3.rel1-mingw-w64-i686-arm-none-eabi/bin/../lib/gcc/arm-none-eabi/14.3.1/../../../../arm-none-eabi/bin/ld.exe: (SetSysClock): Unknown destination type (ARM/Thumb) in User/main.o main.c:(.text+0x4): dangerous relocation: unsupported relocation C:/Users/13336/Desktop/test/arm-gnu-toolchain-14.3.rel1-mingw-w64-i686-arm-none-eabi/bin/../lib/gcc/arm-none-eabi/14.3.1/../../../../arm-none-eabi/bin/ld.exe: main.c:(.text+0x8): undefined reference to `LED_Init' C:/Users/13336/Desktop/test/arm-gnu-toolchain-14.3.rel1-mingw-w64-i686-arm-none-eabi/bin/../lib/gcc/arm-none-eabi/14.3.1/../../../../arm-none-eabi/bin/ld.exe: (LED_Init): Unknown destination type (ARM/Thumb) in User/main.o main.c:(.text+0x8): dangerous relocation: unsupported relocation C:/Users/13336/Desktop/test/arm-gnu-toolchain-14.3.rel1-mingw-w64-i686-arm-none-eabi/bin/../lib/gcc/arm-none-eabi/14.3.1/../../../../arm-none-eabi/bin/ld.exe: main.c:(.text+0xc): undefined reference to `LED_On' C:/Users/13336/Desktop/test/arm-gnu-toolchain-14.3.rel1-mingw-w64-i686-arm-none-eabi/bin/../lib/gcc/arm-none-eabi/14.3.1/../../../../arm-none-eabi/bin/ld.exe: (LED_On): Unknown destination type (ARM/Thumb) in User/main.o main.c:(.text+0xc): dangerous relocation: unsupported relocation C:/Users/13336/Desktop/test/arm-gnu-toolchain-14.3.rel1-mingw-w64-i686-arm-none-eabi/bin/../lib/gcc/arm-none-eabi/14.3.1/../../../../arm-none-eabi/bin/ld.exe: main.c:(.text+0x14): undefined reference to `Delay_ms' C:/Users/13336/Desktop/test/arm-gnu-toolchain-14.3.rel1-mingw-w64-i686-arm-none-eabi/bin/../lib/gcc/arm-none-eabi/14.3.1/../../../../arm-none-eabi/bin/ld.exe: (Delay_ms): Unknown destination type (ARM/Thumb) in User/main.o main.c:(.text+0x14): dangerous relocation: unsupported relocation C:/Users/13336/Desktop/test/arm-gnu-toolchain-14.3.rel1-mingw-w64-i686-arm-none-eabi/bin/../lib/gcc/arm-none-eabi/14.3.1/../../../../arm-none-eabi/bin/ld.exe: main.c:(.text+0x18): undefined reference to `LED_Off' C:/Users/13336/Desktop/test/arm-gnu-toolchain-14.3.rel1-mingw-w64-i686-arm-none-eabi/bin/../lib/gcc/arm-none-eabi/14.3.1/../../../../arm-none-eabi/bin/ld.exe: (LED_Off): Unknown destination type (ARM/Thumb) in User/main.o main.c:(.text+0x18): dangerous relocation: unsupported relocation C:/Users/13336/Desktop/test/arm-gnu-toolchain-14.3.rel1-mingw-w64-i686-arm-none-eabi/bin/../lib/gcc/arm-none-eabi/14.3.1/../../../../arm-none-eabi/bin/ld.exe: main.c:(.text+0x20): undefined reference to `Delay_ms' C:/Users/13336/Desktop/test/arm-gnu-toolchain-14.3.rel1-mingw-w64-i686-arm-none-eabi/bin/../lib/gcc/arm-none-eabi/14.3.1/../../../../arm-none-eabi/bin/ld.exe: (Delay_ms): Unknown destination type (ARM/Thumb) in User/main.o main.c:(.text+0x20): dangerous relocation: unsupported relocation Memory region Used Size Region Size %age Used FLASH: 1540 B 64 KB 2.35% RAM: 1984 B 20 KB 9.69% collect2.exe: error: ld returned 1 exit status mingw32-make: *** [makefile:55: build/stm32f103_project.elf] Error 1 PS C:\Users\13336\Desktop\test\vscode_stm32\model_02>”这报错是什么问题
09-29
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值