ArmDebug
From Sikken
Add your own comments to this page by clicking the 'discussion' tab!
For my DigitalBatDetector project, I bought a development kit containing an LPC2148 microcontroller. This microcontroller contains an ARM7TDMI-S core. An excellent open-source GNU toolchain is available for these microcontrollers, however there seems to be a missing link in the chain: a good and cheap debugger.
Some closed-source debugging tools are:
- OCDCommander and OCDRemote from Macraigor for use with their Wiggler JTAG cable. OCDCommander is a stand-alone debugging program. "OCDRemote is a utility that listens on a TCP/IP port and translates GDB monitor commands into Wiggler/Raven/usbDemon/mpDemon JTAG/BDM commands." (quote from their website). Unfortunately these tools don't seem to work very well with my Olimex wiggler clone (who can blame them?).
- ArmDBG from this company. It is a stand-alone debug program and it seems to work fine with my wiggler cable.
- H-JTAG. As far as I understand, it converts between JTAG and the RDI protocol. Olimex provides a special version on their ARM JTAG page that has support for their parallel port wiggler clone.
The rest of this page is about open-source debugging tools for the ARM7TDMI-S processor, specifically the LPC2xxx family.
Contents[hide] |
Open-source ARM debugging projects
- The OpenOCD project. This project is being actively developed. The latest preview release has support for ARM7TDMI-S.
- The gdb-jtag-arm project has a debugging stub for ARM7 processors. Unfortunately it does not support ARM7TDMI-S yet.
- The jtager project. Apparently no ARM7TDMI-S support either.
Debugging with OpenOCD
Take a look at the OpenOCD webpage and the OpenOCD project page. Make sure to also check out these installation instructions and the OpenOCD documentation.
Next are the steps I followed to get some basic things running with my Olimex wiggler clone connected to my Embedded Artists LPC2148 board. These steps describe how to debug in application written in flash (as opposed to RAM).
Building
- make sure you have your basic building tools, like gcc, make, etc.
- install packages automake-1.9, subversion, libftdi-dev, libusb-dev
- windows/cygwin: install package ioperm and run 'ioperm -i' to install the ioperm driver.
- check out the latest sources using 'svn checkout svn://svn.berlios.de/openocd'
- read the INSTALL file from the files you just downloaded
- run ./bootstrap
- run ./configure (I did this with options --disable-ftd2xx --disable-ftdi2232 --disable-amtjtagaccel)
- build it with 'make'.
Configuring
- create a symbolic link named openocd.cfg to one of the configuration files in doc/config (e.g. 'ln -s doc/config/arm7_wig.cfg openocd.cfg')
Running
- make sure the ARM7TDMI board is powered and the JTAG cable is connected
- run 'src/openocd -d' (might be required to be root) and check for any errors reported. The '-d' option enables debugging info.
Telnet interface
- telnet into port 4444 to get a command interface: 'telnet localhost 4444'
- play around with the commands (e.g. help)
GDB
- get arm-elf-gdb, it's part of the GNUARM toolchain.
- start arm-elf-gdb
- type 'file <executable.elf>' to load the executable
- type 'set debug remote 1' to enable tracing of gdb protocol (if required)
- type 'target remote localhost:3333' to connect to the target
- the same commands from the telnet interface can now be accessed through the 'monitor' command, e.g. 'monitor halt'
Insight
Insight is a graphical debugger, running on top of gdb. The steps to run it are pretty much the same as for gdb, except now you use a GUI.
- get arm-elf-insight, part of the GNUARM toolchain.
- start arm-elf-insight
- select menu (File / Open...) to open the executable you currently have running on the board
- select menu (File / Target Settings...) and configure it as as shown below
- select menu (Run / Connect to target) to attach to your ARM7TDMI-S microcontroller.
- play around :)
Wiggler info
I bought a wiggler-clone from Olimex. It does not work very well with OCDRemote or OCDCommander, it only connects at the lowest available speed.
Pin connections (see also http://www.sparkfun.com/cgi-bin/phpbb/viewtopic.php?t=2068):
pin | Remark |
---|---|
1. STROBEn | no connection |
2. DATA0 | JTAG nSRST, inverted, high level resets system |
3. DATA1 | JTAG TMS |
4. DATA2 | JTAG TCK |
5. DATA3 | JTAG TDI |
6. DATA4 | JTAG nTRST |
7. DATA5 | no connection |
8. DATA6 | identification link to pin 15 |
9. DATA7 | VCC for the Level shifter i.e. JTAG enable/disable |
10. ACKn | no connection |
11. BUSY | JTAG TDO |
12. PAPEROUT | no connection |
13. SELECTED | Target VCC sense (only when JTAG is enabled i.e. DB25.9 = 1) |
14. AUTOFDn | no connection |
15. ERRORn | identification link to pin 8 |
16-17 | no connection |
18-25 | ground |
Other good links
- ARM Cross development with Eclipse version 3 with accompanying source code (from the Olimex website).