nanjo712 / nanjo712.github.io

GNU General Public License v3.0
0 stars 0 forks source link

OpenOCD-Tools使用文档 | The Vault of woshiren #5

Open nanjo712 opened 2 months ago

nanjo712 commented 2 months ago

https://nanjo712.github.io/2024/07/28/OpenOCD-Tools%E4%BD%BF%E7%94%A8%E6%96%87%E6%A1%A3/

OpenOCD Tools是一个将OpenOCD与VSCode集成的小型插件,封装了OpenOCD的烧录和调试操作。 6.11版本之后的CubeMX引入了对CMake的原生支持,可以直接通过CubeMX直接配置生成CMake工程。 当前版本该插件仅支持类STM32 MCU的CMake工程。 功能特性:

一键烧录调试固件 自动扫描固件文件 自动识别MCU,根据选择的调试器生成Ope

nanjo712 commented 2 weeks ago

stlink有端口这回事吗,openocd的gdb端口是默认3333,tcl脚本是4444


发件人: shi-linyu @.> 发送时间: 2024年10月4日 13:02 收件人: nanjo712/nanjo712.github.io @.> 抄送: woshiren @.>; Author @.> 主题: Re: [nanjo712/nanjo712.github.io] OpenOCD-Tools使用文档 | The Vault of woshiren (Issue #5)

启动debug的话会使用stlink的默认端口3333,怎么切换成daplink的4444呢?debugger那边设置了没用

― Reply to this email directly, view it on GitHubhttps://github.com/nanjo712/nanjo712.github.io/issues/5#issuecomment-2393658103, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ALHSF7STVVFEJJPQHOGPVF3ZZ2GUTAVCNFSM6AAAAABLTOFJDGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGOJTGY2TQMJQGM. You are receiving this because you authored the thread.Message ID: @.***>

shi-linyu commented 1 week ago

不好意思哈,刚接触vscode下的这个开发,我有个问题,就是这个扩展的debug不能正常使用,会报这个错: [Window Title] Visual Studio Code

[Content] Unable to start debugging. Unexpected GDB output from command "-interpreter-exec console "target remote :3333"". Truncated register 16 in remote 'g' packet

[打开“launch.json”] [取消]

然后我的launch.json里面是这样的: { // Use IntelliSense to learn about possible attributes. // Hover to view descriptions of existing attributes. // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 "version": "0.2.0", "configurations": [ { "cwd": "${workspaceRoot}", "executable": "${command:cmake.launchTargetPath}", "name": "Debug with OpenOCD", "request": "launch", "type": "cortex-debug", "device":"STM32F407IGTx", "servertype": "openocd", "configFiles": [ "${workspaceRoot}/openocd.cfg" ], // "preLaunchTask": "build", "runToEntryPoint": "main", "showDevDebugOutput": "none", "armToolchainPath": "${config:STM32VSCodeExtension.cubeCLT.path}/GNU-tools-for-STM32/bin", "liveWatch": { "enabled": true, "samplesPerSecond": 10 }, },

    {
        "name": "Build & Debug Microcontroller - ST-Link",
        "cwd": "${workspaceFolder}",
        "type": "cortex-debug",
        "executable": "${command:cmake.launchTargetPath}",
        // Let CMake extension decide executable: "${command:cmake.launchTargetPath}"
        // Or fixed file path: "${workspaceFolder}/path/to/filename.elf"
        "request": "launch",
        "servertype": "stlink",
        "device": "STM32F407IGTx", //MCU used
        "interface": "swd",
        "serialNumber": "",        //Set ST-Link ID if you use multiple at the same time
        "runToEntryPoint": "main",
        "svdFile": "${config:STM32VSCodeExtension.cubeCLT.path}/STMicroelectronics_CMSIS_SVD/STM32F407.svd",
        "v1": false,               //Change it depending on ST Link version
        "serverpath": "${config:STM32VSCodeExtension.cubeCLT.path}/STLink-gdb-server/bin/ST-LINK_gdbserver",
        "stm32cubeprogrammer":"${config:STM32VSCodeExtension.cubeCLT.path}/STM32CubeProgrammer/bin",
        "stlinkPath": "${config:STM32VSCodeExtension.cubeCLT.path}/STLink-gdb-server/bin/ST-LINK_gdbserver",   
        "armToolchainPath": "${config:STM32VSCodeExtension.cubeCLT.path}/GNU-tools-for-STM32/bin",
        "gdbPath":"${config:STM32VSCodeExtension.cubeCLT.path}/GNU-tools-for-STM32/bin/arm-none-eabi-gdb",            
        "serverArgs": [
            "-m","0",
        ],
        //"preLaunchTask": "Build + Flash"
        /* If you use external loader, add additional arguments */
        //"serverArgs": ["--extload", "path/to/ext/loader.stldr"],
    },
    {
        "name": "Attach to Microcontroller - ST-Link",
        "cwd": "${workspaceFolder}",
        "type": "cortex-debug",
        "executable": "${command:cmake.launchTargetPath}",
        // Let CMake extension decide executable: "${command:cmake.launchTargetPath}"
        // Or fixed file path: "${workspaceFolder}/path/to/filename.elf"
        "request": "attach",
        "servertype": "stlink",
        "device": "STM32F407IGTx", //MCU used
        "interface": "swd",
        "serialNumber": "",        //Set ST-Link ID if you use multiple at the same time
        "runToEntryPoint": "main",
        "svdFile": "${config:STM32VSCodeExtension.cubeCLT.path}/STMicroelectronics_CMSIS_SVD/STM32F407.svd",
        "v1": false,               //Change it depending on ST Link version
        "serverpath": "${config:STM32VSCodeExtension.cubeCLT.path}/STLink-gdb-server/bin/ST-LINK_gdbserver",
        "stm32cubeprogrammer":"${config:STM32VSCodeExtension.cubeCLT.path}/STM32CubeProgrammer/bin",
        "stlinkPath": "${config:STM32VSCodeExtension.cubeCLT.path}/STLink-gdb-server/bin/ST-LINK_gdbserver",   
        "armToolchainPath": "${config:STM32VSCodeExtension.cubeCLT.path}/GNU-tools-for-STM32/bin",
        "gdbPath":"${config:STM32VSCodeExtension.cubeCLT.path}/GNU-tools-for-STM32/bin/arm-none-eabi-gdb",            
        "serverArgs": [
            "-m","0",
        ],
        /* If you use external loader, add additional arguments */
        //"serverArgs": ["--extload", "path/to/ext/loader.stldr"],
    }
        ]

}

下面两个配置是cubeMX生成的,上面是我照着网上的教程写的,可以正常进入debug。