2
0
mirror of https://github.com/m-labs/artiq.git synced 2024-12-29 13:13:34 +08:00

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

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)