fix: FirmWare version parsing + prevent boot-from-Flash in ELF step

Issue 1 — FirmWare version not parsed:
  Input: [Info] FirmWare:V1.2.1.2.1_11_07_pmu_log3
  Fix:  regex [Ff]irm[Ww]are:?\s*  (was [Ff]irmware\s+ — no : or camelCase)
        Plus broader version capture: [Vv]\d+\.\d+\.\d+[^\s;,\n]*

Issue 2 — ELF loaded from Flash instead of downloaded ELF:
  Root cause: Zynq devcfg.CTRL (0xF800025C) PCAP_PROG_B may trigger
  reconfiguration from Flash after fpga, causing CPU to jump to
  Flash-loaded code instead of our dow'd ELF.

  BIT step: add ps7_post_config after fpga (finalizes PL-PS interfaces)
             add mwr 0xF800025C 0x1 (disables PCAP reconfig)
  ELF step: add mwr 0xF800025C 0x1 after dow, before con
             (both attempt-1 and attempt-2 fallback)
This commit is contained in:
Jeremy Shen
2026-06-10 15:50:31 +08:00
parent 09be20791f
commit 8b2fac931c
2 changed files with 11 additions and 3 deletions
+9 -1
View File
@@ -214,7 +214,7 @@ def _program_with_xsct(
if callback: if callback:
callback("progress", "Initializing PS then programming FPGA...") callback("progress", "Initializing PS then programming FPGA...")
# Build TCL: PS init first, then FPGA config # Build TCL: PS init first, then FPGA config, then post-config
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")
@@ -223,6 +223,12 @@ def _program_with_xsct(
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 "{bit_path}"')
if ps7_init_tcl and Path(ps7_init_tcl).exists():
lines.append("ps7_post_config")
if callback:
callback("progress", "PS post-config (PL-PS interfaces)")
# Prevent boot from Flash by disabling PCAP reconfiguration
lines.append("mwr 0xF800025C 0x00000001")
lines.append("exit") lines.append("exit")
tcl_script = "\n".join(lines) tcl_script = "\n".join(lines)
@@ -422,6 +428,7 @@ def _run_elf_with_xsct(
"connect", "connect",
"targets 2", "targets 2",
"dow \"%s\"" % elf_path, "dow \"%s\"" % elf_path,
"mwr 0xF800025C 0x00000001",
"con", "con",
"exit", "exit",
]) ])
@@ -459,6 +466,7 @@ def _run_elf_with_xsct(
"ps7_init", "ps7_init",
"targets 2", "targets 2",
"dow \"%s\"" % elf_path, "dow \"%s\"" % elf_path,
"mwr 0xF800025C 0x00000001",
"con", "con",
"exit", "exit",
]) ])
+2 -2
View File
@@ -74,8 +74,8 @@ def parse_boot_output(lines: list[str]) -> BootInfo:
version_patterns = [ version_patterns = [
re.compile(r"[Vv]ersion[:\s]+([^\s;,\n]+)", re.IGNORECASE), re.compile(r"[Vv]ersion[:\s]+([^\s;,\n]+)", re.IGNORECASE),
re.compile(r"[Bb]oot\s+([^\s;,\n]+)", re.IGNORECASE), re.compile(r"[Bb]oot\s+([^\s;,\n]+)", re.IGNORECASE),
re.compile(r"[Ff]irmware\s+([^\s;,\n]+)", re.IGNORECASE), re.compile(r"[Ff]irm[Ww]are:?\s*([^\s;,\n]+)", re.IGNORECASE),
re.compile(r"(?:^|[\s:=])(v\d+\.\d+\.\d+)(?:\s|$)", re.IGNORECASE), re.compile(r"(?:^|[\s:=])([Vv]\d+\.\d+\.\d+[^\s;,\n]*)", re.IGNORECASE),
] ]
boot_complete_patterns = [ boot_complete_patterns = [
re.compile(r"boot\s+complete", re.IGNORECASE), re.compile(r"boot\s+complete", re.IGNORECASE),