stm32cubeidenucleostm32f1arm-none-eabi-gccst-link

Came up with an "Unable to stat debugging" error when Debug program for STM32 NUCLEOF103RB


I am trying to use STM32 VSC extension plugin on VSCode for a better coding experience, but error occored when I am trying to debugging.

VSCode suggested that build task finish successfully in the terminal.

It seems debugger failed to connect debug server. [I am not sure what debug server is and how they work. The only thing I know is that launch file has set up 2 tools named:

ST-LINK_gdbserver.exe and arm-none-eabi-gdb.exe. Iguess they are connected with each other and transmit debug info by TCP(?)]

I have already tried connect and reconnect my NUCLEO board on my computer. When debugger runnging, the stlink flashlight on the NUCLEO is blinking as normal (red-green-red-green). But somehow the program can't be uploaded. Also I've allowed the debugger access my network so the issue shouldn't caused by a block of my defender (I am using windows Defender only) on my computer.

But, however, the debugger crashed before everything I predicted happen and here is some related infos.

DEBUG CONSOLE output:

1: (72) LaunchOptions{"name":"Launch","type":"cppdbg","request":"launch","cwd":"D:\\Programs\\ENV\\STM32_plugged\\CUBER\\WIN_TS_IV\\TRY_V","program":"D:\\Programs\\ENV\\STM32_plugged\\CUBER\\WIN_TS_IV\\TRY_V\\build\\debug\\build\\TRY_V.elf","MIMode":"gdb","miDebuggerPath":"C:/ST/STM32CubeIDE_1.13.2/STM32CubeIDE/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.11.3.rel1.win32_1.1.1.202309131626/tools/bin/arm-none-eabi-gdb.exe","miDebuggerServerAddress":"localhost:3333","debugServerPath":"C:/ST/STM32CubeIDE_1.13.2/STM32CubeIDE/plugins/com.st.stm32cube.ide.mcu.externaltools.stlink-gdb-server.win32_2.1.0.202305091550/tools/bin/ST-LINK_gdbserver.exe","debugServerArgs":"--stm32cubeprogrammer-path C:/ST/STM32CubeIDE_1.13.2/STM32CubeIDE/plugins/com.st.stm32cube.ide.mcu.externaltools.cubeprogrammer.win32_2.1.0.202305091550/tools/bin --swd --port-number 3333","serverStarted":"Waiting for connection on port .*//.//.//.","stopAtConnect":true,"postRemoteConnectCommands":[{"text":"load build/debug/build/TRY_V.elf"}],"logging":{"engineLogging":true},"preLaunchTask":"Build","__configurationTarget":6,"configSource":"workspaceFolder","debugType":"debug","__sessionId":"48b983e1-61a7-44a6-891d-b74ba9ff307b"}

This is my "launch.json" file:


{
  "version": "0.2.0",
  "configurations": [
   
    {
      "name": "Launch",
      "type": "cppdbg",
      "request": "launch",
      "cwd": "${workspaceFolder}",
      "program": "${command:cmake.launchTargetPath}",
      "MIMode": "gdb",
      "miDebuggerPath": "C:/ST/STM32CubeIDE_1.13.2/STM32CubeIDE/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.11.3.rel1.win32_1.1.1.202309131626/tools/bin/arm-none-eabi-gdb.exe",
      "miDebuggerServerAddress": "localhost:3333",
      "debugServerPath": "C:/ST/STM32CubeIDE_1.13.2/STM32CubeIDE/plugins/com.st.stm32cube.ide.mcu.externaltools.stlink-gdb-server.win32_2.1.0.202305091550/tools/bin/ST-LINK_gdbserver.exe",
      "debugServerArgs": "--stm32cubeprogrammer-path C:/ST/STM32CubeIDE_1.13.2/STM32CubeIDE/plugins/com.st.stm32cube.ide.mcu.externaltools.cubeprogrammer.win32_2.1.0.202305091550/tools/bin --swd --port-number 3333",
      "serverStarted": "Waiting for connection on port .*//.//.//.",
      "stopAtConnect": true,
      "postRemoteConnectCommands": [
        {
          "text": "load build/debug/build/TRY_V.elf"
        }
      ],
      "logging": {
        "engineLogging": true
      },
      "preLaunchTask": "Build"
    }
  ]
}

This is my VSC layout: layout

As a freshman in STM32 development, I am not so familiar with the toolchain it use, hoping somebody could do me a favour. Sincerely.


Solution

  • After several hours browsing the documents, I discovered an important suggestion on Cube Extension's page. "Troubleshooting When starting the debugger it can happen the connection to the board fails with a Visual Studio Code message reporting "Unable to start debugging. No process is associated with this object." The root cause can be identified in the DEBUG CONSOLE. Most probably the following message is reported: "Error in initializing ST-LINK device. Reason: ST-LINK firmware upgrade required."

    To overcome the issue please install and run STM32CubeProg to upgrade the ST-LINK firmware as required."

    In a word: what we need to do is trying to update our ST-Link firmware