OpenOCD / GDB / STR912 debugging problem

Hi everyone,

I would be very happy if someone of you guys could help me because I’m starting to pull my hair off :wink:

I’m trying to set up breakpoint using OpenOCD 0.2.0, GDB 6.8 (arm-elf-gdb), STR912 chip and FTDI based USB-JTAG interface. I’m doing this via Eclipse and Zylin plugin but it shouldn’t matter. With this configuration I can communicate and program STR912 chip.

Here is openocd config file:

#OpenOCD STR912 debug configuration

#daemon configuration
telnet_port 4444
gdb_port 2222
tcl_port 6666

#interface
interface ft2232
ft2232_layout usbjtag
jtag_khz 100

reset_config none

#jtag scan chain
jtag newtap str912 flash -irlen 8 -ircapture 0x1 -irmask 0x1 -expected-id 0x04570041
jtag newtap str912 cpu -irlen 4 -ircapture 0x1 -irmask 0xf -expected-id 0x25966041
jtag newtap str912 bs -irlen 5 -ircapture 0x1 -irmask 0x1 -expected-id 0x2457f041

#target configuration
target create str912.cpu arm966e -endian little -chain-position str912.cpu -variant arm966e

#specifies working area for debugger to use
str912.cpu configure -work-area-virt 0 -work-area-phys 0x50000000 -work-area-size 16384 -work-area-backup 0

#shutdown OpenOCD daemon when gdb detaches
str912.cpu configure -event gdb-detach { soft_reset_halt; sleep 10; resume; shutdown }

#flash bank str9x <base> <size> 0 0 <target#> <variant>
flash bank str9x 0x00000000 0x00080000 0 0 0 arm966e
flash bank str9x 0x00080000 0x00008000 0 0 0 arm966e

gdb_memory_map enable

Debbuger ‘run’ commands in Eclipse Debug Configuration:

monitor soft_reset_halt
monitor reg pc 0x00000000

When I start debugging session I get this console output:

Open On-Chip Debugger 0.2.0 (2009-09-12-14:22) Release
$URL: http://svn.berlios.de/svnroot/repos/openocd/tags/openocd-0.2.0/src/openocd.c $
For bug reports, read http://svn.berlios.de/svnroot/repos/openocd/trunk/BUGS
100 kHz
Info : JTAG tap: str912.flash tap/device found: 0x04570041 (mfg: 0x020, part: 0x4570, ver: 0x0)
Info : JTAG Tap/device matched
Info : JTAG tap: str912.cpu tap/device found: 0x25966041 (mfg: 0x020, part: 0x5966, ver: 0x2)
Info : JTAG Tap/device matched
Info : JTAG tap: str912.bs tap/device found: 0x2457f041 (mfg: 0x020, part: 0x457f, ver: 0x2)
Info : JTAG Tap/device matched
Info : accepting 'gdb' connection from 0
target state: halted
target halted in Thumb state due to debug-request, current mode: System
cpsr: 0x6000003f pc: 0x0000183a
Warn : acknowledgment received, but no packet pending
Warn : memory read caused data abort (address: 0xaaaaaaaa, size: 0x1, count: 0x2)
requesting target halt and executing a soft reset
target state: halted
target halted in ARM state due to debug-request, current mode: Supervisor
cpsr: 0x600000d3 pc: 0x00000000
pc (/32): 0x00000000

Everything looks (almost, there are warnings) fine, processor is halted. But when I’m resuming execution I get errors:

Error: Unable to set thumb software breakpoint at address 000003ec - check that memory is read/writable
Error: Unable to set thumb software breakpoint at address 000003ec - check that memory is read/writable

Then when I’m halting execution I get these:

Warn : breakpoint not set
Warn : memory read caused data abort (address: 0xaaaaaaaa, size: 0x1, count: 0x2)

All console output above is from OpenOCD terminal. GDB one looks like this:

source .gdbinit
target remote localhost:2222
warning: Can not parse XML memory map; XML support was disabled at compile time
prvIdleTask (pvParameters=0x0) at ../../Source/tasks.c:1816
1816			if( uxTasksDeleted > ( unsigned portBASE_TYPE ) 0 )
monitor soft_reset_halt
requesting target halt and executing a soft reset
target state: halted
target halted in ARM state due to debug-request, current mode: Supervisor
cpsr: 0x600000d3 pc: 0x00000000
monitor reg pc 0x00000000
pc (/32): 0x00000000
Unable to set thumb software breakpoint at address 000003ec - check that memory is read/writable

As I understand this gdb has no idea about memory regions or something but I afaik OpenOCD by default sends this info to gdb. 0x3ec is memory location from Flash so it is not writable but in that case gdb should use hardware breakpoint. Also gdb’s ‘info mem’ command produces this output:

info mem
Using memory regions provided by the target.
There are no memory regions defined.

I’m stucked :confused:

To sum up, here are my questions:

  1. What should I do? (obvious one :wink:

  2. warning: Can not parse XML memory map; XML support was disabled at compile time - What does it mean? Should I worry about it?

  3. Warn : memory read caused data abort (address: 0xaaaaaaaa, size: 0x1, count: 0x2) - Where it comes from? It appears when resuming and then halting execution. It’s reserved memory address and my code do not use it.

Any help would be greatly appreciated.

mackie

firstly you will need to update your gdb to support the memory map.

If not then to get rid the warning about maps add the following to your config.

gdb_memory_map disable

The other issue is that because gdb does not know about the target it defaults all breakpoints to software, not good when using flash.

To override this use the following openocd cmd:

gdb_breakpoint_override hard

This will cause all software breakpoint requests from gdb to be treated as hardware breakpoints.

Cheers

Spen

Thanks a lot ntfreak! This is the answer I was looking for :slight_smile:

Btw do you know how to enable memory map support in gdb? I’m using gdb 6.8, is it implemented in this version or do I need newer one?

Cheers,

mackie

you will need libexpat:

http://expat.sourceforge.net/

and then pass the gdb configure option --with-libexpat-prefix=path_to_lib_expat

during the gdb configure process it will tell you sometjing lik:

checking for libexpat… yes

checking how to link with libexpat… /home/Spen/sarm-build/libs/lib/libexpat.a

checking for XML_StopParser… yes

Cheers

Spen