dump: do not hard-code constants
This commit is contained in:
parent
11a6ac2f4f
commit
43b9a2d3df
@ -6,6 +6,7 @@ from . import avr
|
|||||||
|
|
||||||
|
|
||||||
FILL_BYTE = b'\0' # used to fill memory gaps in the dump
|
FILL_BYTE = b'\0' # used to fill memory gaps in the dump
|
||||||
|
DUMP_MAGIC = 0x55525547 # XFLASH dump magic
|
||||||
|
|
||||||
class CrashReason(enum.IntEnum):
|
class CrashReason(enum.IntEnum):
|
||||||
MANUAL = 0
|
MANUAL = 0
|
||||||
@ -151,7 +152,7 @@ def decode_dump(path):
|
|||||||
|
|
||||||
# decode the header structure
|
# decode the header structure
|
||||||
magic, regs_present, crash_reason, pc, sp = struct.unpack('<LBBLH', buf_data[0:12])
|
magic, regs_present, crash_reason, pc, sp = struct.unpack('<LBBLH', buf_data[0:12])
|
||||||
if magic != 0x55525547:
|
if magic != DUMP_MAGIC:
|
||||||
print('error: invalid dump header in D21', file=sys.stderr)
|
print('error: invalid dump header in D21', file=sys.stderr)
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user