Add OpenOCD debugging config for SWO output in VS Code.

build_system
Rob Riggs 2024-08-23 16:30:19 -07:00
rodzic 69280dd5b1
commit e8af45a59b
3 zmienionych plików z 102 dodań i 5 usunięć

83
.vscode/launch.json vendored
Wyświetl plik

@ -31,6 +31,89 @@
/* If you use external loader, add additional arguments */
//"serverArgs": ["--extload", "path/to/ext/loader.stldr"],
},
{
"name": "Build & Debug Microcontroller - OpenOCD",
"cwd": "${workspaceFolder}",
"type": "cortex-debug",
"executable": "${command:cmake.launchTargetPath}",
// Let CMake extension decide executable: "${command:cmake.launchTargetPath}"
// Or fixed file path: "${workspaceFolder}/path/to/filename.elf"
"request": "launch",
"servertype": "openocd",
"configFiles": [
"${workspaceFolder}/stlink-tnc3.cfg"
],
"device": "STM32L433CCUx", //MCU used
"interface": "swd",
"serialNumber": "", //Set ST-Link ID if you use multiple at the same time
"runToEntryPoint": "main",
"svdFile": "${config:STM32VSCodeExtension.cubeCLT.path}/STMicroelectronics_CMSIS_SVD/STM32L4P5.svd",
"v1": false, //Change it depending on ST Link version
"serverpath": "/usr/bin/openocd",
"stm32cubeprogrammer":"${config:STM32VSCodeExtension.cubeCLT.path}/STM32CubeProgrammer/bin",
"stlinkPath": "${config:STM32VSCodeExtension.cubeCLT.path}/STLink-gdb-server/bin/ST-LINK_gdbserver",
"armToolchainPath": "${config:STM32VSCodeExtension.cubeCLT.path}/GNU-tools-for-STM32/bin",
"gdbPath":"${config:STM32VSCodeExtension.cubeCLT.path}/GNU-tools-for-STM32/bin/arm-none-eabi-gdb",
"swoConfig": {
"enabled": true,
"cpuFrequency": 16000000,
"swoFrequency": 2000000,
"source": "probe",
"decoders": [
{
"type": "console",
"label": "ITM",
"showOnStartup": true,
"port": 0,
"encoding": "ascii"
}
]
},
"preLaunchTask": "Build project"
/* If you use external loader, add additional arguments */
//"serverArgs": ["--extload", "path/to/ext/loader.stldr"],
},
{
"name": "Attach to MCU OpenOCD",
"cwd": "${workspaceFolder}",
"type": "cortex-debug",
"executable": "${command:cmake.launchTargetPath}",
// Let CMake extension decide executable: "${command:cmake.launchTargetPath}"
// Or fixed file path: "${workspaceFolder}/path/to/filename.elf"
"request": "attach",
"servertype": "openocd",
"configFiles": [
"${workspaceFolder}/stlink-tnc4.cfg"
],
"device": "STM32L4P5RETx", //MCU used
"interface": "swd",
"serialNumber": "", //Set ST-Link ID if you use multiple at the same time
"runToEntryPoint": "main",
"svdFile": "${config:STM32VSCodeExtension.cubeCLT.path}/STMicroelectronics_CMSIS_SVD/STM32L4P5.svd",
"v1": false, //Change it depending on ST Link version
"serverpath": "/usr/bin/openocd",
"stm32cubeprogrammer":"${config:STM32VSCodeExtension.cubeCLT.path}/STM32CubeProgrammer/bin",
"stlinkPath": "${config:STM32VSCodeExtension.cubeCLT.path}/STLink-gdb-server/bin/ST-LINK_gdbserver",
"armToolchainPath": "${config:STM32VSCodeExtension.cubeCLT.path}/GNU-tools-for-STM32/bin",
"gdbPath":"${config:STM32VSCodeExtension.cubeCLT.path}/GNU-tools-for-STM32/bin/arm-none-eabi-gdb",
"swoConfig": {
"enabled": true,
"cpuFrequency": 16000000,
"swoFrequency": 2000000,
"source": "probe",
"decoders": [
{
"type": "console",
"label": "ITM",
"showOnStartup": true,
"port": 0,
"encoding": "ascii"
}
]
}
/* If you use external loader, add additional arguments */
//"serverArgs": ["--extload", "path/to/ext/loader.stldr"],
},
{
"name": "Attach to Microcontroller - ST-Link",
"cwd": "${workspaceFolder}",

14
.vscode/tasks.json vendored
Wyświetl plik

@ -36,6 +36,20 @@
"CubeProg: Flash project (SWD)",
]
},
{
"type": "cppbuild",
"label": "Build project",
"command": "cmake",
"args": ["--build", "${command:cmake.buildDirectory}", "-j", "16"],
"options": {
"cwd": "${workspaceFolder}"
},
"problemMatcher": ["$gcc"],
"group": {
"kind": "build",
"isDefault": true
}
},
{
"type": "cmake",
"label": "CMake: clean rebuild",

Wyświetl plik

@ -1,12 +1,12 @@
# This is an TNC3 with a STM32L433CCU6 chip.
source [find interface/stlink-v2-1.cfg]
source [find interface/stlink.cfg]
transport select hla_swd
set WORKAREASIZE 0x4000
source [find target/stm32l4x.cfg]
reset_config srst_only
itm port 0 on
tpiu config internal swv uart off 72000000
reset_config srst_only srst_nogate
# itm port 0 on
# tpiu config internal swv uart off 72000000