fix: convert all TCL-embedded paths to forward slashes (cross-platform)
Windows backslashes in TCL strings are interpreted as escape sequences (\f → form feed, \t → tab). This caused 'dow "Files\fsbl..."' to fail with garbled paths — TCL couldn't find the file. Added _tcl_path() helper: replaces \ with / in any path before embedding in TCL. Forward slashes work on all platforms including Windows. Applied to all 7 path sites: source, fpga -file, dow.
This commit is contained in:
@@ -37,6 +37,15 @@ ProgressCallback = Callable[[str, str], None] | None
|
|||||||
# ── Helpers ─────────────────────────────────────────────────────────
|
# ── Helpers ─────────────────────────────────────────────────────────
|
||||||
|
|
||||||
|
|
||||||
|
def _tcl_path(path: str | Path) -> str:
|
||||||
|
"""Convert a filesystem path to TCL-safe format.
|
||||||
|
|
||||||
|
TCL interprets backslashes as escape sequences (\\f, \\t, \\n).
|
||||||
|
Forward slashes work on all platforms including Windows.
|
||||||
|
"""
|
||||||
|
return str(path).replace("\\", "/")
|
||||||
|
|
||||||
|
|
||||||
def _find_ps7_init_tcl(config: Config) -> str:
|
def _find_ps7_init_tcl(config: Config) -> str:
|
||||||
"""Find the ps7_init.tcl file for PS initialization.
|
"""Find the ps7_init.tcl file for PS initialization.
|
||||||
|
|
||||||
@@ -187,11 +196,11 @@ def _program_with_xsct(
|
|||||||
lines = ["connect"]
|
lines = ["connect"]
|
||||||
if ps7_init_tcl and Path(ps7_init_tcl).exists():
|
if ps7_init_tcl and Path(ps7_init_tcl).exists():
|
||||||
lines.append("targets 1")
|
lines.append("targets 1")
|
||||||
lines.append(f'source "{ps7_init_tcl}"')
|
lines.append(f'source "{_tcl_path(ps7_init_tcl)}"')
|
||||||
lines.append("ps7_init")
|
lines.append("ps7_init")
|
||||||
if callback:
|
if callback:
|
||||||
callback("progress", "PS initialized (clocks, DDR, MIO)")
|
callback("progress", "PS initialized (clocks, DDR, MIO)")
|
||||||
lines.append(f'fpga -file "{bit_path}"')
|
lines.append(f'fpga -file {{{_tcl_path(bit_path)}}}')
|
||||||
if ps7_init_tcl and Path(ps7_init_tcl).exists():
|
if ps7_init_tcl and Path(ps7_init_tcl).exists():
|
||||||
lines.append("ps7_post_config")
|
lines.append("ps7_post_config")
|
||||||
if callback:
|
if callback:
|
||||||
@@ -381,13 +390,13 @@ def _run_elf_via_fsbl(
|
|||||||
tcl = "\n".join([
|
tcl = "\n".join([
|
||||||
"connect",
|
"connect",
|
||||||
"targets 2",
|
"targets 2",
|
||||||
"dow \"%s\"" % fsbl_path,
|
"dow {%s}" % _tcl_path(fsbl_path),
|
||||||
"puts \"FSBL downloaded\"",
|
"puts \"FSBL downloaded\"",
|
||||||
"con",
|
"con",
|
||||||
"after 3000",
|
"after 3000",
|
||||||
"stop",
|
"stop",
|
||||||
"puts \"FSBL done, CPU halted\"",
|
"puts \"FSBL done, CPU halted\"",
|
||||||
"dow \"%s\"" % elf_path,
|
"dow {%s}" % _tcl_path(elf_path),
|
||||||
"mwr 0xF800025C 0x00000001",
|
"mwr 0xF800025C 0x00000001",
|
||||||
"con",
|
"con",
|
||||||
"puts \"App running\"",
|
"puts \"App running\"",
|
||||||
@@ -461,7 +470,7 @@ def _run_elf_direct(
|
|||||||
tcl = "\n".join([
|
tcl = "\n".join([
|
||||||
"connect",
|
"connect",
|
||||||
"targets 2",
|
"targets 2",
|
||||||
"dow \"%s\"" % elf_path,
|
"dow {%s}" % _tcl_path(elf_path),
|
||||||
"mwr 0xF800025C 0x00000001",
|
"mwr 0xF800025C 0x00000001",
|
||||||
"con",
|
"con",
|
||||||
"exit",
|
"exit",
|
||||||
@@ -620,18 +629,18 @@ def full_bitstream_program(
|
|||||||
"rst -processor",
|
"rst -processor",
|
||||||
"after 500",
|
"after 500",
|
||||||
'puts "INFO: Downloading FSBL..."',
|
'puts "INFO: Downloading FSBL..."',
|
||||||
'dow "%s"' % fsbl_path,
|
'dow {%s}' % _tcl_path(fsbl_path),
|
||||||
'puts "INFO: Running FSBL for hardware initialization..."',
|
'puts "INFO: Running FSBL for hardware initialization..."',
|
||||||
"con",
|
"con",
|
||||||
"after 2000",
|
"after 2000",
|
||||||
"stop",
|
"stop",
|
||||||
'puts "INFO: Hardware initialization completed."',
|
'puts "INFO: Hardware initialization completed."',
|
||||||
'puts "INFO: Downloading Bitstream..."',
|
'puts "INFO: Downloading Bitstream..."',
|
||||||
'fpga -f "%s"' % bit_path,
|
'fpga -f {%s}' % _tcl_path(bit_path),
|
||||||
"after 1000",
|
"after 1000",
|
||||||
'targets -set -nocase -filter {name =~ "arm*#0"}',
|
'targets -set -nocase -filter {name =~ "arm*#0"}',
|
||||||
'puts "INFO: Downloading Application ELF..."',
|
'puts "INFO: Downloading Application ELF..."',
|
||||||
'dow "%s"' % elf_path,
|
'dow {%s}' % _tcl_path(elf_path),
|
||||||
'puts "INFO: Executing Application..."',
|
'puts "INFO: Executing Application..."',
|
||||||
"con",
|
"con",
|
||||||
'puts "SUCCESS: Zynq target is running the specified application."',
|
'puts "SUCCESS: Zynq target is running the specified application."',
|
||||||
|
|||||||
Reference in New Issue
Block a user