Linux交叉編譯環境終于搭建完成具體步驟:
0、軟件請到友善之臂的官網下載
1、解壓
tar zxvf arm-linux-gcc-4.4.3-20100728.tar.gz
-C/(別make了,直接解壓后就可以)
2、設置環境變量:首先
vi ~/.bashrc
然后在最后加上
export
PATH=$PATH:/opt/FriendlyARM/toolschain/4.4.3/bin
3、使環境變量立即生效:
source ~/.bashrc
4、驗證:arm-linux-gcc-v,我的顯示如下:
aidway@aidway-desktop:~$
arm-linux-gcc -v
Using
built-in specs.
Target:
arm-none-linux-gnueabi
Configured
with:
/opt/FriendlyARM/mini2440/build-toolschain/working/src/gcc-4.4.3/configure--build=i386-build_redhat-linux-gnu
--host=i386-build_redhat-linux-gnu --target=arm-none-linux-gnueabi
--prefix=/opt/FriendlyARM/toolschain/4.4.3
--with-sysroot=/opt/FriendlyARM/toolschain/4.4.3/arm-none-linux-gnueabi//sys-root
--enable-languages=c,c++ --disable-multilib --with-arch=armv4t
--with-cpu=arm920t --with-tune=arm920t --with-float=soft
--with-pkgversion=ctng-1.6.1 --disable-sjlj-exceptions
--enable-__cxa_atexit --with-gmp=/opt/FriendlyARM/toolschain/4.4.3
--with-mpfr=/opt/FriendlyARM/toolschain/4.4.3
--with-ppl=/opt/FriendlyARM/toolschain/4.4.3
--with-cloog=/opt/FriendlyARM/toolschain/4.4.3
--with-mpc=/opt/FriendlyARM/toolschain/4.4.3
--with-local-prefix=/opt/FriendlyARM/toolschain/4.4.3/arm-none-linux-gnueabi//sys-root
--disable-nls --enable-threads=posix --enable-symvers=gnu
--enable-c99 --enable-long-long
--enable-target-optspace
Thread model:
posix
gcc version
4.4.3 (ctng-1.6.1)
5、編寫一個簡單的hello程序,用arm-linux-gcc
-o hello hello.c
編譯,生成hello文件,將該文件上傳到ARM板(我用的使2440),在ARM板上用./hello
運行程序,如果所有步驟正確的話,將能夠正常運行。