【问题标题】:GDB Disconnects when trying to debug via openocd尝试通过 openocd 调试时 GDB 断开连接
【发布时间】:2022-08-10 20:14:54
【问题描述】:

我在 Windows 10 上尝试使用 stlink、openocd 和 vscode 调试我的 bluepill (STM32f103C8) 板。我得到这个弹出窗口:\“OpenOCD GDB 服务器意外退出。有关更多详细信息,请参阅 gdb-server 输出。\”

终端中的这条消息:

Open On-Chip Debugger 0.11.0 (2021-11-18) [https://github.com/sysprogs/openocd]
Licensed under GNU GPL v2
libusb1 09e75e98b4d9ea7909e8837b7a3f00dda4589dc3
For bug reports, read
        http://openocd.org/doc/doxygen/bugs.html
CDRTOSConfigure
Info : auto-selecting first available session transport \"hla_swd\". To override use \'transport select <transport>\'.
Info : The selected transport took over low-level target control. The results might differ compared to plain JTAG/SWD
Info : DEPRECATED target event trace-config; use TPIU events {pre,post}-{enable,disable}
Info : Listening on port 50001 for tcl connections
Info : Listening on port 50002 for telnet connections
Info : clock speed 1000 kHz
Info : STLINK V2J36S7 (API v2) VID:PID 0483:3748
Info : Target voltage: 3.186911
Info : stm32f1x.cpu: Cortex-M3 r1p1 processor detected
Info : stm32f1x.cpu: target has 6 breakpoints, 4 watchpoints
Info : starting gdb server for stm32f1x.cpu on 50000
Info : Listening on port 50000 for gdb connections
[2022-06-07T02:43:25.028Z] SERVER CONSOLE DEBUG: onBackendConnect: gdb-server session closed
GDB server session ended. This terminal will be reused, waiting for next session to start...

我的launch.json如下:

    \"version\": \"0.2.0\",
    \"configurations\": 
    [
        {
            \"name\": \"GDB\",
            \"cwd\": \"${workspaceFolder}\",
            \"executable\": \"./Test/Build/snake.elf\",
            \"request\": \"launch\",
            \"type\": \"cortex-debug\",
            \"runToEntryPoint\": \"main\",
            \"servertype\": \"openocd\",
            \"device\": \"STM32f103C8\",
            \"interface\": \"swd\",
            \"configFiles\": 
            [
                \"interface/stlink.cfg\",
                \"target/stm32f1x.cfg\",
            ],
        }
    ]
}

我不确定我做错了什么。任何帮助将不胜感激。

    标签: visual-studio-code gdb stm32 openocd st-link


    【解决方案1】:

    我发现了我的问题,所以我想我会分享以防其他人有类似的问题。

    arm-none-eabi-gdb 在启动时崩溃。这是因为我缺少 python27.dll。您需要安装 python 2.7,它必须是 python 2.7 的 x86 版本,因为 Windows 的 gnu arm 是 x86。

    很奇怪,arm-none-eabi-gdb 需要安装 python 2.7,因为它是 2020 年的 EOL,但我们到了。我想在未来的某个版本中,python 2.7 依赖项将被删除。

    【讨论】:

      【解决方案2】:

      我没有足够的声誉来投票,但 Ed 的回答是完全正确的。

      另一种解决方案:我最终遇到了同样的问题,只是使用了早期版本的 ARM 嵌入式工具链 (gcc-arm-none-eabi-10.3-2021.10),并让我的项目使用 OpenOCD 为 Nucleo STM32L476RG 进行调试。

      希望这可以帮助。

      【讨论】:

        猜你喜欢
        • 2023-04-05
        • 2012-03-22
        • 1970-01-01
        • 2013-06-25
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多