From 24bd9cd4cda958a96ef6142f8ad4e386424f83ce Mon Sep 17 00:00:00 2001 From: paulober <44974737+paulober@users.noreply.github.com> Date: Fri, 6 Sep 2024 19:44:41 +0100 Subject: [PATCH] Fix #62, OpenOCD missing adapter Signed-off-by: paulober <44974737+paulober@users.noreply.github.com> --- scripts/pico_project.py | 10 ++++++---- scripts/raspberrypi-swd.cfg | 26 +++----------------------- src/webview/newProjectPanel.mts | 2 +- 3 files changed, 10 insertions(+), 28 deletions(-) diff --git a/scripts/pico_project.py b/scripts/pico_project.py index fb96f657..6d5ad765 100644 --- a/scripts/pico_project.py +++ b/scripts/pico_project.py @@ -759,8 +759,10 @@ def generateProjectFiles(projectPath, projectName, sdkPath, projects, debugger, file.close() debugger = debugger_config_list[debugger] + debugger_supports_configurable_speed = True if debugger == "raspberrypi-swd.cfg": + debugger_supports_configurable_speed = False shutil.copyfile(sourcefolder + "/" + "raspberrypi-swd.cfg", projectPath / "raspberrypi-swd.cfg") # Need to escape windows files paths backslashes @@ -804,10 +806,10 @@ def generateProjectFiles(projectPath, projectName, sdkPath, projects, debugger, "overrideLaunchCommands": [ "monitor reset init", "load \\"${{command:raspberry-pi-pico.launchTargetPath}}\\"" - ], + ]{''', "openOCDLaunchCommands": [ "adapter speed 5000" - ] + ]''' if debugger_supports_configurable_speed else ""} }}, {{ "name": "Pico Debug (Cortex-Debug with external OpenOCD)", @@ -837,7 +839,7 @@ def generateProjectFiles(projectPath, projectName, sdkPath, projects, debugger, "miDebuggerPath": "${{command:raspberry-pi-pico.getGDBPath}}", "miDebuggerServerAddress": "localhost:3333", "debugServerPath": "{openocd_path if openocd_path else "openocd"}", - "debugServerArgs": "-f {debugger} -f target/${{command:raspberry-pi-pico.getTarget}}.cfg -c \\"adapter speed 5000\\"", + "debugServerArgs": "-f {debugger} -f target/${{command:raspberry-pi-pico.getTarget}}.cfg{' -c \\"adapter speed 5000\\"' if debugger_supports_configurable_speed else ""}", "serverStarted": "Listening on port .* for gdb connections", "filterStderr": true, "hardwareBreakpoints": {{ @@ -1017,7 +1019,7 @@ def generateProjectFiles(projectPath, projectName, sdkPath, projects, debugger, "-f", "target/${{command:raspberry-pi-pico.getTarget}}.cfg", "-c", - "adapter speed 5000; program \\"${{command:raspberry-pi-pico.launchTargetPath}}\\" verify reset exit" + "{"adapter speed 5000; " if debugger_supports_configurable_speed else ""}program \\"${{command:raspberry-pi-pico.launchTargetPath}}\\" verify reset exit" ], "problemMatcher": [], "windows": {{ diff --git a/scripts/raspberrypi-swd.cfg b/scripts/raspberrypi-swd.cfg index 88d49d12..e8705e1e 100644 --- a/scripts/raspberrypi-swd.cfg +++ b/scripts/raspberrypi-swd.cfg @@ -1,24 +1,4 @@ -proc read_file { name } { - if {[catch {open $name r} fd]} { - return "" - } - set result [read $fd] - close $fd - return $result -} +adapter driver linuxgpiod -set compat [read_file /proc/device-tree/compatible] - -if {[string match *bcm2712* $compat]} { - adapter driver linuxgpiod - - adapter gpio swdio -chip 4 24 - adapter gpio swclk -chip 4 25 -} else { - source [find interface/raspberrypi-native.cfg] - - adapter gpio swdio -chip 0 24 - adapter gpio swclk -chip 0 25 - - adapter speed 5000 -} +adapter gpio swdio -chip 0 24 +adapter gpio swclk -chip 0 25 diff --git a/src/webview/newProjectPanel.mts b/src/webview/newProjectPanel.mts index fe0838b9..d765444d 100644 --- a/src/webview/newProjectPanel.mts +++ b/src/webview/newProjectPanel.mts @@ -1914,7 +1914,7 @@ export class NewProjectPanel {