json VSCodeでGDB + OpenOCD的デバッグ

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了json 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 }
                ]
            }
        }
    ]
}

以上是关于json VSCodeでGDB + OpenOCD的デバッグ的主要内容,如果未能解决你的问题,请参考以下文章

GDB 和 OpenOCD - 调试结束后重置或恢复

GDB 和 OpenOCD:输出所有执行的函数

用于 Flash 和 Ram 调试的 STM32 GDB/OpenOCD 命令和初始化

arm-none-eabi-gdb 和 openocd:对偏移量查询、qOffsets 的错误响应?

STM32 OpenOCD调试

OpenOCD的概念,安装和使用