Installation instructions for gdb & gdbserver on ARM7TDMI

本文档详细介绍了如何为基于ARM7TDMI的uClinux目标编译GDB及GDBserver的过程。包括了必要的环境配置、源码下载、内核补丁应用、uClibc编译、GDB及GDBserver的编译步骤等。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

[uClinux-dev] Installation instructions for gdb & gdbserver on ARM7TDMI

Bernhard Kuhn bkuhn at lineo.com
Fri Sep 20 17:59:50 EDT 2002

 


Hi everybody!

It took me quite some time to figure out how to get gdb and gdbserver
combiled for an ARM7TDMI based uClinux target. Below, you will find
a detailed installation instruction. BTW.: Thanks to Ho Lee for
providing
usefull hints!

I have briefly tested gdb and gdbserver with a simple target program
and it seems to work fine (breakpoint setting, single stepping etc.),
but as always YMMV :-) Feedback appreciated!

best regards

Bernhard



arm-elf-gdb installation
========================

This document describes how to compile gdb and gdbserver
for ARM7TDMI uClinux targets. This desciption was tested
on RedHat 6.2 with an Atmel AT75C220-DK but should work
with other ARM7TDMI target as well - feedback appreciated!

It is assumed that you already have an arm-elf cross-compilation
toolchain installed and a recent uClinux-distribution (20010701)
running on your target.


Installation procedure
----------------------

At the very beginning, you need to define where the kernel
sources are located, i.e.:

  export KERNEL_SOURCE=$HOME/uClinux-dist/linux-2.4.x


Then, create some working directories:

  export GDB_DEVEL_PREFIX=$HOME/arm-elf-gdb
  export DEVEL_PREFIX=$GDB_DEVEL_PREFIX/usr
  export PKGDIR=$GDB_DEVEL_PREFIX/packages
  export SRCDIR=$GDB_DEVEL_PREFIX/src
  install -d $PKGDIR
  install -d $SRCDIR


Download the following files to $PKGDIR:

 
http://www.uclinux.org/~bkuhn/Toolchain/20020920/uClibc-0.9.15-Config.armnommu
  http://www.us.kernel.org/pub/linux/libs/uclibc/uClibc-0.9.15.tar.bz2
  ftp://sources.redhat.com/pub/gdb/releases/gdb-5.2.1.tar.bz2
 
http://www.uclinux.org/~bkuhn/Toolchain/20020920/patch-gdb-5.2.1-arm7tdmi-20020920
 
http://www.uclinux.org/~bkuhn/Toolchain/20020920/patch-uClinux-2.4.17-ptrace


Now, you need to patch the kernel sources:

  cd $KERNEL_SOURCE/arch/armnommu/kernel
  patch ptrace.c < $PKGDIR/patch-uClinux-2.4.17-ptrace

Recompile the kernel and deploy it to your target.


Then, build uClibc with libm disabled:

  cd $SRCDIR
  tar -xIf $PKGDIR/uClibc-0.9.15.tar.bz2
  cd uClibc-0.9.15
  cp $PKGDIR/uClibc-0.9.15-Config.armnommu Config
  make
  make install


Build gdb for arm-elf:

  cd $SRCDIR
  tar -xIf $PKGDIR/gdb-5.2.1.tar.bz2
  cd gdb-5.2.1
  patch -p1 < $PKGDIR/patch-gdb-5.2.1-arm7tdmi-20020920
  ./configure --target=arm-elf --host=i386-linux --build=i386-linux
  make

Now, strip gdb/gdb and copy it to a convenient location, i.e. to
/usr/local/bin/arm-elf-gdb


Build gdbserver for arm-elf:

  cd $SRCDIR/gdb-5.2.1/gdb/gdbserver

  chmod u+x configure
  ./configure --target=arm-linux --host=arm-linux --build=i386-linux

  mv Makefile Makefile.orig
  cat Makefile.orig | sed -e "s/CC = gcc/# CC = gcc/" | sed -e "s/CFLAGS
= -g -O2/# CFLAGS = -g -O2/" > Makefile

  mv config.h config.h.orig
  cat config.h.orig | sed -e "s/#define HAVE_SYS_REG_H 1////* #undef
HAVE_SYS_REG_H 1 ///*/" > config.h

  CC=arm-elf-gcc CFLAGS="-g -Os -nostdinc -I$DEVEL_PREFIX/include
-I/opt/uClinux/toolchain-arm-elf/lib/gcc-lib/arm-elf/2.95.3/include
-D__linux__ -D__uClinux__ -D__linux__ -D__ELF__ -DNO_MM"
XM_CLIBS="-nostdlib -L$DEVEL_PREFIX/lib -nostartfiles
$DEVEL_PREFIX/lib/crt0.o $DEVEL_PREFIX/lib/crti.o
$DEVEL_PREFIX/lib/crtn.o -lc -lgcc  -Wl,-elf2flt" make

Admitidly, this line locks ugly but works fine :-)

Finaly, deploy the gdbserver binary to your target filesystem.


Precomopiled binaries
---------------------

If you are not successfull with compiling gdb and gdbserver
yourself, you may download some precompiled binaries:

  http://www.uclinux.org/~bkuhn/Toolchain/20020920/arm-elf-gdb.bz2
  http://www.uclinux.org/~bkuhn/Toolchain/20020920/gdbserver.bz2


Bernhard Kuhn, Senior Software Engineer, Embedix Inc.
Fri Sep 20 16:42:41 CEST 2002


-- 
Bernhard Kuhn, Senior Software Engineer, Lineo Inc. (Where Open Meets
Smart)

This message resent by the uclinux-dev at uclinux.org list server http://www.uClinux.org/


 


More information about the uClinux-dev mailing list

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值