Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1924209
  • 博文数量: 261
  • 博客积分: 8073
  • 博客等级: 中将
  • 技术积分: 2363
  • 用 户 组: 普通用户
  • 注册时间: 2006-04-10 15:23
文章分类

全部博文(261)

文章存档

2013年(1)

2012年(1)

2011年(50)

2010年(34)

2009年(4)

2008年(17)

2007年(55)

2006年(99)

分类:

2007-11-30 16:44:06

    从上下载了or1k并且下载到了FPGA上,当使用GDB通过jtag调试样例程序时,却出现了如下问题:
(gdb) target jtag jtag://localhost:9999
Remote or1k debugging using jtag://localhost:9999
Debug group should be available in the or1k implementation. 
从网上搜索,有人提到是应为gdb5.3版本的问题,于是从中下载了现行最新的gdb5.3版本,并根据
教程下载了相应的补丁和源码包,重新建立GNU TOOLS和GDB。

1.建立Binutils
1)下载源码包和补丁
  下载官方源码包:
  下载补丁:
2)解压
  tar zxvf binutils-2.16.1.tar.gz
3)打补丁
  cd binutils-2.16.1
  bzcat binutils-2.16.1-unified.diff.bz2 | patch -p1
4)配置安装
  # mkdir ../b-b
  # ../binutils-2.16.1/configure --target=or32-elf \ 
--prefix=/opt/or32-elf
# make all install
# export PATH=/opt/or32-elf/bin:$PATH
# cd ..
2.建立GCC
1)下载源码包和补丁
  下载官方源码包:
  下载补丁:
2)解压
  tar zxvf gcc-3.4.4.tar.gz
3)打补丁
  # cd gcc-3.4.4
  # patch -p1 < gcc-3.4.4-or32-unified.diff
4)配置安装
  # mkdir ../b-gcc
  # ../gcc-3.4.4/configure --target=or32-elf --prefix=/opt/or32-elf \
--with-local-prefix=/opt/or32-elf/or32-elf --with-gnu-as \
--with-gnu-ld --verbose --enable-languages=c
# make all install
# cd ..
3.建立GDB

1)下载源码包和补丁
  下载官方源码包:
2)解压
  tar zxvf or1k_gdb-5_3.tar.gz
3)配置安装
  # mkdir b-gdb
  # ../or1k/gdb-5.3/configure --target=or32-elf 
# make all
# cp gdb/gdb /opt/or32-uclinux/bin/or32-uclinux-gdb
# cd ..

在建立GDB过程中出现了一些问题:

我的主机环境是FC6,GCC4.1.1。
问题1.
../../../tarballs/gdb-5.3/opcodes/or32-dis.c:65: error: static declaration of 'or32_extract' follows non-static declaration
../../../tarballs/gdb-5.3/opcodes/../include/opcode/or32.h:223: error: previous declaration of 'or32_extract' was here

解决方法:
由于or32-dis.c和or32.h中or32_extract声明与定义不一致。
gdb-5.3/opcodes/or32-dis.c:65中or32_extract前面带static
gdb-5.3/include/opcode/or32.h:223中or32_extract前面不带static
造成不一致。
修改其中一处即可


问题2.
../../gdb-5.3/gdb/gdbtypes.c: In function 鈘ecursive_dump_type?
../../gdb-5.3/gdb/gdbtypes.c:2961: error: invalid lvalue in increment

解决方法:
由于gdb5.3不能用gcc4.*编译只能用gcc3编译。左值指针加加认为是错误。
在FC6中提供了compat-gcc-34-3.4.6-4.i386.rpm包,安装以后可以在不影响原GCC的情况下使用gcc34。

问题3.
../../../tarballs/gdb-5.3/gdb/or1k-tdep.c: In function `htrace_print_command':
../../../tarballs/gdb-5.3/gdb/or1k-tdep.c:2280: error: incompatible type for argument 2 of `print_data_struct'

解决方法:
在or1k-tdep.c中的htrace_print_command函数声明了
struct htrace_data_struct *td;
并且生成动态数组
  td=(struct htrace_data_struct *)malloc(TRACE_DATA_SIZE * length);
但是在调用
              print_data_struct (from + i, td[i]);
时,print_data_struct 第二个参数是struct htrace_data_struct *,而传递给他的却struct htrace_data_struct,所以出错。
可以修改
              print_data_struct (from + i, td[i]);

              print_data_struct (from + i, &td[i]);

现在生成了新的or32-elf-gdb,还不知道是否好用。
如果不好用,在
中有人提供了建立工具链和GDB的脚本,可以下载试试。


阅读(3949) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~