From fc8b3f0737608cffef602e27035a61cf8fcae579 Mon Sep 17 00:00:00 2001 From: William Vinnicombe Date: Tue, 26 Mar 2024 18:34:12 +0000 Subject: [PATCH] Add support for raspberrypi-swd debugging with upstream openocd --- scripts/pico_project.py | 8 ++++++-- scripts/raspberrypi-swd.cfg | 6 ++++++ 2 files changed, 12 insertions(+), 2 deletions(-) create mode 100644 scripts/raspberrypi-swd.cfg diff --git a/scripts/pico_project.py b/scripts/pico_project.py index 9eb29f6..2ffcc08 100644 --- a/scripts/pico_project.py +++ b/scripts/pico_project.py @@ -72,7 +72,7 @@ } debugger_list = ["DebugProbe (CMSIS-DAP)", "SWD (Pi host)"] -debugger_config_list = ["cmsis-dap.cfg", "raspberrypi-swd.cfg"] +debugger_config_list = ["interface/cmsis-dap.cfg", "raspberrypi-swd.cfg"] DEFINES = 0 INITIALISERS = 1 @@ -731,6 +731,10 @@ def generateProjectFiles(projectPath, projectName, sdkPath, projects, debugger, os.chdir(projectPath) debugger = debugger_config_list[debugger] + + if debugger == "raspberrypi-swd.cfg": + shutil.copyfile(sourcefolder + "/" + "raspberrypi-swd.cfg", projectPath / "raspberrypi-swd.cfg") + gdbPath = Path(codeToolchainPath(toolchainVersion)+"/bin/arm-none-eabi-gdb").as_posix() if isWindows else "gdb-multiarch" if isMac else "gdb" # Need to escape windows files paths backslashes # TODO: env in currently not supported in compilerPath var @@ -761,7 +765,7 @@ def generateProjectFiles(projectPath, projectName, sdkPath, projects, debugger, "gdbPath": "{gdbPath}", "device": "RP2040", "configFiles": [ - "interface/{debugger}", + "{debugger}", "target/rp2040.cfg" ], "svdFile": "{codeSdkPath(sdkVersion)}/src/rp2040/hardware_regs/rp2040.svd", diff --git a/scripts/raspberrypi-swd.cfg b/scripts/raspberrypi-swd.cfg new file mode 100644 index 0000000..bcd0c1e --- /dev/null +++ b/scripts/raspberrypi-swd.cfg @@ -0,0 +1,6 @@ +source [find interface/raspberrypi-native.cfg] + +adapter gpio swdio -chip 0 24 +adapter gpio swclk -chip 0 25 + +adapter speed 5000