Tutorial01 on VirtualBox: openocd Error: open failed


#1

Hi, I’m running Lubuntu in a VirtualBox guest on Windows10 Pro host.

Not sure if I set up the USB settings in VirtualBox OK:

I’m getting this error in the opencd window; see below for the gdb window.

roger@roger-VB:~/luos$ openocd -f $OPENCD_ROOT/interface/stlink-v2.cfg -f $OPENCD_ROOT/target/stm32f0x.cfg
Open On-Chip Debugger 0.9.0 (2015-09-02-10:42)
Licensed under GNU GPL v2
For bug reports, read
	http://openocd.org/doc/doxygen/bugs.html
Info : auto-selecting first available session transport "hla_swd". To override use 'transport select <transport>'.
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
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
Error: open failed
in procedure 'init' 
in procedure 'ocd_bouncer'

gdb window: cannot continue

roger@roger-VB:~/luos$ arm-none-eabi-gdb target/thumbv6m-none-eabi/debug/examples/led_button
GNU gdb (7.10-1ubuntu3+9) 7.10
Copyright (C) 2015 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "--host=x86_64-linux-gnu --target=arm-none-eabi".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from target/thumbv6m-none-eabi/debug/examples/led_button...done.
warning: File "/home/roger/luos/.gdbinit" auto-loading has been declined by your `auto-load safe-path' set to "$debugdir:$datadir/auto-load".
To enable execution of this file add
	add-auto-load-safe-path /home/roger/luos/.gdbinit
line to your configuration file "/home/roger/.gdbinit".
To completely disable this security protection add
	set auto-load safe-path /
line to your configuration file "/home/roger/.gdbinit".
For more information about this security protection see the
"Auto-loading safe path" section in the GDB manual.  E.g., run from the shell:
	info "(gdb)Auto-loading safe path"
warning: Missing auto-load script at offset 0 in section .debug_gdb_scripts
of file /home/roger/luos/target/thumbv6m-none-eabi/debug/examples/led_button.
Use `info auto-load python-scripts [REGEXP]' to list them.
(gdb) continue
The program is not being run.

Any ideas?


#2

Hi Worrelsik,

Please, try to clear the Serial No. into the USB Filter Details … I was able to reproduce your first error when I put a serial number.

To be sure, with lsusb command, you must see the STLink probe
image


#3

Please, try to clear the Serial No. into the USB Filter Details

Thanks, that made the first error in the openocd terminal disappear indeed.
The lsusb command shows the same kind of output as yours.

The second error disappeared after doing what the error message told me to (but I had failed to notice initially):
echo 'add-auto-load-safe-path' >> ~/.gdbinit

Maybe this should be added as a step in the tutorial, or is this happening only on my machine?

The animated GIF is a little hard to compare with what I had initially, so I did not really notice the difference. I’d advice to use still images in this case.

Anyway, pressing the button now results in the LED turning on? Yay!


#4

I added your problem into the troubleshooting section with a little explanation. :slight_smile:
Thanks !


#5

Great, but IMHO the Troubleshooting section of the page ‘Your first program’ is a better fit than the current page ‘Linux installation guide’ as the latter does not mention gdb


#6

You are right ! I change this immediatly :wink:
Thanks


#7

I have the same problem as discussed here but the solution did NOT help me at all. I have a serial number and ‘lsusb’ shows:

Bus 001 Device 004: ID 0483:374b STMicroelectronics ST-LINK/V2.1 (Nucleo-F103RB)
Bus 001 Device 002: ID 80ee:0021 VirtualBox USB Tablet
Bus 001 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub

but I still get:

Open On-Chip Debugger 0.10.0-rc2
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 : 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
Error: open failed
in procedure ‘init’
in procedure ‘ocd_bouncer’

Any other suggestions?

I’ve also already tried:

Changing the Probuct ID to: 374b NOT 3748 (as discussed in another thread)
Changing the Port from USB3 to USB2