Debugging problem with arm-none-eabi-gdb and OpenOCD

I frequently have this problem, it has driven me nuts. I find that I

can compile any size (ie: 1K - >70K) program, download it to my target

(AT91SAM7X512), and it runs just fine. However, the debugger usually

only works on smaller projects; once it gets too big, Eclipse throws the

error "Execution is suspended because of error. The program is not being

run." The size of the code when this happens varies a bit - sometimes

it’s when the flash size exceeds 13852 bytes, other times 14124 bytes,

etc. I find that when I’m at the ‘breaking point’ even a single

asm(“nop”) will break it.

The output of arm-none-eabi-gdb is:

symbol-file "D:\\Temp\\Analog IF\\Analog IF\\main_fsh.elf"
target remote localhost:3333
warning: while parsing target memory map (at line 2): Required element <memory> is missing
0x000005b8 in LowLevelInit () at Source/lowlevelinit.c:61
61    while(!(pPMC->PMC_SR & AT91C_PMC_MOSCS));
tbreak main
Temporary breakpoint 2 at 0x220: file Source/main.c, line 60.
monitor soft_reset_halt
[b]"monitor" command not supported by this target.[/b]
monitor armv4_5 core_state arm
"monitor" command not supported by this target.
monitor mww 0xffffff60 0x00320100
"monitor" command not supported by this target.
monitor mww 0xfffffd44 0xa0008000
"monitor" command not supported by this target.
monitor mww 0xfffffc20 0xa0000601
"monitor" command not supported by this target.
monitor wait 100
"monitor" command not supported by this target.
monitor mww 0xfffffc2c 0x00480a0e
"monitor" command not supported by this target.
monitor wait 200
"monitor" command not supported by this target.
monitor mww 0xfffffc30 0x7
"monitor" command not supported by this target.
monitor wait 100
"monitor" command not supported by this target.
monitor mww 0xfffffd08 0xa5000401
"monitor" command not supported by this target.
set remote memory-write-packet-size 1024
set remote memory-write-packet-size fixed
set remote memory-read-packet-size 1024
set remote memory-read-packet-size fixed
monitor arm7_9 force_hw_bkpts enable
"monitor" command not supported by this target.
continue
The program is not being run.

However, if I reduce my code a bit so that the debugger works, then the

output of arm-none-eabi-gdb is:

symbol-file "D:\\Temp\\Analog IF\\Analog IF\\main_fsh.elf"
target remote localhost:3333
warning: while parsing target memory map (at line 2): Required element <memory> is missing
LowLevelInit () at Source/lowlevelinit.c:96
96    while (!(*AT91C_PMC_SR & AT91C_PMC_MCKRDY));
tbreak main
Temporary breakpoint 2 at 0x220: file Source/main.c, line 60.
monitor soft_reset_halt
monitor armv4_5 core_state arm
monitor mww 0xffffff60 0x00320100
monitor mww 0xfffffd44 0xa0008000
monitor mww 0xfffffc20 0xa0000601
monitor wait 100
monitor mww 0xfffffc2c 0x00480a0e
monitor wait 200
monitor mww 0xfffffc30 0x7
monitor wait 100
monitor mww 0xfffffd08 0xa5000401
set remote memory-write-packet-size 1024
set remote memory-write-packet-size fixed
set remote memory-read-packet-size 1024
set remote memory-read-packet-size fixed
monitor arm7_9 force_hw_bkpts enable
continue

Any ideas of what could cause this? My toolset is Eclipse Helios SP 2,

CDT 1.0.0.201102110609, arm-none-eabi-gcc 4.60, arm-none-eabi-objcopy

2.21, arm-none-eabi-gdb 7.2, OpenOCD 717, and Olimex ARM_USB_TINY JTAG

interface.

Also, Eclipse launches OpenOCD with this configuration for debug:

telnet_port 4444
gdb_port 3333

interface ft2232
ft2232_device_desc "Olimex OpenOCD JTAG TINY A"
ft2232_layout "olimex-jtag"
ft2232_vid_pid 0x15BA 0x0003
jtag_speed 2
jtag_nsrst_delay 200
jtag_ntrst_delay 200

reset_config srst_only srst_pulls_trst

jtag_device 4 0x1 0xf 0xe

daemon_startup reset

target arm7tdmi little run_and_init 0 arm7tdmi_r4

run_and_halt_time 0 30

Lastly, my debug configuration is to use arm-none-eabi-gdb with an

initialization command of

target remote localhost:3333

and Run Commands of

monitor soft_reset_halt
monitor armv4_5 core_state arm
monitor mww 0xffffff60 0x00320100
monitor mww 0xfffffd44 0xa0008000
monitor mww 0xfffffc20 0xa0000601
monitor wait 100
monitor mww 0xfffffc2c 0x00480a0e
monitor wait 200
monitor mww 0xfffffc30 0x7
monitor wait 100
monitor mww 0xfffffd08 0xa5000401
set remote memory-write-packet-size 1024
set remote memory-write-packet-size fixed
set remote memory-read-packet-size 1024
set remote memory-read-packet-size fixed
monitor arm7_9 force_hw_bkpts enable
continue

I have a feeling the problem has something to do with that fact that

arm-none-eabi-gdb spits out ““monitor” command not supported by this
target.
” I just can’t imagine what’s causing this, not even sure whether it’s arm-none-eabi-gdb or OpenOCD. :?

Thanks!

Ryan

I am not an expert on the subject, but I also have had experience where the code size appears to effect operation in eclipse. My first observation in your report above, is that you load your elf file before connecting the gdb to the target. Is that something you do, or is that how eclipse is doing it? When I use arm…gdb.exe in a command window, I do the target remote localhost:3333 deal right away before loading the elf file. Also, try manually opening openocd in a command prompt and load your elf file with “load_image”, “step ”, then “resume”, and see if your code runs. I manage my openocd connection myself, not through eclipse (Mostly because I don’t know how to setup eclipse).

Ah, great suggestion. I went ahead and moved all of my “Run Commands” (besides continue, which I deleted) to the “Initialization Commands” section, and it worked! Apparently when the symbols are loaded does indeed make a difference… Thanks a lot!

Now debugging seems to work, although it takes about 1 second per step as I step through the code. I don’t recall it being that slow before… Oh well, better slow than not working at all!

Hello,

I got the solution of this problem…!! First you have to build the project. Then go to External tools and click on ARM-USB-OCD-H/ARM-USB-OCD-tiny/whaterver u r using. If the target is detected it will display “JTAG tap:device found” and the address of the device. Then go to Debug confi and debug it…The “monitor” commands will be accepted…!!!

Thank u Sparkfun…!! :slight_smile: