From 02cd044845c5ea29f2c91005fc092c7c33ad27d4 Mon Sep 17 00:00:00 2001 From: Michael Buesch Date: Sun, 14 Feb 2010 01:31:47 +0100 Subject: Add broken m8c top half implementation. Signed-off-by: Michael Buesch --- toprammer | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) (limited to 'toprammer') diff --git a/toprammer b/toprammer index 2fd2a69..b2dc15c 100755 --- a/toprammer +++ b/toprammer @@ -37,16 +37,19 @@ except (ImportError), e: # Import the supported chip modules from chip_atmega8dip28 import * +from chip_m8cissp import * class TOP: - def __init__(self, bitfileName, busDev=None, verbose=0, forceLevel=0, noqueue=False): + def __init__(self, bitfileName, busDev=None, verbose=0, + forceLevel=0, noqueue=False, usebroken=False): """bitfileName is the path to the .bit file. busDev is a tuple (BUSID, DEVID) or None.""" self.verbose = verbose self.forceLevel = forceLevel self.noqueue = noqueue + self.usebroken = usebroken self.commandsBlocked = False self.commandQueue = [] @@ -59,6 +62,8 @@ class TOP: if chipID.endswith(".ncd"): chipID = chipID[0:-4] self.chip = chipFind(chipID) + if self.chip and self.chip.isBroken() and not usebroken: + self.chip = None if not self.chip: raise TOPException("Did not find an implementation for the chip %s" % chipID) self.chip.setTOP(self) @@ -461,6 +466,7 @@ def usage(): print " -o|--force LEVEL Set the force level. Default = 0" print " Note that any value greater than 0 may brick devices" print " -Q|--noqueue Disable command queuing. Really slow!" + print " -B|--broken Also use broken algorithms" def fileOut(filename, data): if filename == "-": @@ -482,14 +488,15 @@ def main(argv): opt_action = None opt_file = None opt_noqueue = False + opt_usebroken = False try: (opts, args) = getopt.getopt(sys.argv[1:], - "hb:d:V:Qs:xp:P:e:E:f:F:o:l:L:", + "hb:d:V:Qs:xp:P:e:E:f:F:o:l:L:B", [ "help", "bitfile=", "device=", "verbose=", "noqueue", "read-sig=", "erase", "read-prog=", "write-prog=", "read-eeprom=", "write-eeprom=", "read-fuse=", "write-fuse=", "read-lock=", "write-lock=", - "force=", ]) + "force=", "broken", ]) for (o, v) in opts: if o in ("-h", "--help"): usage() @@ -509,6 +516,8 @@ def main(argv): opt_forceLevel = int(v) if o in ("-Q", "--noqueue"): opt_noqueue = True + if o in ("-B", "--broken"): + opt_usebroken = True if o in ("-s", "--read-sig"): opt_action = "read-sig" opt_file = v @@ -551,7 +560,7 @@ def main(argv): try: top = TOP(bitfileName = opt_bitfile, busDev = opt_device, verbose = opt_verbose, forceLevel = opt_forceLevel, - noqueue = opt_noqueue) + noqueue = opt_noqueue, usebroken = opt_usebroken) if opt_action == "read-sig": fileOut(opt_file, top.readSignature()) elif opt_action == "erase": -- cgit v1.2.3