Closed meteusteler closed 6 years ago
You could try something like this, don't forget to fix debugServerArgs
to fit your hardware.
Replace APP.out
with your ELF output, download arm-none-eabi
and openocd
and fix the paths
{
"name": "Debug ST-Link",
"type": "cppdbg",
"request": "launch",
"program": "APP.out",
"stopAtEntry": true,
"cwd": "${workspaceRoot}",
"externalConsole": false,
"MIMode": "gdb",
"miDebuggerPath": "arm-none-eabi-gdb.exe",
"debugServerPath": "openocd/bin/openocd.exe",
"debugServerArgs": "-s \"openocd\\share\\openocd\\scripts\" -f interface/stlink-v2-1.cfg -c \"transport select hla_swd\" -f target/stm32l4x.cfg -c \"adapter_khz 4000\" -c \"telnet_port disabled\" -c \"tcl_port disabled\"",
"serverStarted": "Info\\ :\\ [\\w\\d\\.]*:\\ hardware",
"serverLaunchTimeout": 5000,
"targetArchitecture": "arm",
"filterStderr": true,
"filterStdout": true,
"launchCompleteCommand": "exec-continue",
"logging": {
"trace": false,
"traceResponse": false,
"engineLogging": true
},
"setupCommands": [
{
"text": "target remote localhost:3333"
},
{
"text": "monitor reset halt"
},
{
"text": "load APP.out"
},
{
"text": "monitor reset init"
}
]
}
Hi, I tried your suggestion and I get error like this:
1: (205) LaunchOptions<LocalLaunchOptions xmlns='http://schemas.microsoft.com/vstudio/MDDDebuggerOptions/2014'
1: (222) LaunchOptions ExePath='C:\Users**\EWARM\STM32F051\Exe\Project.out'
1: (222) LaunchOptions WorkingDirectory='C:\Users*'
1: (222) LaunchOptions TargetArchitecture='arm'
1: (222) LaunchOptions ExeArguments=''
1: (222) LaunchOptions MIMode='gdb'
1: (222) LaunchOptions MIDebuggerPath='C:\Program Files (x86)\GNU Tools ARM Embedded\7 2017-q4-major\bin\arm-none-eabi-gdb.exe'
1: (222) LaunchOptions WaitDynamicLibLoad='false'
1: (222) LaunchOptions DebugServer='C:\Users*\Desktop\OpenOCD-20170821\bin\openocd.exe'
1: (223) LaunchOptions DebugServerArgs='-s "openocd\share\openocd\scripts" -f interface/stlink-v2-1.cfg -c "transport select hla_swd" -f target/stm32F0x.cfg -c "adapter_khz 4000" -c "telnet_port disabled" -c "tcl_port disabled"'
1: (223) LaunchOptions
and my json file like this,
{ "version": "0.2.1", "configurations": [
{
"name": "Debug ST-Link",
"type": "cppdbg",
"request": "launch",
"program": "C:\\Users\\**\\EWARM\\STM32F051\\Exe\\Project.out",
"stopAtEntry": true,
"cwd": "${workspaceRoot}",
"externalConsole": false,
"MIMode": "gdb",
"miDebuggerPath": "C:\\Program Files (x86)\\GNU Tools ARM Embedded\\7 2017-q4-major\\bin\\arm-none-eabi-gdb.exe",
"debugServerPath": "C:\\Users\\**\\Desktop\\OpenOCD-20170821\\bin\\openocd.exe",
"debugServerArgs": "-s \"openocd\\share\\openocd\\scripts\" -f interface/stlink-v2-1.cfg -c \"transport select hla_swd\" -f target/stm32F0x.cfg -c \"adapter_khz 4000\" -c \"telnet_port disabled\" -c \"tcl_port disabled\"",
"serverStarted": "Info\\ :\\ [\\w\\d\\.]*:\\ hardware",
"serverLaunchTimeout": 5000,
"targetArchitecture": "arm",
"filterStderr": true,
"filterStdout": true,
"launchCompleteCommand": "exec-continue",
"logging": {
"trace": false,
"traceResponse": false,
"engineLogging": true
},
"setupCommands": [
{
"text": "target remote localhost:3333"
},
{
"text": "monitor reset halt"
},
{
"text": "load APP.out"
},
{
"text": "monitor reset init"
}
]
}
]
}
Hi, it seems to be an OpenOCD problem, try to run it manually with cmd.exe and look for errors on the output:
"C:\Users\*\Desktop\OpenOCD-20170821\bin\openocd.exe" -s "openocd\share\openocd\scripts" -f interface/stlink-v2-1.cfg -c "transport select hla_swd" -f target/stm32F0x.cfg -c "adapter_khz 4000" -c "telnet_port disabled" -c "tcl_port disabled"
Anyhow I just tried out with openocd and ST-Link and it's working, this is my configuration:
{
"version": "0.2.1",
"configurations": [
{
"name": "Debug ST-Link",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceRoot}/project/build/debug/EBUI.out",
"stopAtEntry": true,
"cwd": "${workspaceRoot}",
"externalConsole": false,
"MIMode": "gdb",
"miDebuggerPath": "C:\\GCC\\arm\\bin\\arm-none-eabi-gdb.exe",
"debugServerPath": "C:\\GCC\\debug\\openocd\\bin\\openocd.exe",
"debugServerArgs": "-s \"C:\\GCC\\debug\\openocd\\share\\openocd\\scripts\" -f interface/stlink-v2-1.cfg -c \"transport select hla_swd\" -f target/stm32l4x.cfg -c \"adapter_khz 1000\" -c \"telnet_port disabled\" -c \"tcl_port disabled\"",
"serverStarted": "Info\\ :\\ [\\w\\d\\.]*:\\ hardware",
"serverLaunchTimeout": 10000,
"targetArchitecture": "arm",
"filterStderr": true,
"filterStdout": true,
"logging": {
"trace": false,
"traceResponse": false,
"engineLogging": false
},
"setupCommands": [
{
"text": "target remote localhost:3333"
},
{
"text": "monitor reset init"
},
{
"text": "load C:/Users/Leonardo/Desktop/EBUI/project/build/debug/EBUI.out"
},
{
"text": "monitor reset init"
}
]
}
]
}
What should be launch.json configuration for debug with St-Link?