简体   繁体   中英

GDB Disconnects when trying to debug via openocd

I'm on windows 10 trying to debug my bluepill (STM32f103C8) board using a stlink, openocd, and vscode. I get this pop up: "OpenOCD GDB Server Quit Unexpectedly. See gdb-server output for more details."

And this message in the terminal:

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...

My launch.json is as follows:

    "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",
            ],
        }
    ]
}

I'm not sure what I'm doing wrong. Any help would be greatly appreciated.

I figured out my problem, so I figured I'd shared in case anyone else has similar issues.

arm-none-eabi-gdb was crashing at start up. This was due to me missing python27.dll. You need to have python 2.7 installed, and it has to be the x86 version of python 2.7 because gnu arm for windows is x86.

Its very odd that arm-none-eabi-gdb requires python 2.7 to be installed as it was EOL in 2020, but here we are. I imagine in some future release the python 2.7 dependency will be removed.

Ed's answer is totally correct.

An alternative solution: I ended up running into the same issue and just went with an earlier version of the ARM Embedded Toolchain (gcc-arm-none-eabi-10.3-2021.10) and got my project to debug using OpenOCD for the Nucleo STM32L476RG.

Hope this helps.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM