mirror of https://github.com/m-labs/artiq.git
artiq_flash: add command to erase flash memory (#1197)
This commit is contained in:
parent
3fd95b86c2
commit
57caa7b149
|
@ -28,6 +28,7 @@ Valid actions:
|
||||||
* storage: write storage image to flash
|
* storage: write storage image to flash
|
||||||
* firmware: write firmware to flash
|
* firmware: write firmware to flash
|
||||||
* load: load gateware bitstream into device (volatile but fast)
|
* 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
|
* start: trigger the target to (re)load its gateware bitstream from flash
|
||||||
|
|
||||||
Prerequisites:
|
Prerequisites:
|
||||||
|
@ -132,6 +133,13 @@ class Programmer:
|
||||||
"flash bank {name} jtagspi 0 0 0 0 {tap}.{name}.proxy {ir:#x}",
|
"flash bank {name} jtagspi 0 0 0 0 {tap}.{name}.proxy {ir:#x}",
|
||||||
tap=tap, name=name, ir=0x02 + index)
|
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):
|
def load(self, bitfile, pld):
|
||||||
os.stat(bitfile) # check for existence
|
os.stat(bitfile) # check for existence
|
||||||
|
|
||||||
|
@ -362,6 +370,12 @@ def main():
|
||||||
programmer.load(gateware_bit, 0)
|
programmer.load(gateware_bit, 0)
|
||||||
elif action == "start":
|
elif action == "start":
|
||||||
programmer.start()
|
programmer.start()
|
||||||
|
elif action == "erase":
|
||||||
|
if args.target == "sayma":
|
||||||
|
programmer.erase_flash("spi0")
|
||||||
|
programmer.erase_flash("spi1")
|
||||||
|
else:
|
||||||
|
programmer.erase_flash("spi0")
|
||||||
else:
|
else:
|
||||||
raise ValueError("invalid action", action)
|
raise ValueError("invalid action", action)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue