Skip to content

Instantly share code, notes, and snippets.

@yuqlid
Created November 30, 2017 14:22
Show Gist options
  • Save yuqlid/46475208f41d8d6399c946a6e0a6ce60 to your computer and use it in GitHub Desktop.
Save yuqlid/46475208f41d8d6399c946a6e0a6ce60 to your computer and use it in GitHub Desktop.
VSCodeでGDB+OpenOCDデバッグ
{
"version": "0.2.0",
"configurations": [
{
"name": "C++ Launch",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceRoot}/BUILD/${workspaceRootFolderName}.elf",
"args": [],
"stopAtEntry": true,
"cwd": "${workspaceRoot}",
"environment": [],
"externalConsole": false,
"debugServerArgs": "-f \"C:\\Program Files\\GNU MCU Eclipse\\OpenOCD\\0.10.0-3-20170826-1813-dev\\scripts\\board\\st_nucleo_f4.cfg\" -c init -c \"reset init\"",
//"debugServerArgs": "-f /usr/local/Cellar/open-ocd/0.10.0/share/openocd/scripts/board/st_nucleo_f4.cfg -c init -c \"reset init\"",
//"debugServerArgs"にはOpenOCDに用意されているマイコンや基板の.cfgファイルのパスを入れる
"serverLaunchTimeout": 20000,
"filterStderr": true,
"filterStdout": false,
//"serverStarted": "GDB\\ server\\ started",
"serverStarted": "target halted due to debug-request, current mode: Thread",
"preLaunchTask": "make",
"setupCommands": [
{ "text": "-target-select remote localhost:3333", "description": "connect to target", "ignoreFailures": false },
{ "text": "-file-exec-and-symbols ${workspaceRoot}/BUILD/${workspaceRootFolderName}.elf", "description": "load file", "ignoreFailures": false},
{ "text": "-interpreter-exec console \"monitor endian little\"", "ignoreFailures": false },
{ "text": "-interpreter-exec console \"monitor reset\"", "ignoreFailures": false },
{ "text": "-interpreter-exec console \"monitor halt\"", "ignoreFailures": false },
{ "text": "-interpreter-exec console \"monitor arm semihosting enable\"", "ignoreFailures": false },
{ "text": "-target-download", "description": "flash target", "ignoreFailures": false }
],
"logging": {
"moduleLoad": true,
"trace": true,
"engineLogging": true,
"programOutput": true,
"exceptions": true
},
//OSごとのGDBとOpenOCDのパスの設定,なおLinuxでは未検証
"linux": {
"MIMode": "gdb",
"MIDebuggerPath": "/usr/bin/arm-none-eabi-gdb",
"debugServerPath": "pyocd-gdbserver"
},
"osx": {
"MIMode": "gdb",
"MIDebuggerPath": "/usr/local/gcc-arm-none-eabi-6-2017q2/bin/arm-none-eabi-gdb",
"debugServerPath": "/usr/local/bin/openocd"
},
"windows": {
"preLaunchTask": "make.exe",
"MIMode": "gdb",
"MIDebuggerPath": "C:\\Program Files\\GNU Tools ARM Embedded\\6 2017-q2-update\\bin\\arm-none-eabi-gdb.exe",
"debugServerPath": "C:\\Program Files\\GNU MCU Eclipse\\OpenOCD\\0.10.0-3-20170826-1813-dev\\bin\\openocd.exe",
"setupCommands": [
{ "text": "-environment-cd ${workspaceRoot}\\BUILD" },
{ "text": "-target-select remote localhost:3333", "description": "connect to target", "ignoreFailures": false },
{ "text": "-file-exec-and-symbols ${workspaceRootFolderName}.elf", "description": "load file", "ignoreFailures": false},
{ "text": "-interpreter-exec console \"monitor endian little\"", "ignoreFailures": false },
{ "text": "-interpreter-exec console \"monitor reset\"", "ignoreFailures": false },
{ "text": "-interpreter-exec console \"monitor halt\"", "ignoreFailures": false },
{ "text": "-interpreter-exec console \"monitor arm semihosting enable\"", "ignoreFailures": false },
{ "text": "-target-download", "description": "flash target", "ignoreFailures": false }
]
}
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment