s3c2410开发环境建立
首先介紹的整體的環(huán)境是ubuntu 9.04 gcc的版本是4.1.下面是具體的環(huán)境建立
(1)arm-linux-gcc安裝
在下面的網(wǎng)址上http://www.handhelds.org/download/projects/toolchain/下載arm-linux-gcc-3.4.1.tar.bz2
執(zhí)行下面的命令:
將arm-linux-gcc-3.4.1.tar.bz2復(fù)制到/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
下面是測(cè)試程序hello.c
#include <stdio.h>
int main ()
{
?? ? ?printf("hello world\n");
?? ? ?return 0;
}
使用下面的命令編譯arm-linux-gcc hello.c -o hello,于是生成二進(jìn)制hello
(2)Jflash-s3c2410安裝,S3C2410芯片的JTAG工具
到chinaunix上下載Jflash-s3c2410bz2,解壓,進(jìn)入解壓完的目錄
make all(查看Makefile可知)
第一次時(shí)出現(xiàn)下面的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".
這是人家原文的話,要仔細(xì)看。
將<asm/io.h>改為<sys/io.h>
然后生成Jflash-s3c2410,最后將該文件復(fù)制到/usr/local/bin/下
(3)安裝gdb調(diào)試工具
首先在http://ftp.gnu.org/gnu/gdb/下載gdb-7.0.tar.gz(gcc -4.1下測(cè)試通過,沒有安裝gcc-4.1的話,可以使用sudo apt-get install gcc-4.1來安裝)
執(zhí)行下面的命令:
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
執(zhí)行完上面的命令之后,會(huì)安裝完成arm-linux-gdb和gdbserver。
在安裝arm-linux-gdb時(shí),最初使用的是gdb-6.3.tar.gz,但是編譯時(shí)在sim/arm/iwmmxt.c上出現(xiàn)編譯錯(cuò)誤,google該錯(cuò)誤得到下面的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] 錯(cuò)誤 1
根據(jù)在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 省略
但是按照上面的方法實(shí)驗(yàn),依然出錯(cuò)。所以懷疑是版本的問題,果然在換了一個(gè)較高的版本之后,成功。
轉(zhuǎn)載于:https://www.cnblogs.com/xuqiang/archive/2010/02/16/1953750.html
總結(jié)
以上是生活随笔為你收集整理的s3c2410开发环境建立的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: [翻译]C#数据结构与算法 – 第六章B
- 下一篇: How to resolve confl