mirror of
https://github.com/MikronMIK32/mik32-uploader.git
synced 2026-10-30 02:11:13 +03:00
Добавлена базовая обработка ошибок связи с OpenOCD
This commit is contained in:
1 parent
5135347032
commit
328112232c
9 files changed
+90
-45
No files matched your search
@@ -44,6 +44,14 @@ QUAD_PAGE_PROGRAM_COMMAND = 0x32
|
||||
JEDEC_ID_COMMAND = 0x9F
|
||||
|
||||
|
||||
class FlashError(Exception):
|
||||
def __init__(self, value):
|
||||
self.value = value
|
||||
|
||||
def __str__(self):
|
||||
return ("ERROR: " + repr(self.value))
|
||||
|
||||
|
||||
class SREG_Num(Enum):
|
||||
SREG1 = 0x00
|
||||
SREG2 = 0x30
|
||||
@@ -146,7 +154,7 @@ def page_program(
|
||||
):
|
||||
print(f"Writing Flash page {ByteAddress:#010x}... {progress}", flush=True)
|
||||
if byte_count > 256:
|
||||
raise Exception("Byte count more than 256")
|
||||
raise FlashError("Byte count more than 256")
|
||||
|
||||
write_enable(openocd)
|
||||
spifi.send_command(openocd, PAGE_PROGRAM_COMMAND, spifi.Frameform.OPCODE_3ADDR,
|
||||
@@ -182,7 +190,7 @@ def quad_page_program(
|
||||
):
|
||||
print(f"Writing page {ByteAddress:#010x}... {progress}", flush=True)
|
||||
if byte_count > 256:
|
||||
raise Exception("Byte count more than 256")
|
||||
raise FlashError("Byte count more than 256")
|
||||
|
||||
write_enable(openocd)
|
||||
spifi.send_command(openocd, QUAD_PAGE_PROGRAM_COMMAND, spifi.Frameform.OPCODE_3ADDR,
|
||||
|
||||
Reference in new issue
Block a user