pyocd 0.36.0, VS Code and Zephyr
Open
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 1.5k
- Forks
- 560
- Avg merge
- 1h 41m
- Merged PRs (30d)
- 3
Description
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.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the VS Code launch configuration and the pyocd gdbserver --port 50000 --telnet-port 50001 entry point, then compare its environment with the working west debug invocation. Reproduce the spawn pyocd ENOENT failure and determine what is required for the VS Code launch to start the GDB server successfully.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python, vscode
- Domain
- devtools, embedded-iot
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100