cancel
Showing results for 
Search instead for 
Did you mean: 

How to use PyOCD and DAPLink with vscode

GL1
Associate

 

To make life a little easier for those who use vscode with PyOCD and DAPLink.

There are two files that should be placed inside .vscode folder.

 

// tasks.json
{
    "version": "2.0.0",
    "tasks": [
        {
            "label": "PyOCD Flash",
            "type": "shell",
            "command": "pyocd load -t STM32G030F6Px ${workspaceFolder}/build/Debug/blink.elf",
            "presentation": {"echo": true, "reveal": "always", "focus": false, "panel": "shared", "showReuseMessage": false, "clear": true},
        },
        {
            "label": "STLINK Flash",
            "type": "shell",
            "command": "STM32_Programmer_CLI.exe  -c port=SWD freq=4000 mode=normal -w ${workspaceFolder}/build/Debug/blink.elf -v -g",
            "presentation": {"echo": true, "reveal": "always", "focus": false, "panel": "shared", "showReuseMessage": false, "clear": true},
        },
        {
            "label": "CMAKE clean",
            "type": "shell",
            "command": "C:/STM32CubeCLT_1.16.0/CMake/bin/cmake.exe --build ${workspaceFolder}/build/Debug --target clean --",
            "presentation": {"echo": true, "reveal": "always", "focus": false, "panel": "shared", "showReuseMessage": false, "clear": true},
        }
    ]
}

 

// launch.json
{
    // Use IntelliSense to learn about possible attributes.
    // Hover to view descriptions of existing attributes.
    // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0",
    "configurations": [
        {
            "name": "PyOCD Debug",
            "svdFile": "STM32G030.svd",
            "svdPath": "C:\\STM32CubeCLT_1.16.0\\STMicroelectronics_CMSIS_SVD",
            "cwd": "${workspaceFolder}",
            "executable": "build\\Debug\\blink.elf",
            "request": "launch",
            "showDevDebugOutput": "none",
            "type": "cortex-debug",
            "runToEntryPoint": "main",
            "servertype": "pyocd",
            "interface": "swd",
            "targetId": "STM32G030F6Px",
            "device": "STM32G030F6P6"
        }
    ]
}

 

 

1 REPLY 1
Nawres GHARBI
ST Employee

Hi @GL1 

Thanks for you sharing