When starting openocd up again after I've previously had trace output enabled (in both target & stlink) sometimes causes openocd to consistently fail to initialize. After starting openocd with the target reset button held down, it initiallizes succesfully.
[cody@franklin ~]$ cd wrist3/
(failed reverse-i-search)`opeoc': cd d/^Cenocd-code/
[cody@franklin wrist3]$ sudo ~/.local/bin/openocd -c gdb_port\ 3333 -f board/st_nucleo_f4.cfg
Open On-Chip Debugger 0.10.0+dev-00281-g64f1f7b1-dirty (2018-01-25-14:00)
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: 2000 kHz
adapter_nsrst_delay: 100
none separate
srst_only separate srst_nogate srst_open_drain connect_deassert_srst
Info : Listening on port 6666 for tcl connections
Info : Listening on port 4444 for telnet connections
Info : Unable to match requested speed 2000 kHz, using 1800 kHz
Info : Unable to match requested speed 2000 kHz, using 1800 kHz
Info : clock speed 1800 kHz
Info : STLINK v2 JTAG v29 API v2 SWIM v18 VID 0x0483 PID 0x374B
Info : using stlink api v2
Info : Target voltage: 74.727272
Error: jtag status contains invalid mode value - communication failure
Polling target stm32f4x.cpu failed, trying to reexamine
Examination failed, GDB will be halted. Polling again in 100ms
Info : Previous state query failed, trying to reconnect
Error: jtag status contains invalid mode value - communication failure
Polling target stm32f4x.cpu failed, trying to reexamine
Examination failed, GDB will be halted. Polling again in 300ms
Info : Listening on port 3333 for gdb connections
Info : Previous state query failed, trying to reconnect
Error: jtag status contains invalid mode value - communication failure
Polling target stm32f4x.cpu failed, trying to reexamine
Examination failed, GDB will be halted. Polling again in 700ms
Info : Previous state query failed, trying to reconnect
Error: jtag status contains invalid mode value - communication failure
Polling target stm32f4x.cpu failed, trying to reexamine
Examination failed, GDB will be halted. Polling again in 1500ms
^C
[cody@franklin wrist3]$ sudo ~/.local/bin/openocd -c gdb_port\ 3333 -f board/st_nucleo_f4.cfg
Open On-Chip Debugger 0.10.0+dev-00281-g64f1f7b1-dirty (2018-01-25-14:00)
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: 2000 kHz
adapter_nsrst_delay: 100
none separate
srst_only separate srst_nogate srst_open_drain connect_deassert_srst
Info : Listening on port 6666 for tcl connections
Info : Listening on port 4444 for telnet connections
Info : Unable to match requested speed 2000 kHz, using 1800 kHz
Info : Unable to match requested speed 2000 kHz, using 1800 kHz
Info : clock speed 1800 kHz
Info : STLINK v2 JTAG v29 API v2 SWIM v18 VID 0x0483 PID 0x374B
Info : using stlink api v2
Info : Target voltage: 3.245850
Info : stm32f4x.cpu: hardware has 0 breakpoints, 0 watchpoints
Error: mem2array: Read @ 0xe0042004, w=4, cnt=1, failed
/home/cody/.local/bin/../share/openocd/scripts/mem_helper.tcl:6: Error:
in procedure 'init'
in procedure 'ocd_bouncer'
in procedure 'mmw'
in procedure 'mrw' called at file "/home/cody/.local/bin/../share/openocd/scripts/mem_helper.tcl", line 25
at file "/home/cody/.local/bin/../share/openocd/scripts/mem_helper.tcl", line 6
Error: jtag status contains invalid mode value - communication failure
Polling target stm32f4x.cpu failed, trying to reexamine
Examination failed, GDB will be halted. Polling again in 100ms
Info : Previous state query failed, trying to reconnect
Error: jtag status contains invalid mode value - communication failure
Polling target stm32f4x.cpu failed, trying to reexamine
Examination failed, GDB will be halted. Polling again in 300ms
Info : Listening on port 3333 for gdb connections
Info : Previous state query failed, trying to reconnect
Error: jtag status contains invalid mode value - communication failure
Polling target stm32f4x.cpu failed, trying to reexamine
Examination failed, GDB will be halted. Polling again in 700ms
Info : Previous state query failed, trying to reconnect
Error: jtag status contains invalid mode value - communication failure
Polling target stm32f4x.cpu failed, trying to reexamine
Polling target stm32f4x.cpu failed, trying to reexamine
Examination failed, GDB will be halted. Polling again in 1500ms
^C
[cody@franklin wrist3]$ sudo ~/.local/bin/openocd -c gdb_port\ 3333 -f board/st_nucleo_f4.cfg
Open On-Chip Debugger 0.10.0+dev-00281-g64f1f7b1-dirty (2018-01-25-14:00)
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: 2000 kHz
adapter_nsrst_delay: 100
none separate
srst_only separate srst_nogate srst_open_drain connect_deassert_srst
Info : Listening on port 6666 for tcl connections
Info : Listening on port 4444 for telnet connections
Info : Unable to match requested speed 2000 kHz, using 1800 kHz
Info : Unable to match requested speed 2000 kHz, using 1800 kHz
Info : clock speed 1800 kHz
Info : STLINK v2 JTAG v29 API v2 SWIM v18 VID 0x0483 PID 0x374B
Info : using stlink api v2
Info : Target voltage: 3.250593
Error: jtag status contains invalid mode value - communication failure
Polling target stm32f4x.cpu failed, trying to reexamine
Examination failed, GDB will be halted. Polling again in 100ms
Info : Previous state query failed, trying to reconnect
Error: jtag status contains invalid mode value - communication failure
Polling target stm32f4x.cpu failed, trying to reexamine
Examination failed, GDB will be halted. Polling again in 300ms
Info : Listening on port 3333 for gdb connections
Info : Previous state query failed, trying to reconnect
Error: jtag status contains invalid mode value - communication failure
Polling target stm32f4x.cpu failed, trying to reexamine
Examination failed, GDB will be halted. Polling again in 700ms
Info : Previous state query failed, trying to reconnect
Error: jtag status contains invalid mode value - communication failure
Polling target stm32f4x.cpu failed, trying to reexamine
Examination failed, GDB will be halted. Polling again in 1500ms
^C
[cody@franklin wrist3]$ sudo ~/.local/bin/openocd -c gdb_port\ 3333 -f board/st_nucleo_f4.cfg
Open On-Chip Debugger 0.10.0+dev-00281-g64f1f7b1-dirty (2018-01-25-14:00)
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: 2000 kHz
adapter_nsrst_delay: 100
none separate
srst_only separate srst_nogate srst_open_drain connect_deassert_srst
Info : Listening on port 6666 for tcl connections
Info : Listening on port 4444 for telnet connections
Info : Unable to match requested speed 2000 kHz, using 1800 kHz
Info : Unable to match requested speed 2000 kHz, using 1800 kHz
Info : clock speed 1800 kHz
Info : STLINK v2 JTAG v29 API v2 SWIM v18 VID 0x0483 PID 0x374B
Info : using stlink api v2
Info : Target voltage: 3.252174
Info : stm32f4x.cpu: hardware has 6 breakpoints, 4 watchpoints
Info : Listening on port 3333 for gdb connections
I was testing this using a ST Nucleo F429ZI and it's onboard stlink-v2-1, running firmware V2.J29.M18 ( which is shipped with the current STSW-LINK004 4.2.0 as downloaded earlier today).
I've observed similar behavior with a stm32f407g-disc1.
openocd was connected & streaming data back via itm. stlink usb device was disconnected & then reconnected much later (without killing openocd).
openocd was then killed & restarted, at which point it failed to establish comms until the reset button was held while openocd was started.
log attached. The output at start is from a openocd session that was functional until the stlink usb was unplugged. The last openocd session started was functional again (after holding down the reset button while starting that openocd instance)
After enabling address sanitizer and ubsan & fixing some reported bugs, the same issue results in a failure to read the stm32, with many register reads resulting in
0xa05f0000
(DBGKEY
).In the output below, the first problem occured numerous times until the reset on the nucleo-f767zi was held down while
openocd
was started (which is what was done durring the secondopenocd
invocation.Heres some other output from the same error as noted in the comment above. Note that
0xa05f0000
is seen for bothDWT_CTRL
and the device id.I've reproduced this with a seperate stlink-v2 on a stm32f777bit.
Note that the first run shows a strange number of watchpoints & breakpoints.
The second run is done while holding an on-board reset button.
This openocd is slightly modified from be87994d60457ac846740dd9e5df3c8f63cf646e to silence some ubsan warnings.
Hi,
On Tue, Apr 10, 2018 at 08:42:46PM -0000, Cody Schafer wrote:
Does reset_config "srst_only connect_assert_srst" (obviously with SRST
connected to the debugger) help?
--
Be free, use free (http://www.gnu.org/philosophy/free-sw.html) software!
mailto:fercerpav@gmail.com
After observing the strange number of breakpoints/watchpoints, using:
To connect with openocd appears to connect correctly (correct number of breakpoints/watchpoints).
However, when I then connect gdb to openocd to load an image, openocd hangs and notes:
At the end, gdb is kicked out:
Line 1 of
.gdbinit
istarget extended-remote :3333
.Using the "hold reset button while starting openocd" workaround gets us fully functional (can load a program).
Last edit: Cody Schafer 2018-04-19