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: (76) 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":"6cfcefe6-4251-4735-8b0e-188844f1368a"}
1: (140) Starting: "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" --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
1: (334) ->
1: (339) ->
1: (339) ->STMicroelectronics ST-LINK GDB server. Version 7.4.0
1: (340) ->Copyright (c) 2023, STMicroelectronics. All rights reserved.
1: (340) ->
1: (340) ->Starting server with the following options:
1: (340) -> Persistent Mode : Disabled
1: (340) -> Logging Level : 31
1: (340) -> Listen Port Number : 3333
1: (340) -> Status Refresh Delay : 15s
1: (340) -> Verbose Mode : Disabled
1: (341) -> SWD Debug : Enabled
1: (341) ->
1: (346) ->COM frequency = 4000 kHz
1: (347) ->Target connection mode: Default
1: (353) ->Reading ROM table for AP 0 @0xe00fffd0
1: (356) ->Hardware watchpoint supported by the target
1: (359) ->ST-LINK Firmware version : V2J42M27
1: (360) ->Device ID: 0x410
1: (360) ->PC: 0x8000d10
1: (360) ->ST-LINK device status: HALT_MODE
1: (360) ->ST-LINK detects target voltage = 3.26 V
1: (361) ->ST-LINK device status: HALT_MODE
1: (361) ->ST-LINK device initialization OK
1: (361) ->Stm32Device, pollAndNotify running...
1: (363) ->SwvSrv state change: 0 -> 1
1: (364) ->Waiting for debugger connection...
1: (364) ->Waiting for connection on port 3333...
1: (364) ->Waiting for connection on port 3334...
1: (10323) <-logout
1: (10339) Send Event AD7MessageEvent
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:
As a freshman in STM32 development, I am not so familiar with the toolchain it use, hoping somebody could do me a favour. Sincerely.