Openocd does not work as expected
Hi
I’m trying to setup a project for a little dev board
http://www.ebay.de/itm/Arduino-IDE-kompatibles-Board-STM32-STM32f103C8T6-ST-ARM-32-bit-Cortex-M3-039-/221812183158?hash=item33a5095076:g:tI4AAOSwHnFVj5Aq
Using this Adapter
http://www.ebay.de/itm/ST-LINK-V2-ST-LINK-STM8-STM32-kompatibler-Emulator-USB-Programmer-Debugger-/171689684649?hash=item27f980aea9:g:iTsAAOSwMmBVpNes
I can upload sketches in the Arduino_STM32 environment with this thing.
I have installed “System Workbench for STM32” and its tools in eclipse now and have used a stand alone CubeMX for creating a project.
The project includes freeRTOS and builds without errors.
When I try to debug or just click on “run” Openocd throws errors (1)(2)
When I use Target -> Program Chip in the Project Explorers context menu nothing at all happens.
The config file for Openocd currently is:
# This is an STM32F103C8T6-mini board with a single STM32F103C8Tx chip. # Generated by System Workbench for STM32 source [find interface/stlink-v2.cfg] set WORKAREASIZE 0x5000 transport select "hla_swd" #source [find target/stm32f1x_stlink.cfg] # deprecated ? source [find target/stm32f1x.cfg] # use hardware reset, connect under reset #reset_config srst_only srst_nogate reset_config srst_nogate
When initial created by “System Workbench for STM32” using the instructions
from here http://www.openstm32.org/Importing+a+STCubeMX+generated+project it looked a bit diffent.
After my modifications it runs at least on the command line (3)
1. console (openocd) output when “debug” was started
Open On-Chip Debugger 0.9.0-dev-dirty (2015-11-13-11:40) Licensed under GNU GPL v2 For bug reports, read http://openocd.org/doc/doxygen/bugs.html Info : The selected transport took over low-level target control. The results might differ compared to plain JTAG/SWD adapter speed: 1000 kHz adapter_nsrst_delay: 100 srst_only separate srst_nogate srst_open_drain connect_assert_srst srst_only separate srst_nogate srst_open_drain connect_assert_srst Info : Unable to match requested speed 1000 kHz, using 950 kHz Info : Unable to match requested speed 1000 kHz, using 950 kHz Info : clock speed 950 kHz Info : STLINK v2 JTAG v17 API v2 SWIM v4 VID 0x0483 PID 0x3748 Info : using stlink api v2 Info : Target voltage: 3.240795 Info : stm32f1x.cpu: hardware has 6 breakpoints, 4 watchpoints Info : accepting 'gdb' connection on tcp/3333 Error: timed out while waiting for target halted TARGET: stm32f1x.cpu - Not halted in procedure 'reset' in procedure 'ocd_bouncer' Info : device id = 0x20036410 Warn : STM32 flash size failed, probe inaccurate - assuming 128k flash Info : flash size = 128kbytes Error: timed out while waiting for target halted TARGET: stm32f1x.cpu - Not halted in procedure 'reset' in procedure 'ocd_bouncer' Error: timed out while waiting for target halted TARGET: stm32f1x.cpu - Not halted in procedure 'reset' in procedure 'ocd_bouncer' Error: Target not halted Error: failed erasing sectors 0 to 6 Error: flash_erase returned -304
2. console output after “run” was started
Open On-Chip Debugger 0.9.0-dev-dirty (2015-11-13-11:40) Licensed under GNU GPL v2 For bug reports, read http://openocd.org/doc/doxygen/bugs.html Info : The selected transport took over low-level target control. The results might differ compared to plain JTAG/SWD adapter speed: 1000 kHz adapter_nsrst_delay: 100 srst_only separate srst_nogate srst_open_drain connect_assert_srst srst_only separate srst_nogate srst_open_drain connect_assert_srst Info : Unable to match requested speed 1000 kHz, using 950 kHz Info : Unable to match requested speed 1000 kHz, using 950 kHz Info : clock speed 950 kHz Info : STLINK v2 JTAG v17 API v2 SWIM v4 VID 0x0483 PID 0x3748 Info : using stlink api v2 Info : Target voltage: 3.237616 Info : stm32f1x.cpu: hardware has 6 breakpoints, 4 watchpoints Error: timed out while waiting for target halted TARGET: stm32f1x.cpu - Not halted in procedure 'program' in procedure 'reset' called at file "embedded:startup.tcl", line 478 in procedure 'ocd_bouncer' ** Unable to reset target ** shutdown command invoked
3. command line and then telnet connecting port 4444 on another terminal giving “reset halt”
db@zweistein:/opt/gnuarmeclipse/openocd/0.9.0-201505190955/scripts> /home/db/.p2/pool/plugins/fr.ac6.mcu.externaltools.openocd.linux64_1.7.0.201602121841/tools/openocd/bin/openocd -f /home/db/STM32-projekte/STM32F103C8T6-first/SW4STM32/STM32F103C8T6-first/STM32F103C8T6-mini2.cfg Open On-Chip Debugger 0.9.0-dev-dirty (2015-11-13-11:40) Licensed under GNU GPL v2 For bug reports, read http://openocd.org/doc/doxygen/bugs.html Info : The selected transport took over low-level target control. The results might differ compared to plain JTAG/SWD adapter speed: 1000 kHz adapter_nsrst_delay: 100 none separate none separate Info : Unable to match requested speed 1000 kHz, using 950 kHz Info : Unable to match requested speed 1000 kHz, using 950 kHz Info : clock speed 950 kHz Info : STLINK v2 JTAG v17 API v2 SWIM v4 VID 0x0483 PID 0x3748 Info : using stlink api v2 Info : Target voltage: 3.239762 Info : stm32f1x.cpu: hardware has 6 breakpoints, 4 watchpoints Info : accepting 'telnet' connection on tcp/4444 target state: halted target halted due to debug-request, current mode: Thread xPSR: 0x01000000 pc: 0x08000144 msp: 0x20000400
But the last has the “scripts” directory of an installation of Openocd outside the eclipse plugin stuff as current directory.
When trying the same while inside the scripts directory of the eclipes SWFSTM32’s plugin installation of Openocd and then telneting 4444 it gives the same error when saying “reset halt”
db@zweistein:~/.p2/pool/plugins/fr.ac6.mcu.debug_1.7.0.201602121829/resources/openocd/scripts> /home/db/.p2/pool/plugins/fr.ac6.mcu.externaltools.openocd.linux64_1.7.0.201602121841/tools/openocd/bin/openocd -f /home/db/STM32-projekte/STM32F103C8T6-first/SW4STM32/STM32F103C8T6-first/STM32F103C8T6-mini2.cfg Open On-Chip Debugger 0.9.0-dev-dirty (2015-11-13-11:40) Licensed under GNU GPL v2 For bug reports, read http://openocd.org/doc/doxygen/bugs.html Info : The selected transport took over low-level target control. The results might differ compared to plain JTAG/SWD adapter speed: 1000 kHz adapter_nsrst_delay: 100 srst_only separate srst_nogate srst_open_drain connect_assert_srst srst_only separate srst_nogate srst_open_drain connect_assert_srst Info : Unable to match requested speed 1000 kHz, using 950 kHz Info : Unable to match requested speed 1000 kHz, using 950 kHz Info : clock speed 950 kHz Info : STLINK v2 JTAG v17 API v2 SWIM v4 VID 0x0483 PID 0x3748 Info : using stlink api v2 Info : Target voltage: 3.240795 Info : stm32f1x.cpu: hardware has 6 breakpoints, 4 watchpoints Info : accepting 'telnet' connection on tcp/4444 Error: timed out while waiting for target halted TARGET: stm32f1x.cpu - Not halted in procedure 'reset' in procedure 'ocd_bouncer' Error: jtag status contains invalid mode value - communication failure Polling target stm32f1x.cpu failed, GDB will be halted. Polling again in 100ms ...
How should I proceed debugging this thing.
I even can not find “embedded:startup.tcl on my disk.
The installation of “System Workbench for STM32” inside Eclipse
following the instructions from here
http://www.openstm32.org/Installing+System+Workbench+for+STM32+from+Eclipse?structure=Documentation
was without any error messages.
Kind regards
Dieter