Skip to content

Commit

Permalink
Fix #62, OpenOCD missing adapter
Browse files Browse the repository at this point in the history
Signed-off-by: paulober <[email protected]>
  • Loading branch information
paulober committed Sep 6, 2024
1 parent ae8eda4 commit 24bd9cd
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 28 deletions.
10 changes: 6 additions & 4 deletions scripts/pico_project.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)",
Expand Down Expand Up @@ -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": {{
Expand Down Expand Up @@ -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": {{
Expand Down
26 changes: 3 additions & 23 deletions scripts/raspberrypi-swd.cfg
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion src/webview/newProjectPanel.mts
Original file line number Diff line number Diff line change
Expand Up @@ -1914,7 +1914,7 @@ export class NewProjectPanel {
</div>
<div class="flex items-center px-4 py-2 border border-gray-200 rounded dark:border-gray-700">
<input id="debugger-radio-swd" type="radio" value="1" name="debugger-radio" class="w-4 h-4 text-blue-600 bg-gray-100 border-gray-300 outline-none focus:ring-0 focus:ring-offset-5 dark:bg-gray-700 dark:border-gray-600">
<label for="debugger-radio-swd" class="w-full py-4 ml-2 text-sm font-medium text-gray-900 dark:text-gray-300">SWD (Pi host)</label>
<label for="debugger-radio-swd" class="w-full py-4 ml-2 text-sm font-medium text-gray-900 dark:text-gray-300">SWD (Pi host, on Pi 5 it requires Linux Kernel >= 6.6.47)</label>
</div>
</div>
</div>
Expand Down

0 comments on commit 24bd9cd

Please sign in to comment.