Neo 1973 OpenOCD

From Openmoko

(Redirected from Neo1973 OpenOCD)
Jump to: navigation, search

Contents

About OpenOCD

OpenOCD is a 100% free software On-chip-debugger for commonly-found ARM JTAG probes such as wiggler, chamaeleon, jtag-key and others, like the Debug Board.

It provides a human-readable telnet interface for manually halting/resuming the target device, reading/writing registers and memory, etc.

In addition, it provides a RDI (remote debugger interface) on a TCP port. This interface can be used by gdb (the GNU Debugger).

The GTA01 development team used OpenOCD with a wiggler compatible probe as their ICE solution in the very beginning, until they had designed their own Debug Board.

Getting OpenOCD

MokoMakefile

The MokoMakefile "make openmoko-devel-tools" target will build statically-linked openocd and dfu-util binaries. The "bitbake openocd-native" command may also be used.

Debian Package

We now have a Debian binary package of OpenOCD, available from http://people.openmoko.org/laforge/dpkg. Installing this package is the preferred method to install OpenOCD on your development machine like

dpkg --install openocd_82-1_i386.deb

Debian/Unstable also contains an OpenOCD build.

Gentoo Ebuild

There is an experimental ebuild for openocd in the gentoo bugzilla - seems to be already in Gentoo now (May 2008) however you may need to edit the e-build because it has no keywords enabled by default: edit /usr/portage/dev-embedded/openocd/openocd-9999.ebuild and replace KEYWORDS="" with KEYWORDS="amd64 x86". Remember to regenerate the digest afterwards:

ebuild /usr/portage/dev-embedded/openocd/openocd-9999.ebuild digest
# Build openocd
emerge libftdi
USE="ftdi ft2232" emerge openocd

Source Code

OpenOCD Revision 82 and later have been proven to work with our QT2410 and Neo1973 target board and wiggler as well as Amontect JTAGkey and JTAGkey tiny. You can e.g. check rev. 130 out of the OpenOCD subversion via

svn co -r 130 http://svn.berlios.de/svnroot/repos/openocd/trunk

Windows Binaries

An OpenOCD installer based on libftdi can be found at the page from Freddie Chopin

Configuration

User:HaraldWelte has provided a openocd.cfg configuration file for use of OpenOCD with wiggler and the QT2410 target board.

Using OpenOCD

We cannot provide a full manual for OpenOCD, but please check U-Boot#Using_JTAG_to_boot_from_RAM and NAND bad blocks#JTAG_.2F_OpenOCD_.2F_u-boot_RAM_based, as well as the Neo1973 OpenOCD#Using OpenOCD telnet interface section below.

Known Bugs and Troubleshooting

CP15 register read/write of ARM920T core not working

This has been reported upstream. Bugfix pending.

Did you turn it on ?

An easily made but devastating mistake is to forget to actually activate the CPU. Just connecting power is not enough ! Press and hold the power button until the boot loader does its count-down, or, in case there is no runnable boot loader, the CPU keeps itself busy.

number of discovered devices in JTAG chain doesn't match configuration

You get something like:

Error:   jtag.c:1224 jtag_examine_chain(): number of discovered devices in JTAG chain (51) doesn't match configuration (1)

This seems like a libftdi initialization bug. Sometimes the FT2232 doesn't get completely reset into a sane state at startup of OpenOCD. Please unplug the USB cable from the Amontec JTAGkey / Debug Board and re-plug. It should immediately work the next time. Bugfix would be appreciated a lot!

JTAG communication failure

Another common error is this one:

JTAG communication failure, check connection, JTAG interface, target power etc.

Also this one is fixed by unplugging and re-plugging USB.

OpenOCD and Debug Board

libftdi-0.8

If you want to use OpenOCD with our Debug Board v2, and want to use the serial port simultaneously with OpenOCD, you need libftdi-0.8 or later. Chances are high that your distribution still ships an earlier version of libftdi, so you might want to download it from http://www.intra2net.com/de/produkte/opensource/ftdi/ and build yourself.

openocd.cfg

This is an OpenOCD config that was tested with OpenOCD version 0.6.1 and debug board v3 (using new ftdi driver, doesn't require libftdi):

source [find interface/ftdi/neodb.cfg]
source [find target/samsung_s3c2440.cfg]

adapter_khz 1000

reset_config trst_and_srst

init
reset run
sleep 5000
halt

Here follow configs for some ancient OpenOCD versions:

This is an openocd.cfg that is known to work with Debug Board (v2/v3), Neo1973 Hardware#GTA01Bv3 and OpenOCD 130:

telnet_port 4444
gdb_port 3333
interface ft2232
jtag_speed 0
ft2232_vid_pid 0x1457 0x5118
ft2232_layout "jtagkey"
reset_config trst_and_srst
jtag_device 4 0x1 0xf 0xe
daemon_startup attach
target arm920t little reset_run 0 arm920t
working_area 0 0x200000 0x4000 backup
run_and_halt_time 0 5000

For later versions of OpenOCD you may need to specify the device description. For the v2 Debug board add this line to your openocd.cfg:

ft2232_device_desc "Debug Board for Neo1973 A"

If you are using the libftdi version on Linux, and if you see this iProduct string in your lsusb output "Debug Board for Neo1973", please add this line instead.

ft2232_device_desc "Debug Board for Neo1973"

For some versions of the v3 Debug board the vid_pid need to be 0x0403 0x6010. However, commenting out (with #) the ft2232_ lines altogether makes openocd autodetect the Debug board correctly.

For OpenOCD 0.2.0, the config file format has changed. You can start from this ("works for me"):

interface ft2232
ft2232_device_desc "Debug Board for Neo1973 A"
ft2232_layout "jtagkey"
ft2232_vid_pid 0x1457 0x5118

source [find target/samsung_s3c2440.cfg]

reset_config trst_and_srst

#jtag_khz 0

gdb_port 3333
tcl_port 6666
telnet_port 4444

init
reset run
sleep 5000
halt

Using OpenOCD telnet interface

The telnet interface can be accessed using

telnet localhost 4444

it provides a plethora of functions for debugging. You might be interested in

reset
reset halt
resume
poll
reg
load_binary
mdw
mww

Using OpenOCD and gdb for remote debugging

First, you will need a suitable cross-gdb (a gdb that runs on your host architecture, e.g. i386, but works with code for arm). In OpenEmbedded, you can build such a cross-gdb by using

bitbake  gdb-cross

If you want to debug the kernel, you can then start this gdb with

$ arm-linux-gdb vmlinux

which will give you something like

GNU gdb 6.6
Copyright (C) 2006 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "--host=i686-linux --target=arm-linux"...
(gdb) 

We now need to connect to the OpenOCD daemon, which is done using the target remote command. In this particular example, we did already halt the target by issuing halt on the telnet command line

(gdb) target remote localhost:3333
Remote debugging using localhost:3333
warning: shared library handler failed to enable breakpoint
0xc0129b8c in memmove () at include/asm/current.h:9
9       {
(gdb)

For breakpoints to work, you have to enable software breakpoints in OpenOCD, by issuing

> arm7_9 sw_bkpts enable

on the telnet command line, and use hbreak to set breakpoints in gdb.

Personal tools