s3c2410开发环境建立

来源:互联网 发布:天天酷跑数据 编辑:程序博客网 时间:2024/06/10 12:02

首先介绍的整体的环境是ubuntu 9.04 gcc的版本是4.1.下面是具体的环境建立

(1)arm-linux-gcc安装

在下面的网址上http://www.handhelds.org/download/projects/toolchain/下载arm-linux-gcc-3.4.1.tar.bz2

执行下面的命令:

将arm-linux-gcc-3.4.1.tar.bz2复制到/tmp下

bunzip2 arm-linux-gcc-3.4.1.tar.bz2生成arm-linux-gcc-3.4.1.tar

tar xvf arm-linux-gcc-3.4.1.tar -C /将该tar包解压到/usr/local/arm目录下

修改/etc/bash.bashrc新增加下面

if [ -d /usr/local/arm/2.95.3 ] ; then
PATH=/usr/local/arm/2.95.3/bin:"${PATH}"
fi

注意的是上面的PATH后没有空格

是上面的修改生效 source /etc/profile

下面是测试程序hello.c

#include <stdio.h>

int main ()

{

      printf("hello world/n");

      return 0;
}

使用下面的命令编译arm-linux-gcc hello.c -o hello,于是生成二进制hello

 

(2)Jflash-s3c2410安装,S3C2410芯片的JTAG工具

到chinaunix上下载Jflash-s3c2410bz2,解压,进入解压完的目录

make all(查看Makefile可知)

第一次时出现下面的error:asm/io.h : No such file or directory。google之得到如下的solution。http://forum.ubuntu.org.cn/viewtopic.php?f=70&t=255593&view=next

Notes on source code: Some people have reported that for some reason this code does not work on theuir systems. If you have problems in getting this to work, try tho following chagest to code: replace the lines "#include <unistd.h%gt;" and "#include <asm/io.h>" with line "#include <sys/io.h>" and then replace line "#define base 0x378" with "#define base 0x0378".

这是人家原文的话,要仔细看。
将<asm/io.h>改为<sys/io.h>

然后生成Jflash-s3c2410,最后将该文件复制到/usr/local/bin/下

 

(3)安装gdb调试工具

首先在http://ftp.gnu.org/gnu/gdb/下载gdb-7.0.tar.gz(gcc -4.1下测试通过,没有安装gcc-4.1的话,可以使用sudo apt-get install gcc-4.1来安装)

执行下面的命令:

cp XXX/gdb-7.0.tar.gz /tmp(XXX是gdb-7.0.tar.gz路径)

cd /tmp

tar zxvf gdb-7.0.tar.gz

cd gdb-7.0

export CC=gcc-4.1

./configure --target=arm-linux

make

sudo make install

执行完上面的命令之后,会安装完成arm-linux-gdb和gdbserver。

 

在安装arm-linux-gdb时,最初使用的是gdb-6.3.tar.gz,但是编译时在sim/arm/iwmmxt.c上出现编译错误,google该错误得到下面的solution,http://hi.baidu.com/zjsxycli/blog/item/99863fddf1be55196227986e.html

将2117行的    (signed long long) t += s;   
改成        (signed long long)t;    t = (signed long long)(t + s);


将2133行的    (signed long long) wR[BITS (12, 15)] += (signed long long) t;   
改成    {(signed long long) wR[BITS (12, 15)];    wR[BITS (12, 15)] = (signed long long)(wR[BITS (12, 15)] + t);}


将2169行的    (signed long) s1 = a * b;   
改成    (signed long) s1;    s1 =(signed long)(a * b);


将2177行的    (signed long) s2 = a * b;
改成    (signed long) s2;    s2 =(signed long)(a * b);


将2186行的    (unsigned long) s1 = a * b;
改成    (unsigned long) s1;    s1 =(unsigned long)(a * b);


将2191行的    (signed long) s2 = a * b;
改成    (unsigned long) s2;    s2 =(unsigned long)(a * b);



编译Gdbserver:

linux-arm-low.c:26:21: error: sys/reg.h: No such file or directory
make: *** [linux-arm-low.o] 错误 1

根据在linux-arm-low.c中:
#ifdef HAVE_SYS_REG_H
#include <sys/reg.h>
#endif

在gdb/gdbserver/config.h修改如下:
/* Define if you have the <sys/reg.h> header file.  */
#define HAVE_SYS_REG_H 1

/* Define if you have the <sys/reg.h> header file.  */
//#define HAVE_SYS_REG_H 1 省略

 

但是按照上面的方法实验,依然出错。所以怀疑是版本的问题,果然在换了一个较高的版本之后,成功。

原创粉丝点击