Skip to content

Commit

Permalink
Add support for raspberrypi-swd debugging with upstream openocd
Browse files Browse the repository at this point in the history
  • Loading branch information
will-v-pi committed Mar 26, 2024
1 parent dcb3449 commit fc8b3f0
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
8 changes: 6 additions & 2 deletions scripts/pico_project.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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",
Expand Down
6 changes: 6 additions & 0 deletions scripts/raspberrypi-swd.cfg
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit fc8b3f0

Please sign in to comment.