flash.ps1/debug-server.ps1: Windows fixes (tested)

- debug-server.ps1: look up the core target by name ([lindex [target names] 0])
  instead of hard-coding rp2350.dap.core0, which differs across OpenOCD builds.
- flash.ps1: resolve the .bin to an absolute, forward-slash, braced path so
  OpenOCD's Tcl parser does not eat the backslash in \build\...

Tested on Windows.
This commit is contained in:
Kevin Thomas committed 2026-10-04 10:58:37 -04:00
1 parent 1748603ea5
commit 16ece6a119
2 files changed
+8 -2

No files matched your search

+3 -1
View File
@@ -258,7 +258,9 @@ $ocdArgs = @(
# The result is that Step Into / Step Over in Binary Ninja does nothing: the # The result is that Step Into / Step Over in Binary Ninja does nothing: the
# PC never moves. Clearing the RTOS removes the mismatch so the step is real. # PC never moves. Clearing the RTOS removes the mismatch so the step is real.
# Harmless for single-core use, which is all this lab does (USE_CORE=0). # Harmless for single-core use, which is all this lab does (USE_CORE=0).
"-c", "rp2350.dap.core0 configure -rtos none", # The core's name differs between OpenOCD builds (rp2350.dap.core0 vs rp2350.cm0
# in the Pico SDK's Windows build), so look it up instead of hard-coding it.
"-c", "[lindex [target names] 0] configure -rtos none",
"-c", "adapter speed $SPEED", "-c", "adapter speed $SPEED",
"-c", "gdb_memory_map disable", "-c", "gdb_memory_map disable",
"-c", "gdb_breakpoint_override hard", "-c", "gdb_breakpoint_override hard",
+5 -1
View File
@@ -118,11 +118,15 @@ $SPEED = if ($env:ADAPTER_SPEED) { $env:ADAPTER_SPEED } else { "5000" }
# ADAPTER_SPEED in .ENVIRONMENT. # ADAPTER_SPEED in .ENVIRONMENT.
Write-Host "Flashing $Bin -> 0x10000000 using $OCD\openocd.exe (SWD $SPEED kHz)" Write-Host "Flashing $Bin -> 0x10000000 using $OCD\openocd.exe (SWD $SPEED kHz)"
# OpenOCD parses -c strings as Tcl, which eats backslashes ("\build" -> backspace+"uild").
# Hand it an absolute path with forward slashes, braced so spaces survive.
$BinTcl = (Resolve-Path $Bin).Path -replace '\\', '/'
& "$OCD\openocd.exe" ` & "$OCD\openocd.exe" `
-s "$OCD\scripts" ` -s "$OCD\scripts" `
-f interface/cmsis-dap.cfg ` -f interface/cmsis-dap.cfg `
-f target/rp2350.cfg ` -f target/rp2350.cfg `
-c "adapter speed $SPEED" ` -c "adapter speed $SPEED" `
-c "program $Bin 0x10000000 verify reset exit" -c "program {$BinTcl} 0x10000000 verify reset exit"
exit $LASTEXITCODE exit $LASTEXITCODE