diff --git a/.gitignore b/.gitignore index d0c6559..e68a0f5 100644 --- a/.gitignore +++ b/.gitignore @@ -11,6 +11,7 @@ target/ !.vscode/launch.json !.vscode/tasks.json !.vscode/extensions.json +!.vscode/openocd-helpers.tcl #temporary files .DS_Store diff --git a/.vscode/launch.json b/.vscode/launch.json index 6f75763..24c7922 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -14,12 +14,13 @@ "servertype": "openocd", "cwd": "${workspaceRoot}", "preLaunchTask": "cargo build --examples", - "runToMain": true, + "runToEntryPoint": "true", "executable": "./target/thumbv7em-none-eabihf/debug/examples/${fileBasenameNoExtension}", "preLaunchCommands": ["break rust_begin_unwind"], "device": "STM32F303VCT6", "configFiles": [ - "interface/stlink-v2-1.cfg", + "${workspaceRoot}/.vscode/openocd-helpers.tcl", + "interface/stlink.cfg", "target/stm32f3x.cfg" ], "svdFile": "${env:HOME}/.svd/STM32F303.svd", diff --git a/.vscode/openocd-helpers.tcl b/.vscode/openocd-helpers.tcl new file mode 100644 index 0000000..4da6f7e --- /dev/null +++ b/.vscode/openocd-helpers.tcl @@ -0,0 +1,17 @@ +# +# Cortex-Debug extension calls this function during initialization. You can copy this +# file, modify it and specifyy it as one of the config files supplied in launch.json +# preferably at the beginning. +# +# Note that this file simply defines a function for use later when it is time to configure +# for SWO. +# +set USE_SWO 0 +proc CDSWOConfigure { CDCPUFreqHz CDSWOFreqHz CDSWOOutput } { + # Alternative option: Pipe ITM output into itm.txt file + # tpiu config internal itm.txt uart off $CDCPUFreqHz + + # Default option so SWO display of VS code works. + tpiu config internal $CDSWOOutput uart off $CDCPUFreqHz $CDSWOFreqHz + itm port 0 on +}