Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pyocd 0.36.0, VS Code and Zephyr #1706

Open
rtborg opened this issue Jul 7, 2024 · 1 comment
Open

pyocd 0.36.0, VS Code and Zephyr #1706

rtborg opened this issue Jul 7, 2024 · 1 comment

Comments

@rtborg
Copy link

rtborg commented Jul 7, 2024

I'm using pyocd 0.36.0 and STM32F303K8Tx. My VS Code launch configuration is:

{
	"name": "Launch Nucleo F303K8",
	"device": "STM32F303K8Tx",
	"cwd": "${workspaceFolder}",
	"executable": "build/zephyr/zephyr.elf",
	"request": "launch",
	"type": "cortex-debug",
	"runToEntryPoint": "main",
	"servertype": "pyocd",
	"gdbPath": "${userHome}/zephyr-sdk-0.16.5-1/arm-zephyr-eabi/bin/arm-zephyr-eabi-gdb",
	"preLaunchTask": "West Build",
	"showDevDebugOutput": "both"
}

The output I get when launching is below:

"configuration": {
    "name": "Launch Nucleo F303K8",
    "device": "STM32F303K8Tx",
    "cwd": "/home/void/Documents/projects/zephyr/mimxrt1060_projects/app",
    "executable": "/home/void/Documents/projects/zephyr/mimxrt1060_projects/app/build/zephyr/zephyr.elf",
    "request": "launch",
    "type": "cortex-debug",
    "runToEntryPoint": "main",
    "servertype": "pyocd",
    "gdbPath": "/home/void/zephyr-sdk-0.16.5-1/arm-zephyr-eabi/bin/arm-zephyr-eabi-gdb",
    "preLaunchTask": "West Build",
    "showDevDebugOutput": "both",
    "__configurationTarget": 5,
    "gdbServerConsolePort": 60000,
    "pvtAvoidPorts": [],
    "chainedConfigurations": {
        "enabled": false
    },
    "debuggerArgs": [],
    "swoConfig": {
        "enabled": false,
        "decoders": [],
        "cpuFrequency": 0,
        "swoFrequency": 0,
        "source": "probe"
    },
    "rttConfig": {
        "enabled": false,
        "decoders": []
    },
    "graphConfig": [],
    "preLaunchCommands": [],
    "postLaunchCommands": [],
    "preAttachCommands": [],
    "postAttachCommands": [],
    "preRestartCommands": [],
    "postRestartCommands": [],
    "preResetCommands": [],
    "postResetCommands": [],
    "toolchainPrefix": "arm-none-eabi",
    "extensionPath": "/home/void/.vscode/extensions/marus25.cortex-debug-1.12.1",
    "registerUseNaturalFormat": true,
    "variableUseNaturalFormat": true,
    "pvtVersion": "1.12.1",
    "__sessionId": "92fd644d-1ce3-4385-a456-128c973442cc",
    "pvtShowDevDebugOutput": "both"
}
Reading symbols from /home/void/zephyr-sdk-0.16.5-1/arm-zephyr-eabi/bin/arm-zephyr-eabi-objdump --syms -C -h -w /home/void/Documents/projects/zephyr/mimxrt1060_projects/app/build/zephyr/zephyr.elf
Reading symbols from /home/void/zephyr-sdk-0.16.5-1/arm-zephyr-eabi/bin/arm-zephyr-eabi-nm --defined-only -S -l -C -p /home/void/Documents/projects/zephyr/mimxrt1060_projects/app/build/zephyr/zephyr.elf
Launching GDB: /home/void/zephyr-sdk-0.16.5-1/arm-zephyr-eabi/bin/arm-zephyr-eabi-gdb -q --interpreter=mi2
1-gdb-version
Launching gdb-server: pyocd gdbserver --port 50000 --telnet-port 50001
    Please check TERMINAL tab (gdb-server) for output from pyocd
Finished reading symbols from objdump: Time: 16 ms
Failed to launch PyOCD GDB Server: Error: spawn pyocd ENOENT

And the terminal tab output:

[2024-07-07T16:45:37.815Z] SERVER CONSOLE DEBUG: onBackendConnect: gdb-server session connected. You can switch to "DEBUG CONSOLE" to see GDB interactions.
pyocd gdbserver --port 50000 --telnet-port 50001
[2024-07-07T16:45:39.945Z] SERVER CONSOLE DEBUG: onBackendConnect: gdb-server session closed
GDB server session ended. This terminal will be reused, waiting for next session to start...

When running west debug, everything seems to work fine, but I want to get debugging working from VS code.

@hagibr
Copy link

hagibr commented Jul 29, 2024

I think you need to specify the target. Add these lines to launch.json:

      "serverArgs": [
        "-t", "STM32F303K8Tx"
      ],

I'm assuming that you've already have the cmsis pack installed. If not, also install it by executing pyocd pack install STM32F303K8Tx

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants