Marus / cortex-debug

Visual Studio Code extension for enhancing debug capabilities for Cortex-M Microcontrollers
MIT License
1.01k stars 238 forks source link

Can't start debug using stlink #747

Closed XinyuKhan closed 2 years ago

XinyuKhan commented 2 years ago

Version: v1.6.5

Platform:

MacOS

Config:

    {
        "name": "ST-Link Debug",
        "cwd": "`${workspaceFolder}",
        "executable": "${workspaceFolder}/Debug/xxx.elf",
        "request": "launch",
        "type": "cortex-debug",
        "servertype": "stlink",
        "serverpath": "/Applications/STM32CubeIDE.app/Contents/Eclipse/plugins/com.st.stm32cube.ide.mcu.externaltools.stlink-gdb-server.macos64_2.0.300.202203231527/tools/bin/ST-LINK_gdbserver",
        "device": "STM32F405RG",
        "interface": "swd",
        "runToEntryPoint": "main",
        "svdFile": "/Applications/STM32CubeIDE.app/Contents/Eclipse/plugins/com.st.stm32cube.ide.mcu.productdb.debug_2.0.300.202204011209/resources/cmsis/STMicroelectronics_CMSIS_SVD/STM32F405.svd",
        "showDevDebugOutput": "parsed"
    },

Error Log:

Cortex-Debug: VSCode debugger extension version 1.6.5 git(ed64786). Usage info: https://github.com/Marus/cortex-debug#usage Reading symbols from arm-none-eabi-objdump --syms -C -h -w xxx.elf Reading symbols from arm-none-eabi-nm --defined-only -S -l -C -p xxx.elf Launching GDB: arm-none-eabi-gdb -q --interpreter=mi2 1-gdb-version Error: arm-none-eabi-nm failed! statics/global/functions may not be properly classified: Error: spawn arm-none-eabi-nm ENOENT Expecting nm next to objdump. If that is not the problem please report this. Could not start GDB process, does the program exist in filesystem? Error: spawn arm-none-eabi-gdb ENOENT

haneefdm commented 2 years ago

You don't have the arm toolchain installed or have a setting to point to it. You can create a setting in your user settings (Use VSCode Settings...) or in your launch.json with armToolchainPath

Also, make sure you can run the arm gdb from the command line. Many times it is partially installed.

Please close this issue if satisfied.

haneefdm commented 2 years ago
image
XinyuKhan commented 2 years ago
image

Hi haneefdm Thank for you reply. I have tried the methond you mentioned above, but it still not worked. I set the path of the arm toolchains in the PATH env in my .zshrc and did not config the armToolchainPath in the vscode setting at beginning. It worked well, but this error occurred recently. After that I tried to add the toolchains path in the armToolchainPath config but the error was same.

haneefdm commented 2 years ago

Yes, setting in PATH works well. But macOS is tricky in which file you use to set that PATH. As you know, we did not change anything and I use macOS all the time. I don't have issues either way. My .zshrc contains this

export PATH="$PATH:/Applications/ARM/bin:/Applications/CMake.app/Contents/bin"

I need to see exactly what you changed in settings and what you see in the Debug Console./

haneefdm commented 2 years ago

Make sure you can launch alll thoss tools from the command-line. If you can't, neither can we.

haneefdm commented 2 years ago

Closing. No response