Eclipse + OpenOCD 0.1.0 + STM32F103 Debuggng Setup

Would someone be kind and provide their OpenOCD 0.1.0 configuration and GDB Initialization commands for Eclipse to allow debugging in the Eclipse environment.

The board I am using is the Olimex STM32-P103.

I can program the flash and make the LED blink, so I have OpenOCD configured to program the flash.

I created a debug configuration file and I can access OpenOCD via the telnet interface. I can even use GDB in text mode, however I cannot get Eclipse to work right. When I enter Eclipse Debugging mode the console window spits out:

source .gdbinit

target remote :3333

0x00000000 in ?? ()

monitor reset

JTAG tap: stm32.cpu tap/device found: 0x3ba00477 (Manufacturer: 0x23b, Part: 0xba00, Version: 0x3)

JTAG Tap/device matched

JTAG tap: stm32.bs tap/device found: 0x16410041 (Manufacturer: 0x020, Part: 0x6410, Version: 0x1)

JTAG Tap/device matched

target state: halted

target halted due to undefined, current mode: Thread

xPSR: 0x81000000 pc: 0x08000158

monitor sleep 500

monitor poll

target state: halted

target halted due to undefined, current mode: Thread

xPSR: 0x81000000 pc: 0x08000158

set mem inaccessible-by-default off

load

Loading section .text, size 0x2e98 lma 0x8000000

Loading section .data, size 0x534 lma 0x8002e98

Start address 0x8000000, load size 13260

Transfer rate: 6 KB/sec, 6630 bytes/write.

break main

Breakpoint 1 at 0x80001be: file p103.c, line 83.

continue

Note: automatically using hardware breakpoints for read-only addresses.

After this I cannot step, set breakpoints, view source, NOTHING.

Thanks.

I’m trying to flash STM32H103 on Olimex STM32-H103 board and I’m not able to do it.

In case that you are using Olimex USB JTAG Tiny, could you please post you cofiguration file here? I would be happy if I could just make the damn thing to flash the led.

I got the LED Flashing thing going. I can program the Flash just fine. I am still having problems with Eclipse Debugging though.

I am using OpenOCD 0.1.0 with Olimex USB JTAG Tiny, so here is my flash programming configuration. I patched it together from various examples.

# Olimex STM32 P103 with STM32F103RBT.

# Source the default Olimex USB Tiny programmer
source [find interface/olimex-jtag-tiny-a.cfg]

# Use default telnet port
telnet_port 4444

# Use default GDB connection
gdb_port 3333

# Use default TCL port
tcl_port 6666

# Device has "Rev1" tap id.
set BSTAPID 0x16410041

# Source the default STM32.cfg file
source [find target/stm32.cfg]

init

reset halt

flash write_image erase p103.elf

verify_image p103.elf

resume

shutdown

Thanks for the answer.

But I have a few more questions regarding this .cfg file:

  • what is “source [find interface/olimex-jtag-tiny-a.cfg]” ?

  • what is “source [find target/stm32.cfg]” ?

  • whate is “p103.elf” ?

How did you name this .cfg? Is it eny of this .cfg in above questions?

omnix,

The “source” command is a new feature of OpenOCD 0.1.0.

“p103.elf” is the name of the elf file to be programmed into flash.

The name of the .cfg file is your choice.


My question to everyone,

Is anybody successfully doing GDB debugging with Eclipse, OpenOCD 0.1.0, and STM32? If so, please post your OpenOCD config file and Eclipse command list to make this work. I still cannot get it to work properly.

I also had the problem with the debug not working, when I was trying to get the LED-blink demo to work.

My code was running when flashed into the device, but debugging was not possible. My problem was the hardware somehow got stuck in the BusFault or HardFault event handler. In the STlib, these are empty loops:

while (1) 
{
}

So when I issued resume, there was no breakpoint to stop it.

Try replacing the “resume” with “stepi”, and do a poll afterwards.

This should give you a hint where your program counter is at, and wether you are stuck with a Fault.