测试环境:Ubuntu 14.04 64bit
1、安装arm-linux-gnueabi:
$sudo apt-get install libc6-armel-cross libc6-dev-armel-cross $sudo apt-get install binutils-arm-linux-gnueabi $sudo apt-get install libncurses5-dev
2、如果你的开发板是Arietta, Aria 或 FOX,则安装如下:
$sudo apt-get install gcc-arm-linux-gnueabi $sudo apt-get install g++-arm-linux-gnueabi
如果你的开发板是Acqua,则安装如下:
$sudo apt-get install gcc-arm-linux-gnueabihf $sudo apt-get install g++-arm-linux-gnueabihf
3、到此环境安装完毕,测试如下代码,test.c:
#include "stdio.h"
int main(void) {
printf("Test by cofface !\n");
return 0;
}
4、编译指令:
$arm-linux-gnueabi-gcc test.c -o test
5、编译完成后拷贝test文件到开发板上运行:
scp test root@[开发板ip]:/root
6、开发板返回结果:
~#./test Test by cofface !
附:编译C++方式:
1、测试代码:
#include "iostream"
using namespace std;
int main(int argc, char *argv[]) {
cout << "Test by cofface !" << endl;
return 0;
}
2、编译指令:
$arm-linux-gnueabi-g++ test.cc -o test
3、编译完成后拷贝test文件到开发板上运行:
$scp test root@[开发板ip]:/root
4、开发板返回结果:
~#./test Test by cofface !
转载请注明来源:Cofface Blog » ubuntu搭建编译arm bin环境
