分享

交叉编译器 Cross Compiler

 happy123god 2012-07-17


Install new environment with ARM GNU compiler

 

The toolchain actually consists of a number of components. The main one is the compiler itself

gcc, which can be native to the host or a cross-compiler. This is supported by gnuarm, a set of tools for manipulating binaries. These components are all you need for compiling the kernel, but almost anything else you compile also needs the C-library glibc.

 

Installing Toolchain

ARM cross compiler is a package which includes:

1.    GCC version 4.2.1

2.    Binutils 2.17.9

3.    glibc 2.3.2

4.    t-arm-elf

Under linux environment, PATH must be set in order to let program to find the relevance compiler, which is we use ARM GCC for our board building environment.


After toolchain is well set, compiler can be ordered wherever a program is needed to be compiled.

 

For example :

1.    Make a directory of program under “/tmp/test-hello” with a program called “hello.c”.

2.    Toolchain is set under “/usr/local/gnu-arm/bin/arm-gcc-cc”

3.    Program is set under “/tmp/test-hello/hello.c”

4.    Do “export PATH=/usr/local/gnu-arm/bin:$PATH”








Linux下的交叉编译器


 (转自: http://blog./GetEntry.do?id=369358622&owner=220977199 )

大家都知道gcc是一个很先进的编译器,可以支持很多不同的语言的平台,由于毕设上要用到arm,所以也没有办法只好去弄了个交叉编译器啦。

 

进入主题,我们弄linux下的交叉编译器呢,主要有两种方式,一呢是从source code自己编译,二呢是直接下载二进制包(废话嘛,XD)

 

先说从source code编译把:

从source code编译也有两种方式:

其一呢是直接自己去下载,自己去打补丁,自己去编译,当然这种方法的难度是超高的,具体的做法呢可以去看:

http://www.ibm.com/developerworks/cn/linux/l-embcmpl/

 

其二呢是利用一个脚本,叫做crosstool,这个东西真是好的可以,他会根据你的配置,自动的下载合适的源代码,打上合适的补丁,再按照合适的顺序编译,而且他可以支持很多的不同的目标平台,不同的gcc版本,不同的glibc的版本,可是怎么做呢? Google is your friend! 哈哈。

 

当然对于像我们这种那么懒的人,对编译编译器也没有什么兴趣的话呢,就直接使用现成的二进制包就ok了啦。

 

有一位叫做Martin的老兄很善良的帮我们编译好了这个东东,还做成了安装包,大家只要去:

http:///martin/crosstool/

就可以下载到了。

注意哦,如果你使用的是arm9处理器,那么必须下载armv4t-*,而对于运气好可以玩arm10,arm11的兄弟姐妹们,你们应该下载arm*

    本站是提供个人知识管理的网络存储空间,所有内容均由用户发布,不代表本站观点。请注意甄别内容中的联系方式、诱导购买等信息,谨防诈骗。如发现有害或侵权内容,请点击一键举报。
    转藏 分享 献花(0

    0条评论

    发表

    请遵守用户 评论公约

    类似文章 更多