I need help getting openOcd Setup to run

  1. I have a project that was built with the gcc tool chain.

  2. Code is in flash, downloaded to board with ARM7TDM.

  3. Need slow JTAG clocking (1-2Mhz)

  4. Using Olimex USB-TINY device.

For right now, all I want to do is connect to the board, read GP registers, disaassemble ROM code, etc. I have elf files with symbol tables etc.

All i want is to debug this code, NOT make it project or any of that.

Just communicate with the board and run openOCD debugger to poke around.

I cannot seem to come up with a configuration file (there are several supplied) that even comes close to starting OCD without tons of errors, and it never starts anyway.

Can anybody offer me suggestion(s) about what I need to do to just start assembly level debugging??

Help is much appreciated.

Thanks

Hi,

the OpenOCD configuration file is described in the Wiki entry at http://openfacts.berlios.de/index-en.ph … figuration

Let me know if you questions regarding a particular setting, and feel free to post your current .cfg if you can’t get it working.

Regards,

Dominic

my current config looks like:

telnet_port 4444

gdb_port 3333

interface ft2232

jtag_speed 3

ft2232_layout olimex-jtag

reset_config trst_and_srst

jtag_device 0

jtag_nsrst_delay 500

jtag_ntrst_delay 500

target arm7tdmi little reset_alt 0

run_and_halt_time 0 30

daemon_startup attach|reset

Sometimes I see arm-elf-gdb running detached, and sometimes not.

I guess what I really need to know now is what to do to start a debug session.

I want the board to be reset and stop at 0, and then I mainly need to just look around (for right now), and follow thru the source code if I can, thru assembly instructions.

I have always used an TI or ARM ICE/Debugger (or Lauterbach,too) and these things where real straight forward. I am sure openOCD probably is too, but I just can’t seem to get started from where I am.

HELP!!

Thanks,

Roger

  1. JTAG is hooked to my board.

  2. Program is in flash.

  3. Program file (elf) (with debug symbols) is available.

I can’t for the life of me figure out what to do next. Am I just stupid?

Thanks

RC

jtag_speed 3

means you’ll run with 1.5 MHz. You say you need slow JTAG clocking - if this is a ARM7TDMI-S core you have to make sure that the resulting frequency (6MHz / (1 + jtag_speed)) is less than 1/6th of the core frequency.

jtag_device 0

The jtag_device command specifies the layout of your JTAG scan chain. For a single ARM7TDMI device, the correct line would be:

jtag_device 4 0x1 0xf 0xe

target arm7tdmi little reset_alt 0

The “reset-type” parameter can be reset_run, reset_[halt|init] or run_and_[halt|init] - reset_alt is no valid setting

daemon_startup attach|reset

The “daemon_startup” directive specifies whether the OpenOCD should reset your target upon daemon startup, or whether it should just attach to the target, to allow the current condition to be examined.

What ARM7 are you using? You wont be able to debug NXP LPC2000 or ST STR7x micros out of reset. On these targets you should use “reset_config trst_and_srst srst_pulls_trst” and neither “reset_halt” nor “reset_init”.

I agree that the OpenOCD isn’t as intuitive to use as some of the commercial alternatives, but the main aim is to provide a maximum of flexibility.

Regards,

Dominic

Dominic,

I wasn’t complaining about complexity, I just can’t figure out what to do.

I changed openocd.cfg to:

telnet_port 4444

gdb_port 3333

interface ft2232

jtag_speed 3

ft2232_layout olimex-jtag

reset_config trst_and_srst

jtag_device 4 0x1 0xf 0xe

jtag_nsrst_delay 500

jtag_ntrst_delay 500

target arm7tdmi little reset_halt 0

run_and_halt_time 0 30

daemon_startup attach|reset

To reflect what you told me.

I DO want the device to init, and halt at 0, pending me doing something to it. (At least for now.)

Its an ARM7TDMI made by Oxford Semiconductor. Oxford designation is

UF924DSB, but documentation assures me that it a standard ARM7dtmi.

They also say jtag clock should be 1-2Mhz, hence I chose speed 3.

when I start openOcd I get the following output:

$ openOcd

Info: openocd.c:86 main(): Open On-Chip Debugger (2007-04-16 19:30 CEST)

Info: configuration.c:50 configuration_output_handler(): Command ■ not found

Error: jtag.c:1376 jtag_init(): No valid jtag interface found ((null))

Error: jtag.c:1377 jtag_init(): compiled-in jtag interfaces:

Error: jtag.c:1380 jtag_init(): 0: ft2232

I have installed the Olimex drivers, and they show up in the Windows device manager.

