mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-15 08:30:02 +00:00
fix backup and restore to be compatible with new SoC format
This commit is contained in:
parent
9dc30377ad
commit
da4c775113
2 changed files with 36 additions and 6 deletions
|
|
@ -32,6 +32,22 @@ class PrecursorUsb:
|
|||
def register(self, name):
|
||||
return int(self.registers[name], 0)
|
||||
|
||||
def halt(self):
|
||||
if 'vexriscv_debug' in self.regions:
|
||||
self.poke(int(self.regions['vexriscv_debug'][0], 0), 0x00020000)
|
||||
elif 'reboot_cpu_hold_reset' in self.registers:
|
||||
self.poke(self.register('reboot_cpu_hold_reset'), 1)
|
||||
else:
|
||||
print("Can't find reset CSR. Try updating to the latest version of this program")
|
||||
|
||||
def unhalt(self):
|
||||
if 'vexriscv_debug' in self.regions:
|
||||
self.poke(int(self.regions['vexriscv_debug'][0], 0), 0x02000000)
|
||||
elif 'reboot_cpu_hold_reset' in self.registers:
|
||||
self.poke(self.register('reboot_cpu_hold_reset'), 0)
|
||||
else:
|
||||
print("Can't find reset CSR. Try updating to the latest version of this program")
|
||||
|
||||
def peek(self, addr, display=False):
|
||||
_dummy_s = '\x00'.encode('utf-8')
|
||||
data = array.array('B', _dummy_s * 4)
|
||||
|
|
@ -620,10 +636,9 @@ def main():
|
|||
print("SoC is from an unknown rev '{}', use --force to continue anyways with v0.9 firmware offsets".format(pc_usb.load_csrs()))
|
||||
exit(1)
|
||||
|
||||
vexdbg_addr = int(pc_usb.regions['vexriscv_debug'][0], 0)
|
||||
pc_usb.ping_wdt()
|
||||
print("Halting CPU.")
|
||||
pc_usb.poke(vexdbg_addr, 0x00020000)
|
||||
pc_usb.halt()
|
||||
|
||||
header_checked = False
|
||||
checksum_error = False
|
||||
|
|
@ -685,7 +700,7 @@ def main():
|
|||
file.close()
|
||||
|
||||
print("Resuming CPU.")
|
||||
pc_usb.poke(vexdbg_addr, 0x02000000)
|
||||
pc_usb.unhalt()
|
||||
|
||||
if checksum_error:
|
||||
print("Link errors detected while downloading the backup. Data is likely corrupted, please try again!")
|
||||
|
|
|
|||
|
|
@ -33,6 +33,22 @@ class PrecursorUsb:
|
|||
def register(self, name):
|
||||
return int(self.registers[name], 0)
|
||||
|
||||
def halt(self):
|
||||
if 'vexriscv_debug' in self.regions:
|
||||
self.poke(int(self.regions['vexriscv_debug'][0], 0), 0x00020000)
|
||||
elif 'reboot_cpu_hold_reset' in self.registers:
|
||||
self.poke(self.register('reboot_cpu_hold_reset'), 1)
|
||||
else:
|
||||
print("Can't find reset CSR. Try updating to the latest version of this program")
|
||||
|
||||
def unhalt(self):
|
||||
if 'vexriscv_debug' in self.regions:
|
||||
self.poke(int(self.regions['vexriscv_debug'][0], 0), 0x02000000)
|
||||
elif 'reboot_cpu_hold_reset' in self.registers:
|
||||
self.poke(self.register('reboot_cpu_hold_reset'), 0)
|
||||
else:
|
||||
print("Can't find reset CSR. Try updating to the latest version of this program")
|
||||
|
||||
def peek(self, addr, display=False):
|
||||
_dummy_s = '\x00'.encode('utf-8')
|
||||
data = array.array('B', _dummy_s * 4)
|
||||
|
|
@ -693,10 +709,9 @@ def main():
|
|||
print("Abort by user request.")
|
||||
exit(0)
|
||||
|
||||
vexdbg_addr = int(pc_usb.regions['vexriscv_debug'][0], 0)
|
||||
pc_usb.ping_wdt()
|
||||
print("Halting CPU.")
|
||||
pc_usb.poke(vexdbg_addr, 0x00020000)
|
||||
pc_usb.halt()
|
||||
|
||||
worklist = [
|
||||
['erase', "Disabling boot by erasing loader...", locs['LOC_LOADER'][0], 1024 * 256],
|
||||
|
|
@ -730,7 +745,7 @@ def main():
|
|||
print("Restore finished copying objects.\nYou will need to reboot by inserting a paperclip in the hole in the lower right hand side,\nand follow on-screen instructions")
|
||||
|
||||
print("Resuming CPU.")
|
||||
pc_usb.poke(vexdbg_addr, 0x02000000)
|
||||
pc_usb.unhalt()
|
||||
|
||||
print("Resetting SOC...")
|
||||
try:
|
||||
|
|
|
|||
Loading…
Reference in a new issue