Skip to content

Commit

Permalink
Merge pull request #72 from raspberrypi/fix-openocd-missing-adapter
Browse files Browse the repository at this point in the history
Fix #62, OpenOCD missing adapter
  • Loading branch information
paulober authored Sep 9, 2024
2 parents 4660d06 + 0370b64 commit 52038c1
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 33 deletions.
6 changes: 6 additions & 0 deletions data/0.16.0/supportedToolchains.ini
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,12 @@ darwin_arm64 = https://armkeil.blob.core.windows.net/developer/Files/downloads/g
darwin_x64 = https://armkeil.blob.core.windows.net/developer/Files/downloads/gnu/13.2.rel1/binrel/arm-gnu-toolchain-13.2.rel1-darwin-x86_64-arm-none-eabi.tar.xz
linux_x64 = https://armkeil.blob.core.windows.net/developer/Files/downloads/gnu/13.2.rel1/binrel/arm-gnu-toolchain-13.2.rel1-x86_64-arm-none-eabi.tar.xz
linux_arm64 = https://armkeil.blob.core.windows.net/developer/Files/downloads/gnu/13.2.rel1/binrel/arm-gnu-toolchain-13.2.rel1-aarch64-arm-none-eabi.tar.xz
[RISCV_RPI_2_0_0_2]
win32_x64 = https://github.com/raspberrypi/pico-sdk-tools/releases/download/v2.0.0-2/riscv-toolchain-14-x64-win.zip
darwin_arm64 = https://github.com/raspberrypi/pico-sdk-tools/releases/download/v2.0.0-2/riscv-toolchain-14-arm64-mac.zip
darwin_x64 = https://github.com/raspberrypi/pico-sdk-tools/releases/download/v2.0.0-2/riscv-toolchain-14-x64-mac.zip
linux_x64 = https://github.com/raspberrypi/pico-sdk-tools/releases/download/v2.0.0-2/riscv-toolchain-14-x86_64-lin.tar.gz
linux_arm64 = https://github.com/raspberrypi/pico-sdk-tools/releases/download/v2.0.0-2/riscv-toolchain-14-aarch64-lin.tar.gz
[RISCV_RPI_2_0_0_1]
win32_x64 = https://github.com/raspberrypi/pico-sdk-tools/releases/download/v2.0.0-1/riscv-toolchain-14-x64-win.zip
darwin_arm64 = https://github.com/raspberrypi/pico-sdk-tools/releases/download/v2.0.0-1/riscv-toolchain-14-arm64-mac.zip
Expand Down
2 changes: 1 addition & 1 deletion data/0.16.0/versionBundles.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,6 @@
"cmake": "v3.28.6",
"picotool": "2.0.0",
"toolchain": "13_2_Rel1",
"riscvToolchain": "RISCV_RPI_2_0_0_1"
"riscvToolchain": "RISCV_RPI_2_0_0_2"
}
}
2 changes: 1 addition & 1 deletion scripts/genCache.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
["1.5.1", "2.0.0"],
["v3.28.6", "v3.29.6"],
["v1.12.1"],
["v1.5.1-0", "v2.0.0-0"],
["v1.5.1-0", "v2.0.0-0", "v2.0.0-1", "v2.0.0-2"],
["2.0.0"]
]

Expand Down
10 changes: 6 additions & 4 deletions scripts/pico_project.py
Original file line number Diff line number Diff line change
Expand Up @@ -762,8 +762,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 @@ -807,10 +809,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 @@ -840,7 +842,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 @@ -1020,7 +1022,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
6 changes: 3 additions & 3 deletions src/utils/download.mts
Original file line number Diff line number Diff line change
Expand Up @@ -61,19 +61,19 @@ const TOOLS_RELEASES: { [key: string]: string } = {
// eslint-disable-next-line @typescript-eslint/naming-convention
"1.5.1": "v1.5.1-0",
// eslint-disable-next-line @typescript-eslint/naming-convention
"2.0.0": "v2.0.0-0",
"2.0.0": "v2.0.0-3",
};

/// Release tags for picotool
const PICOTOOL_RELEASES: { [key: string]: string } = {
// eslint-disable-next-line @typescript-eslint/naming-convention
"2.0.0": "v2.0.0-0",
"2.0.0": "v2.0.0-3",
};

/// Release tags for openocd
const OPENOCD_RELEASES: { [key: string]: string } = {
// eslint-disable-next-line @typescript-eslint/naming-convention
"0.12.0+dev": "v2.0.0-0",
"0.12.0+dev": "v2.0.0-3",
};

/// Translate nodejs platform names to cmake platform names
Expand Down
2 changes: 1 addition & 1 deletion src/webview/newProjectPanel.mts
Original file line number Diff line number Diff line change
Expand Up @@ -1964,7 +1964,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 52038c1

Please sign in to comment.