I am running openocd-ftd2xx.exe that came from Olimex with the CD from the USB debugger I bought from them. I renamed it openocd.exe.

As far as I can tell, it does not seem to be even getting to the point where it is talking to the ARM-USB-OCD device. Could be wrong…

I am trying to include all the information I have.

I appreciate your help very much.

Thanks.

RC

The OpenOCD seems to have problems parsing your config file. Make sure it’s using the correct file, you can specify a path and a filename using the “-f ” switch. Adding the “-d” option makes the OpenOCD print debug messages that might help in identifying the problem.

One issue that I could think of is the difference between unix-style and windows-style newlines, i.e \n vs. \r\n.

target arm7tdmi little reset_alt 0

It should be “reset_halt”, not “reset_alt”.

daemon_startup attach|reset

The OpenOCD documetation uses the | to denote a choice between alternatives, in this case you may use either “attach” or “reset”, not both.

Regards,

Dominic

Making some progress:

COnfig file now looks like:

#daemon configuration

telnet_port 4444

gdb_port 3333

#interface

interface ft2232

ft2232_device_desc “Olimex OpenOCD JTAG TINY B”

ft2232_layout olimex-jtag

#ft2232_vid_pid 0x0403 0xcff8

jtag_speed 3

#use combined on interfaces or targets that can’t set TRST/SRST separately

#reset_config trst_and_srst srst_pulls_trst

#jtag scan chain

#format L IRC IRCM IDCODE (Length, IR Capture, IR Capture Mask, IDCODE)

jtag_device 4 0x1 0xf 0xe

jtag_nsrst_delay 500

jtag_ntrst_delay 500

#target configuration

daemon_startup reset

#target

#target arm7tdmi

target arm7tdmi little reset_halt 0

#target_script 0 reset h2294_init.script

run_and_halt_time 0 30

#working_area 0 0x40000000 0x40000 nobackup

#flash configuration

#flash bank lpc2000 0x0 0x40000 0 0 lpc2000_v1 0 14765 calc_checksum

#flash bank cfi 0x80000000 0x400000 2 2 0

NOW, response looks like:

C:\GCCFD\openocd\bin>openocd-ftd2xx -d

Info: openocd.c:82 main(): Open On-Chip Debugger (2006-10-12 18:00 CEST)

Debug: jtag.c:1210 jtag_init():

Debug: ft2232.c:991 ft2232_init(): ‘ft2232’ interface using FTD2XX with 'olime

x-jtag’ layout

Debug: ft2232.c:1077 ft2232_init(): current latency timer: 2

Debug: ft2232.c:1330 olimex_jtag_init(): 80 08 1b

Debug: ft2232.c:1373 olimex_jtag_init(): 82 09 0f

Debug: ft2232.c:242 ft2232_speed(): 86 03 00

Debug: jtag.c:247 jtag_call_event_callbacks(): jtag event: 1

Debug: jtag.c:1096 jtag_reset_callback():

Debug: jtag.c:247 jtag_call_event_callbacks(): jtag event: 1

Debug: jtag.c:1096 jtag_reset_callback():

.

.

.

<<<< LONG PAUSE >>>>

.

.

.

Error: ft2232.c:225 ft2232_read(): couldn’t read the requested number of bytes

from FT2232 device (0 < 2)

Error: ft2232.c:365 ft2232_send_and_recv(): couldn’t read from FT2232

C:\GCCFD\openocd\bin>

As near as I can tell, the board is never even being reset, much less halted. (Reset LED doen’t blink or anything).

When board actually resets (I can force this by shorting JTAG pins 15-16, SRST–>GND, an LED on the board goes out, until the board comes up again. With USB-ARM-TINY attached, never see the LED blink or anything.

HELP

Roger

Is there a reason why you commented the “reset_config” line out? The default is “none”, which means the OpenOCD wont try to reset your board.

Regards,

Dominic

Dominic,

I just tried taking out various things to see what happens.

My board has seperate lines for SRST and TRST, so I could’nt figure what what should be on that line.

The board WILL reset if I ground the SRST pin manually., so I figured I didn’t need to do this.

My question all along has been what do I need to do to get the board to STOP and then just sit there waiting for me to do something to it. (Like look at the registers, etc).

What does one typically need to do to talk to a ARM7TDMI board using openOCD - olimex USB_JTAG_TINY device. I have a very short USB cable

(18" or so)??

Thanks,

Roger

Sorry, I just realized you have

ft2232_device_desc “Olimex OpenOCD JTAG TINY B”

this needs to be changed to “… TINY A”.

Regards,

Dominic