1 2 3 |
$sudo apt-get install gcc-arm-linux-gnueabihf |
hf是单独的支持硬件浮点运算的gcc版本,如果不想编译成只支持硬件浮点类型,可以在编译时添加参数
-mfloat-abi=softfp
编辑hello程序测试一下:
hello.c
1 2 3 4 5 6 7 8 9 |
#include<stdio.h> int main() { printf("hello world!\n"); return 0; } |
Makefile
1 2 3 4 5 6 7 |
CROSS_COMPILE=arm-linux-gnueabihf ARCH=arm all: hello.c ${CROSS_COMPILE}-gcc -o hello hello.c |
查看文件信息:
1 2 3 4 |
$file hello hello: ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.32, BuildID[sha1]=c0b51c64753fcf75a50e90f255bc50f78a4826c2, not stripped |
使用的系统环境是Ubuntu14.04 x64 version