STM3210E-EVAL + ST-LINK/V2 + OpenOCD

What is the correct way to use openOCD with this board.

If i use

-c “telnet_port 4444” -f “interface/stlink-v2.cfg” -f “stm3210e_eval.cfg”

I get

Open On-Chip Debugger 0.7.0 (2013-05-05-10:41)

Licensed under GNU GPL v2

For bug reports, read

http://openocd.sourceforge.net/doc/doxygen/bugs.html

adapter speed: 1000 kHz

adapter_nsrst_delay: 100

Runtime Error: C:/ChibiStudio/tools/openocd/bin/…/scripts/target/stm32f1x.cfg:27: invalid command name “jtag_ntrst_delay”

in procedure ‘script’

at file “embedded:startup.tcl”, line 58

at file “C:\ChibiStudio\tools\openocd\scripts\board\stm3210e_eval.cfg”, line 7

at file “C:/ChibiStudio/tools/openocd/bin/…/scripts/target/stm32f1x.cfg”, line 27

The stlink is a special case and so you have to use something lile

openocd -f interface/stlink-v2.cfg -f target/stm32f1x_stlink.cfg

Cheets

Spen

so i’ve used what you said above

-c “telnet_port 4444” -f “interface/stlink-v2.cfg” -f “target/stm32f1x_stlink.cfg”

and get this

Open On-Chip Debugger 0.7.0 (2013-05-05-10:41)

Licensed under GNU GPL v2

For bug reports, read

http://openocd.sourceforge.net/doc/doxygen/bugs.html

Info : This adapter doesn’t support configurable speed

Info : STLINK v2 JTAG v16 API v2 SWIM v4 VID 0x0483 PID 0x3748

Info : Target voltage: 3.223037

Info : stm32f1x.cpu: hardware has 6 breakpoints, 4 watchpoints

This looks ok so far, but when i now start the debugger i get this

requesting target halt and executing a soft reset

requesting target halt and executing a soft reset

Error: timed out while waiting for target halted

in procedure ‘wait_halt’

background polling: on

TAP: stm32f1x.cpu (enabled)

target state: unknown

Info : device id = 0x10006430

Info : flash size = 512kbytes

flash ‘stm32f1x’ found at 0x08000000

Error: Target not halted

stm32x mass erase failed

in procedure ‘stm32f1x’

Error: Target not halted

Error: error writing to flash at address 0x08000000 at offset 0x00000000

in procedure ‘flash’

requesting target halt and executing a soft reset

The debugger init commands that are used by chiboisOS are

set remotetimeout 1000

monitor soft_reset_halt

monitor soft_reset_halt

monitor wait_halt

monitor poll

monitor flash probe 0

monitor stm32f1x mass_erase 0

monitor flash write_bank 0 build/ch.bin 0

monitor soft_reset_halt

A hint is the following info

Error: Target not halted

I would advise that if possible use srst for this connection, it is usually easier if you create a openocd.cfg and source files from that, eg.
reset_config srst_only srst_nogate

source [find interface/stlink-v2.cfg]
source [find target/stm32f1x_stlink.cfg]

# you can also program from the same file bu calling init
init
reset init
...

I would not recommend to use soft_reset_halt, as it will only reset the core, and not the peripherals - use “reset init”

Infact that cmd was only really intended for arm7/9 targets and is not really for armv7m.

Also the telnet port defaults to 4444, so is not required.

Newer versions of OpenOCD have a programming helper function, eg.

program stm32b-eval.bin 0x08000000 verify
# no address required if using elf/hex/s19
program stm32b-eval.elf verify

If you want this on a cmd line then

openocd -f interface/stlink-v2.cfg -f target/stm32f1x_stlink.cfg -c "program stm32b-eval.elf verify"

But then again if you are using gdb then why not program using gdb load cmd.

Cheers

Spen