Chinaunix首页 | 论坛 | 博客
  • 博客访问: 25586
  • 博文数量: 6
  • 博客积分: 240
  • 博客等级: 二等列兵
  • 技术积分: 70
  • 用 户 组: 普通用户
  • 注册时间: 2009-08-27 23:50
文章分类

全部博文(6)

文章存档

2010年(2)

2009年(4)

我的朋友
最近访客

分类: 嵌入式

2009-08-30 02:26:28

(更正,cygwin1.7版经过一段时间测试,utf-8支持导致的问题多多,发现的问题有,对windows unicode-16,unicode-32目录名不能正确识别,导致安装的问题,发生很多奇怪的问题,一个是binmode取消后在cygpath调用上很多工具出错,/反斜线\正斜线路径转换问题,在生成libtool,Makefile时,生成的文件出现重复行,没法使用,只好用回cygwin 1.5了。)
 

最近为移植ecos作些准备,在cygwin1.7版上构建Arm toolchain,费了些周折,在此备忘。

-------------------------------------------

采用的版本:

cygwin1.7--最新的beta版,支持宽字符,可以支持gbk,utf8汉字,当然这跟交叉环境无关,一般是不需要NLS支持的,尽可以在每项编译时--disable-nls,我没有这么做,本身交叉环境不支持的话编译进去了也没用,不管它了。

 
binutils-2.19.1最新发布版
gcc4.4branch SVN20090828
newlib  CVS 20090828检出
gdb 6.8.50.20090829-cvs  git检出版本
-------------------------------------------
提示:
1,没有采用ecoscentric,codesourcery,及openhardware的相关补丁,大概看了一下,基本不是bug修正,很多相对优化及改良的手段各有千秋,等以后遇到问题再回过头去改官方版本吧。
2,所有的configure及make过程记录到文件里,以便遇到错误时排错和以后遇到问题的时候回查方便。
3,看了gcc4.4的说明,gcc4.4在arm-eabi上作了不少改进。arm-eabi在浮点运算上比以往的arm-elf性能提升不少。
4,特别注意了multilib的问题,gcc newlib缺省情况下是enable的,也无需显式的--enable-multilib。
5,arm-eabi需要libgmp,libgmp-devel,libmpfr,libmpfr-devel,devel包含有头文件。
6,libssp以前编译gcc时有个bug,不管是在交叉编译环境也带上了libssp,gcc4.4下现在已经不是了。
 
-------------------------------------------
1,下载软件包,建立基本构建环境
mkdir -p /usr/local/ecos/gnutools  #以后构建的交叉编译调试工具放在这儿
mkdir -p /usr/local/ecos/src       #放源软件包
mkdir -p /usr/local/ecos/build-binutils
mkdir -p /usr/local/ecos/build-gcc #gcc第一次编译
mkdir -p /usr/local/ecos/build-newlib 
mkdir -p /usr/local/ecos/build-gcc2 #gcc第二次编译
mkdir -p /usr/local/ecos/build-gdb
 
2,编译binutils 
../src/binutils-2.19.1/configure --target=arm-eabi --prefix=/usr/local/ecos/gnutools -v 2>&1 | tee configure.out
make -w all 2>&1 | tee make.out
make install
 
export PATH=/usr/local/ecos/gnutools/bin:$PATH (别忘了这个,gcc需要找到binutils路径),直接加到/etc/profile或者~/.bashrc里。
 
3,为newlib编译gcc编译器
../src/gcc-4_4-branch/configure --target=arm-eabi --prefix=/usr/local/ecos/gnutools --without-headers --with-newlib --with-gnu-ar --with-gnu-as --with-gnu-ld  --enable-languages=c,c++ -v 2>&1 | tee configure.out
make -w all-gcc 2>&1 | tee make.out
make install-gcc
(注意只编译gcc相关)
 
4,编译newlib
 
../src/newlib/newlib/configure --target=arm-eabi --prefix=/usr/local/ecos/gnutools --with-newlib -v 2>&1 | tee configure.out
make -w all 2>&1 | tee make.out
make install
 
5,第二次完整编译gcc
(注意!)在/src/gcc-4_4-branch/下建2个软链接:
ln -s ../newlib/libgloss  .
ln -s ../newlib/newlib .
 
../src/gcc-4_4-branch/configure --target=arm-eabi --prefix=/usr/local/ecos/gnutools --with-newlib --with-gnu-ar --with-gnu-as --with-gnu-ld --enable-languages=c,c++ -v 2>&1 | tee configure.out
make -w all 2>&1 | tee make.out
make install
 
6,安装gdb,没必要编译insight包,cygwin下带insight,而且insight不需要交叉编译的哦,开始走了弯路,编译insight时tcl的编译是有问题的。
../src/gdb/configure --target=arm-eabi --prefix=/usr/local/ecos/gnutools --disable-werror -v 2>&1 | tee configure.out
 
注意disable Werror,缺省是enable打开的,警告变错误编译不能通过。
make -w all 2>&1 | tee make.out
make install
 
7,检验
其实gcc,gdb都有test检查的,但很多检查是不适合交叉编译工具的,只适合native。
自己编一个hello,world简单程序,用arm-eabi-gcc hello.c -o hello编译后,用arm-eabi-run hello来检验一下,如果没有问题,基本算是通过了。
 
 
 
 
 
 
阅读(3008) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~