|
这个比较简单,但是对于新手刚刚入门应该还算可以吧。
拷贝arm-linux-gcc-3.4.1.tar.bz2至根目录/。
进入根目录,执行解包:
[root@localhost root]# cd /
[root@localhost /]#tar xjvf arm-linux-gcc-3.4.1.tar.bz2
设置系统环境变量:
[root@localhost arm]#export PATH=$PATH:/usr/local/arm/3.4.13.4.1/bin
这样,内核或其他应用程序均可以用arm-linux-来指定使用该交叉编译器。
自行编写一个程序测试:
示例helloworld.c:
#include <stdio.h>
int main(void)
{
printf("hello world\n");
return 0;
}
然后在命令行执行:
$arm-linux-gcc helloworld.c -o helloworld
$file helloworld
如果输出以下信息,说明编译成功。
helloworld: ELF 32-bit LSB executeable, ARM, version 1, dynamically linked (uses shared libs), not stripped
编译成功后或者用ZM协议或者用nfs将文件扔到开发板中,
运行:
./helloworld
移植成功~~~~ |
|