forked from M-Labs/artiq
1
0
Fork 0

artiq_flash: add command to erase flash memory (#1197)

This commit is contained in:
Paweł K 2018-11-28 11:33:32 +01:00 committed by Sébastien Bourdeauducq
parent 3fd95b86c2
commit 57caa7b149
1 changed files with 14 additions and 0 deletions

View File

@ -28,6 +28,7 @@ Valid actions:
* storage: write storage image to flash
* firmware: write firmware to flash
* load: load gateware bitstream into device (volatile but fast)
* erase: erase flash memory
* start: trigger the target to (re)load its gateware bitstream from flash
Prerequisites:
@ -132,6 +133,13 @@ class Programmer:
"flash bank {name} jtagspi 0 0 0 0 {tap}.{name}.proxy {ir:#x}",
tap=tap, name=name, ir=0x02 + index)
def erase_flash(self, bankname):
self.load_proxy()
add_commands(self._script,
"flash probe {bankname}",
"flash erase_sector {bankname} 0 last",
bankname=bankname)
def load(self, bitfile, pld):
os.stat(bitfile) # check for existence
@ -362,6 +370,12 @@ def main():
programmer.load(gateware_bit, 0)
elif action == "start":
programmer.start()
elif action == "erase":
if args.target == "sayma":
programmer.erase_flash("spi0")
programmer.erase_flash("spi1")
else:
programmer.erase_flash("spi0")
else:
raise ValueError("invalid action", action)