I have a STM32F302R8 Nucleo board as the hardware, with a built-in programmer with SWD interface, Windows 7 and the software setup is Eclipse Oxygen IDE with OpenSTM32 plugin, the project files created using STM32CubeMX. I created a debug configuration in Eclipse and the project compiles and creates debug binaries and all is hunky-dory until I am trying to run a debug session using OpenOCD. The damn thing cant connect to the board no matter what - I have attached a full log from OpenOCD, the meat is in the last few lines where it fails. The problem is I cant figure out why. Here is the related part from the log:
Debug: 258 166 hla_layout.c:42 hl_layout_open(): hl_layout_open
Debug: 259 169 stlink_usb.c:1698 stlink_usb_open(): stlink_usb_open
Debug: 260 169 stlink_usb.c:1716 stlink_usb_open(): transport: 1 vid: 0x0483 pid: 0x374b serial:
Error: 261 207 stlink_usb.c:1729 stlink_usb_open(): open failed
Debug: 262 207 hla_layout.c:49 hl_layout_open(): failed
Debug: 263 208 command.c:628 run_command(): Command failed with error code -4
User : 264 208 command.c:689 command_run_line(): in procedure 'init'
in procedure 'ocd_bouncer'
Now, I also downloaded the ST-Link programming utility from ST and when I run it, it is working, it finds the board no problem. So the board and the USB link is operational. I checked and made sure the board's USB PID/VID in Windows are the same as in the OpenOCD script files, and they also can be seen in the attached log, all is matching. Still, OpenOCD in Eclipse fails to see the board, while ST-Link can. I went one step farther and installed a standalone version of OpenOCD to no avail, still not working, so the problem is not with Eclipse.
I wonder if there is a secret sauce that you know about, how to get OpenOCD connect to an STM32 board that has a built-in ST-Link v2.1, or if it is known to be flaky and maybe I should not waste my time on it. Again, the vendor utility is working no problem.