Compare commits
2
Commits
17c8f2d68b
...
1619dc194f
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1619dc194f | ||
|
|
267cae93b6 |
+41
-3
@@ -1158,25 +1158,63 @@ class MainWindow(ctk.CTk):
|
|||||||
if uart_alive and _uart_src:
|
if uart_alive and _uart_src:
|
||||||
self._log_message(f" ⏳ Waiting for UART boot signal (max {boot_delay}s)...")
|
self._log_message(f" ⏳ Waiting for UART boot signal (max {boot_delay}s)...")
|
||||||
elapsed = 0.0
|
elapsed = 0.0
|
||||||
|
boot_seen = False # Phase 1 guard — log once, keep waiting for IP
|
||||||
while elapsed < boot_delay:
|
while elapsed < boot_delay:
|
||||||
info = _uart_src.latest_info if hasattr(_uart_src, 'latest_info') else _uart_src.get_latest_info()
|
info = (
|
||||||
if info and (info.ip_address or info.version):
|
_uart_src.latest_info
|
||||||
|
if hasattr(_uart_src, "latest_info")
|
||||||
|
else _uart_src.get_latest_info()
|
||||||
|
)
|
||||||
|
# Phase 2: IP address found — definitive boot confirmation
|
||||||
|
if info and info.ip_address:
|
||||||
self._log_message(
|
self._log_message(
|
||||||
f" ✓ Boot detected after {elapsed:.1f}s"
|
f" ✓ Boot detected after {elapsed:.1f}s"
|
||||||
f" (IP={info.ip_address}, Ver={info.version})"
|
f" (IP={info.ip_address}, Ver={info.version})"
|
||||||
)
|
)
|
||||||
discovered_ip = info.ip_address
|
discovered_ip = info.ip_address
|
||||||
break
|
break
|
||||||
|
# Phase 1: boot signal (version) seen but no IP yet — keep polling
|
||||||
|
if info and info.version and not boot_seen:
|
||||||
|
boot_seen = True
|
||||||
|
self._log_message(
|
||||||
|
f" ✓ Boot signal after {elapsed:.1f}s"
|
||||||
|
f" (Ver={info.version}), waiting for IP..."
|
||||||
|
)
|
||||||
time.sleep(0.5)
|
time.sleep(0.5)
|
||||||
elapsed += 0.5
|
elapsed += 0.5
|
||||||
else:
|
else:
|
||||||
self._log_message(f" ⏱ UART timeout — no boot signal in {boot_delay}s")
|
self._log_message(f" ⏱ UART timeout — no IP in {boot_delay}s")
|
||||||
|
# Final check: IP may have arrived after the last poll
|
||||||
|
info = (
|
||||||
|
_uart_src.latest_info
|
||||||
|
if hasattr(_uart_src, "latest_info")
|
||||||
|
else _uart_src.get_latest_info()
|
||||||
|
)
|
||||||
|
if info and info.ip_address:
|
||||||
|
self._log_message(f" IP recovered from latest UART info: {info.ip_address}")
|
||||||
|
discovered_ip = info.ip_address
|
||||||
else:
|
else:
|
||||||
self._log_message(f" ⏳ UART unavailable — sleeping {boot_delay}s for boot...")
|
self._log_message(f" ⏳ UART unavailable — sleeping {boot_delay}s for boot...")
|
||||||
time.sleep(boot_delay)
|
time.sleep(boot_delay)
|
||||||
|
|
||||||
|
# Fallback: parse IP from accumulated UART buffer (lines may arrive
|
||||||
|
# after boot wait loop exited — e.g. "Board IP: 192.168.100.13")
|
||||||
|
if not discovered_ip and _uart_src:
|
||||||
|
all_lines = (
|
||||||
|
_uart_src.all_lines
|
||||||
|
if hasattr(_uart_src, "all_lines")
|
||||||
|
else []
|
||||||
|
)
|
||||||
|
if all_lines:
|
||||||
|
parsed = parse_boot_output(all_lines)
|
||||||
|
if parsed.ip_address:
|
||||||
|
discovered_ip = parsed.ip_address
|
||||||
|
self._log_message(f" IP from UART buffer: {discovered_ip}")
|
||||||
|
|
||||||
# Discover actual IP after reboot (may have changed via DHCP)
|
# Discover actual IP after reboot (may have changed via DHCP)
|
||||||
if not discovered_ip:
|
if not discovered_ip:
|
||||||
|
self._log_message(" ⏳ Network stack — waiting 3s...")
|
||||||
|
time.sleep(3)
|
||||||
self._log_message(" Scanning for Zynq IP (192.168.100.11–30)...")
|
self._log_message(" Scanning for Zynq IP (192.168.100.11–30)...")
|
||||||
discovered_ip = self._discover_zynq_ip()
|
discovered_ip = self._discover_zynq_ip()
|
||||||
if discovered_ip:
|
if discovered_ip:
|
||||||
|
|||||||
+2
-2
@@ -11,6 +11,7 @@ from __future__ import annotations
|
|||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
import subprocess
|
import subprocess
|
||||||
|
import tempfile
|
||||||
from dataclasses import dataclass, field
|
from dataclasses import dataclass, field
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from typing import Callable
|
from typing import Callable
|
||||||
@@ -88,7 +89,6 @@ def check_zynq_jtag(config: Config, callback: Callable | None = None) -> ZynqChe
|
|||||||
|
|
||||||
# Find vivado executable via Xilinx root scan
|
# Find vivado executable via Xilinx root scan
|
||||||
vivado_path = get_vivado_path(
|
vivado_path = get_vivado_path(
|
||||||
vitis_path=getattr(config, "vitis_path", ""),
|
|
||||||
xilinx_root=getattr(config, "xilinx_path", ""),
|
xilinx_root=getattr(config, "xilinx_path", ""),
|
||||||
)
|
)
|
||||||
if not vivado_path:
|
if not vivado_path:
|
||||||
@@ -104,7 +104,7 @@ def check_zynq_jtag(config: Config, callback: Callable | None = None) -> ZynqChe
|
|||||||
|
|
||||||
# Create temporary TCL script
|
# Create temporary TCL script
|
||||||
tcl_content = _build_jtag_query_tcl()
|
tcl_content = _build_jtag_query_tcl()
|
||||||
tcl_path = Path("/tmp/zynq_jtag_check_{}.tcl".format(os.getpid()))
|
tcl_path = Path(tempfile.gettempdir()) / f"zynq_jtag_check_{os.getpid()}.tcl"
|
||||||
try:
|
try:
|
||||||
tcl_path.write_text(tcl_content)
|
tcl_path.write_text(tcl_content)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user