EmbeddedRelated.com
Forums

Eclipse/OpenOCD Software breakpoint problems

Started by mjbutsch May 22, 2008
Hello,

I am having trouble getting multiple software breakpoints to work.

I am just starting to work with the NXP LPC21XX parts and am using
Eclipse, OpenOCD and
Yagarto and a Keil MCB2140 (LPC2148).

I have a very simple test program that will blink an LED.

If I load the program into Flash, I can use two breakpoints. If I try
to set more breakpoints
I get a message that says

"Could not insert hardware breakpoints:
You may have requested too many hardware
breakpoints/watchpoints"

If I load the program into RAM, I can only set one breakpoint. When I
start executing with
more than one breakpoint, I get an error that says

"Cannot insert breakpoint 2. Error accessing memory address
0x400001a0: (undocumented errno -1)"

When debuggin in RAM, I use the following gdb initialize commands:

------------------
target remote localhost:3333
monitor reset
monitor sleep 500
monitor poll
monitor soft_reset_halt
monitor arm7_9 sw_bkpts enable
monitor mww 0xE01FC040 0x0002
monitor mdw 0xE01FC040

# needed for gdb 6.8 and higher
set mem inaccessible-by-default off

load
break main
continue
-------------------

Am I correct in thinking I should be able to set lots of breakpoints
when running in RAM? If so,
what am I doing wrong?

Thanks in advance,

Mark

An Engineer's Guide to the LPC2100 Series

Hi Mark!,

Im also using LPC2148 with ECLPISE.

When you debug on FLASH there is a maximum of two breakpoints at the
same time.

When you debug on RAM there is no limit.

I assume you are using diferents linker scripts to load the program
into FLASH and RAM, since the locations are diferent. Im using this
for a while with no problems.

This are my gdb initialize commands:

(For RAM):
----
target remote localhost:3333
monitor reset
monitor sleep 500
monitor poll
monitor soft_reset_halt
monitor arm7_9 sw_bkpts enable
monitor mww 0xE01FC040 0x0002
monitor mdw 0xE01FC040
break main
load
continue
-----

And the script to the OpenOCD is:
------
#daemon configuration
telnet_port 4444
gdb_port 3333

#interface
interface ft2232
ft2232_device_desc "Olimex OpenOCD JTAG A"
ft2232_layout "olimex-jtag"
ft2232_vid_pid 0x15BA 0x0003
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

#target configuration
daemon_startup reset

#target
#target arm7tdmi
target arm7tdmi little run_and_halt 0 arm7tdmi-s_r4
run_and_halt_time 0 30

working_area 0 0x40000000 0x40000 nobackup

#flash bank lpc2000 0 0
flash bank lpc2000 0x0 0x7d000 0 0 0 lpc2000_v2 12000 calc_checksum

# For more information about the configuration files, take a look at:
# http://openfacts.berlios.de/index-en.phtml?title=Open+On-
Chip+Debugger
-------------

Hope you get luck!

Cheers

Gaspar

Hi Gaspar,

Yes I have different linker scripts fpor RAM and Flash.

I tried your gdb and OpenOCD (I have the Olimex ARM-USB-Tiny Jtag)
settings and got the same result.

"Error accessing memory address: 0x40000160 (undocumented errno -1)"

Also, if I try to debug in RAM first, I get a message,
"Unable to set 32 bit software breakpoint at address 4000010c",
which is where my main() is located. If I "resume", the program
crashes and I end up in the Undefined Instruction Handler. It is like
the program did not get loaded into RAM.

If I then debug in FLASH, and then in RAM, it is able to set the one
breakpoint at main().

Still lost. Any other suggestions?

Mark

Mark,

Strange behaviour...
Im thinking in software problems.

My versions are:

OpenOCD: R279
binutils: 2.18
gcc: 4.2.2
newlib: 1.16.0
gdb: 6.7.1 (expat)
Eclipse Platform: 3.3
Eclipse CDT 4.0.2
Zylin Plugin: 4.1.14

I have Olimex ARM-USB-OCD JTAG Programmer... works fine since the
first time.
I have some troubles a few months ago when loading large (>32 Kb)
programs into flash, because the script only was erasing some
sectors, not the entire flash.

Are you already test the scripts from Olimex? (my JTAG Programmer
came with drivers & examples CD)

Other idea, visit Yagarto, and ask Michael Fischer.

Sorry for the limited help, Mark! Hope you get luck!

Gaspar

>When you debug on FLASH there is a maximum of two breakpoints at the
>same time.

I have noticed, however, at times Eclipse seems to lose track of the
interrupts, and you can get into a state where no interrupts are set,
but Eclipse won't let you set any (or even single step source, which
requires an interrupt). I'm note sure if it's Eclipse or OpenOCD that is
getting confused. Only solution is to start from scratch.

Also, why, if you have a single breakpoint set, does Eclipse whinge like
mad if you single step, but still does it fine anyway (as it should as
you only need 1 interrupt for this) ?

These are just annoyances rather than show stoppers, but since this
topic came up I thought I'd mention.

Cheers,
Bruce