refactor(gui,config): rename file path fields and split BIN selector

- Rename bit_path -> bootloader_bit_path for clarity
- Rename elf_path -> bootloader_elf_path for clarity
- Split single bin_path into bootloader_bin_path (flash) and
  firmware_bin_path (TFTP upload)
- Reorder Configuration panel: BIT -> ELF -> Bootloader BIN ->
  Firmware BIN
- Update display names with file extensions and context labels
- Update all step references (Step 2 flash, Step 3 bootloader,
  Step 4 TFTP) to use new field names
This commit is contained in:
Jeremy Shen
2026-06-09 16:58:45 +08:00
parent bd39023ba7
commit 5277c88e3d
3 changed files with 72 additions and 50 deletions
+50 -38
View File
@@ -325,38 +325,49 @@ class MainWindow(ctk.CTk):
self._ip_entry = ctk.CTkEntry(ip_frame, textvariable=ctk.StringVar(value=self._config.zynq_ip))
self._ip_entry.grid(row=0, column=1, sticky="nsew", padx=PADDING_SMALL)
# BIN path
self._bin_selector = FileSelector(
# BIT path (Bootloader)
self._bit_selector = FileSelector(
panel,
label_text="BIN File:",
file_types=[("BIN files", "*.bin"), ("All files", "*")],
label_text="Bootloader BIT (.bit):",
file_types=[("BIT files", "*.bit"), ("All files", "*")],
)
if self._config.bin_path:
resolved = self._config.resolve_path(self._config.bin_path)
self._bin_selector.set_path(str(resolved))
self._bin_selector.grid(row=2, column=0, sticky="nsew", padx=PADDING, pady=PADDING_SMALL)
if self._config.bootloader_bit_path:
resolved = self._config.resolve_path(self._config.bootloader_bit_path)
self._bit_selector.set_path(str(resolved))
self._bit_selector.grid(row=2, column=0, sticky="nsew", padx=PADDING, pady=PADDING_SMALL)
# ELF path
# ELF path (Bootloader)
self._elf_selector = FileSelector(
panel,
label_text="ELF File:",
label_text="Bootloader ELF (.elf):",
file_types=[("ELF files", "*.elf"), ("All files", "*")],
)
if self._config.elf_path:
resolved = self._config.resolve_path(self._config.elf_path)
if self._config.bootloader_elf_path:
resolved = self._config.resolve_path(self._config.bootloader_elf_path)
self._elf_selector.set_path(str(resolved))
self._elf_selector.grid(row=3, column=0, sticky="nsew", padx=PADDING, pady=PADDING_SMALL)
# BIT path
self._bit_selector = FileSelector(
# Bootloader BIN path (Flash programming)
self._bootloader_bin_selector = FileSelector(
panel,
label_text="BIT File:",
file_types=[("BIT files", "*.bit"), ("All files", "*")],
label_text="Bootloader BIN (.bin):",
file_types=[("BIN files", "*.bin"), ("All files", "*")],
)
if self._config.bit_path:
resolved = self._config.resolve_path(self._config.bit_path)
self._bit_selector.set_path(str(resolved))
self._bit_selector.grid(row=4, column=0, sticky="nsew", padx=PADDING, pady=PADDING_SMALL)
if self._config.bootloader_bin_path:
resolved = self._config.resolve_path(self._config.bootloader_bin_path)
self._bootloader_bin_selector.set_path(str(resolved))
self._bootloader_bin_selector.grid(row=4, column=0, sticky="nsew", padx=PADDING, pady=PADDING_SMALL)
# Firmware BIN path (TFTP upload)
self._firmware_bin_selector = FileSelector(
panel,
label_text="Firmware BIN (.bin):",
file_types=[("BIN files", "*.bin"), ("All files", "*")],
)
if self._config.firmware_bin_path:
resolved = self._config.resolve_path(self._config.firmware_bin_path)
self._firmware_bin_selector.set_path(str(resolved))
self._firmware_bin_selector.grid(row=5, column=0, sticky="nsew", padx=PADDING, pady=PADDING_SMALL)
# Save button
save_btn = ctk.CTkButton(
@@ -448,12 +459,13 @@ class MainWindow(ctk.CTk):
"""Get selected file paths from the UI.
Returns:
Dictionary with bin_path, elf_path, bit_path.
Dictionary with bootloader_bit_path, bootloader_elf_path, bootloader_bin_path, firmware_bin_path.
"""
return {
"bin_path": self._bin_selector.get_path(),
"elf_path": self._elf_selector.get_path(),
"bit_path": self._bit_selector.get_path(),
"bootloader_bit_path": self._bit_selector.get_path(),
"bootloader_elf_path": self._elf_selector.get_path(),
"bootloader_bin_path": self._bootloader_bin_selector.get_path(),
"firmware_bin_path": self._firmware_bin_selector.get_path(),
}
# ── Step Implementations ───────────────────────────────────
@@ -503,14 +515,14 @@ class MainWindow(ctk.CTk):
return False
files = self._get_selected_files()
if not files["bin_path"]:
self._log_message(" No BIN file selected")
if not files["bootloader_bin_path"]:
self._log_message(" No Bootloader BIN file selected")
return False
self._log_message(f"Step 2: Programming Flash with {files['bin_path']}...")
self._log_message(f"Step 2: Programming Flash with {files['bootloader_bin_path']}...")
try:
bin_path = Path(files["bin_path"])
bin_path = Path(files["bootloader_bin_path"])
results = full_flash_program(self._config, bin_path, self._flash_callback)
for result in results:
@@ -532,18 +544,18 @@ class MainWindow(ctk.CTk):
return False
files = self._get_selected_files()
if not files["bit_path"]:
self._log_message(" No BIT file selected")
if not files["bootloader_bit_path"]:
self._log_message(" No Bootloader BIT file selected")
return False
self._log_message(f"Step 3: Loading bootloader (BIT + ELF)...")
self._log_message(f" BIT: {files['bit_path']}")
if files["elf_path"]:
self._log_message(f" ELF: {files['elf_path']}")
self._log_message(f" BIT: {files['bootloader_bit_path']}")
if files["bootloader_elf_path"]:
self._log_message(f" ELF: {files['bootloader_elf_path']}")
try:
bit_path = Path(files["bit_path"])
elf_path = Path(files["elf_path"]) if files["elf_path"] else bit_path.parent / "temp.elf"
bit_path = Path(files["bootloader_bit_path"])
elf_path = Path(files["bootloader_elf_path"]) if files["bootloader_elf_path"] else bit_path.parent / "temp.elf"
results = full_bitstream_program(
self._config, bit_path, elf_path,
@@ -569,8 +581,8 @@ class MainWindow(ctk.CTk):
return False
files = self._get_selected_files()
if not files["bin_path"]:
self._log_message(" No BIN file selected")
if not files["firmware_bin_path"]:
self._log_message(" No Firmware BIN file selected")
return False
all_results: list[bool] = []
@@ -578,7 +590,7 @@ class MainWindow(ctk.CTk):
# 4a: TFTP upload
self._log_message("Step 4a: TFTP upload & verify...")
try:
bin_path = Path(files["bin_path"])
bin_path = Path(files["firmware_bin_path"])
tftp_result = tftp_upload_verify(
self._config, bin_path,
callback=self._tftp_callback,