mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-21 09:14:34 +00:00
improve error handling in restore script
This commit is contained in:
parent
c05e66b32c
commit
8e6728d743
1 changed files with 134 additions and 131 deletions
|
|
@ -534,17 +534,13 @@ def main():
|
||||||
print("SoC is from an unknow rev '{}', use --force to continue anyways with v0.9 firmware offsets".format(pc_usb.load_csrs()))
|
print("SoC is from an unknow rev '{}', use --force to continue anyways with v0.9 firmware offsets".format(pc_usb.load_csrs()))
|
||||||
exit(1)
|
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)
|
|
||||||
|
|
||||||
LANGUAGE = {
|
LANGUAGE = {
|
||||||
0: "en",
|
0: "en",
|
||||||
1: "en-tts",
|
1: "en-tts",
|
||||||
2: "ja",
|
2: "ja",
|
||||||
3: "zh",
|
3: "zh",
|
||||||
}
|
}
|
||||||
|
try:
|
||||||
with open("backup.pddb", "rb") as backup_file:
|
with open("backup.pddb", "rb") as backup_file:
|
||||||
backup = bytearray(backup_file.read())
|
backup = bytearray(backup_file.read())
|
||||||
|
|
||||||
|
|
@ -632,6 +628,11 @@ def main():
|
||||||
print("Abort by user request.")
|
print("Abort by user request.")
|
||||||
exit(0)
|
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)
|
||||||
|
|
||||||
worklist = [
|
worklist = [
|
||||||
['erase', "Disabling boot by erasing loader...", locs['LOC_LOADER'][0], 1024 * 256],
|
['erase', "Disabling boot by erasing loader...", locs['LOC_LOADER'][0], 1024 * 256],
|
||||||
['prog', "Uploading kernel", locs['LOC_KERNEL'][0], kernel],
|
['prog', "Uploading kernel", locs['LOC_KERNEL'][0], kernel],
|
||||||
|
|
@ -671,8 +672,10 @@ def main():
|
||||||
pc_usb.poke(pc_usb.register('reboot_soc_reset'), 0xac, display=False)
|
pc_usb.poke(pc_usb.register('reboot_soc_reset'), 0xac, display=False)
|
||||||
except usb.core.USBError:
|
except usb.core.USBError:
|
||||||
pass # we expect an error because we reset the SOC and that includes the USB core
|
pass # we expect an error because we reset the SOC and that includes the USB core
|
||||||
|
except:
|
||||||
|
print("`backup.pddb` could not be opened. Aborting.")
|
||||||
|
exit(1)
|
||||||
|
|
||||||
# print("If you need to run more commands, please unplug and re-plug your device in, as the Precursor USB core was just reset")
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
main()
|
main()
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue