From 6839b3763d38729aa5675236c7ed2fa7847ecbf3 Mon Sep 17 00:00:00 2001 From: sh-sergey Date: Tue, 5 Nov 2024 15:35:26 +0300 Subject: [PATCH] =?UTF-8?q?=D0=9D=D0=B5=D0=B1=D0=BE=D0=BB=D1=8C=D1=88?= =?UTF-8?q?=D0=B8=D0=B5=20=D0=B8=D1=81=D0=BF=D1=80=D0=B0=D0=B2=D0=BB=D0=B5?= =?UTF-8?q?=D0=BD=D0=B8=D1=8F=20=D0=B2=D1=8B=D0=B2=D0=BE=D0=B4=D0=B0=20?= =?UTF-8?q?=D0=BF=D1=80=D0=B8=20=D0=B7=D0=B0=D0=B3=D1=80=D1=83=D0=B7=D0=BA?= =?UTF-8?q?=D0=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- mik32_debug_hal/eeprom.py | 10 ++++++---- mik32_debug_hal/spifi.py | 14 ++++++++------ 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/mik32_debug_hal/eeprom.py b/mik32_debug_hal/eeprom.py index 1042b58..8ea6cac 100644 --- a/mik32_debug_hal/eeprom.py +++ b/mik32_debug_hal/eeprom.py @@ -308,13 +308,15 @@ def write_memory(pages: Dict[int, List[int]], openocd: OpenOcdTclRpc, driver_pat pathname = os.path.dirname(sys.argv[0]) openocd.run("wp 0x2003800 4 w") # готовимся поймать результат записи - print("Uploading driver...", flush=True) - openocd.run("load_image {%s}" % pathlib.Path(driver_path)) + print("Uploading driver... ", end="", flush=True) + openocd.run(f"load_image {{{pathlib.Path(driver_path)}}}") + print("OK!", flush=True) - print("Uploading data...", flush=True) + print("Uploading data... ", end="", flush=True) openocd.write_memory(0x02001800, 8, bytes_list) + print("OK!", flush=True) - print("Uploading data complete! Run driver...", flush=True) + print("Run driver...", flush=True) openocd.resume(0x2000000) wait_halted(openocd, 10) # ждем, когда watchpoint сработает diff --git a/mik32_debug_hal/spifi.py b/mik32_debug_hal/spifi.py index 72b7961..1103c12 100644 --- a/mik32_debug_hal/spifi.py +++ b/mik32_debug_hal/spifi.py @@ -393,17 +393,19 @@ def write_pages_by_sectors(pages: Dict[int, List[int]], openocd.run("wp 0x2003000 4 w") - print("Uploading driver...", flush=True) - openocd.run("load_image {%s}" % pathlib.Path(driver_path)) + print("Uploading driver... ", end="", flush=True) + openocd.run(f"load_image {{{pathlib.Path(driver_path)}}}") + print("OK!", flush=True) openocd.resume(0x2000000) wait_halted(openocd) + print("Writing Flash by sectors...", flush=True) + for i, sector in enumerate(sectors_list): - # print(f"Program sector {sector}", flush=True) ByteAddress = sector progress = f"{(i*100)//len(sectors_list)}%" - print(f"Writing Flash sector {ByteAddress:#010x}... {progress:>4}", end="", flush=True) + print(f" {ByteAddress:#010x} {progress:>4}", end="", flush=True) bytes_list: List[int] = [] for page in range(16): page = pages.get(page * 256 + sector) @@ -428,14 +430,14 @@ def write_pages_by_sectors(pages: Dict[int, List[int]], print("result =", result) break if result == 0: - print(f"Writing Flash sector {sectors_list[-1]:#010x}... 100% OK!", flush=True) + print(f" {sectors_list[-1]:#010x} 100% OK!", flush=True) openocd.run("rwp 0x02003800") init_memory(openocd) if result == 0: # Прошивка страниц флеш памяти по SPIFI была завершена - print("SPIFI writing successfully completed", flush=True) + print("SPIFI writing successfully completed!", flush=True) else: print(f"SPIFI writing failed!", flush=True) return 1