Added support for reading mask ROMs
This commit is contained in:
parent
6972543e24
commit
60dab0c311
|
@ -5,9 +5,10 @@ import sys, getopt, serial, binascii, struct
|
||||||
|
|
||||||
class Mode:
|
class Mode:
|
||||||
NONE = 0
|
NONE = 0
|
||||||
DUMP = 1
|
READ = 1
|
||||||
BURN = 2
|
DUMP = 2
|
||||||
CHECK = 3
|
BURN = 3
|
||||||
|
CHECK = 4
|
||||||
|
|
||||||
|
|
||||||
class Command:
|
class Command:
|
||||||
|
@ -16,7 +17,8 @@ class Command:
|
||||||
PING = 1
|
PING = 1
|
||||||
STARTRW = 2
|
STARTRW = 2
|
||||||
READBLOCK = 3
|
READBLOCK = 3
|
||||||
WRITEBLOCK = 4
|
READBLOCK_MASK = 4
|
||||||
|
WRITEBLOCK = 5
|
||||||
|
|
||||||
PONG = 'PONG'
|
PONG = 'PONG'
|
||||||
BLOCKSIZE = 512
|
BLOCKSIZE = 512
|
||||||
|
@ -30,13 +32,15 @@ def main(argv):
|
||||||
|
|
||||||
global romfile
|
global romfile
|
||||||
global serialport
|
global serialport
|
||||||
mode = Mode.NONE
|
global mode
|
||||||
|
|
||||||
|
mode = Mode.NONE
|
||||||
|
|
||||||
if len(argv)==0:
|
if len(argv)==0:
|
||||||
usage()
|
usage()
|
||||||
|
|
||||||
try:
|
try:
|
||||||
opts, args = getopt.getopt(argv,'dbcs:r:',['dump','burn','check','serial=','rom='])
|
opts, args = getopt.getopt(argv,'dRbcs:r:',['dump','burn','check','serial=','rom='])
|
||||||
except getopt.GetoptError:
|
except getopt.GetoptError:
|
||||||
usage()
|
usage()
|
||||||
|
|
||||||
|
@ -45,6 +49,8 @@ def main(argv):
|
||||||
mode = Mode.CHECK
|
mode = Mode.CHECK
|
||||||
elif opt == '-d':
|
elif opt == '-d':
|
||||||
mode = Mode.DUMP
|
mode = Mode.DUMP
|
||||||
|
elif opt == '-R':
|
||||||
|
mode = Mode.READ
|
||||||
elif opt == '-b':
|
elif opt == '-b':
|
||||||
mode = Mode.BURN
|
mode = Mode.BURN
|
||||||
elif opt == '-s':
|
elif opt == '-s':
|
||||||
|
@ -58,10 +64,12 @@ def main(argv):
|
||||||
Mode.NONE: usage,
|
Mode.NONE: usage,
|
||||||
Mode.BURN: burnROM,
|
Mode.BURN: burnROM,
|
||||||
Mode.DUMP: dumpROM,
|
Mode.DUMP: dumpROM,
|
||||||
|
Mode.READ: dumpROM,
|
||||||
Mode.CHECK: checkConnection
|
Mode.CHECK: checkConnection
|
||||||
}
|
}
|
||||||
commands[mode]()
|
commands[mode]()
|
||||||
|
|
||||||
|
|
||||||
def checkConnection():
|
def checkConnection():
|
||||||
if serialport=='':
|
if serialport=='':
|
||||||
usage()
|
usage()
|
||||||
|
@ -141,10 +149,11 @@ def dumpROM():
|
||||||
print 'Requesting data from EETool...'
|
print 'Requesting data from EETool...'
|
||||||
|
|
||||||
totalSize = 0
|
totalSize = 0
|
||||||
|
cmd = Command.READBLOCK_MASK if mode==Mode.DUMP else Command.READBLOCK
|
||||||
|
|
||||||
# Request all the blocks
|
# Request all the blocks
|
||||||
for blockNum in range(0,64):
|
for blockNum in range(0,64):
|
||||||
wrote = connection.write(bytearray([Command.PREFIX,Command.READBLOCK]))
|
wrote = connection.write(bytearray([Command.PREFIX,cmd]))
|
||||||
if wrote != 2:
|
if wrote != 2:
|
||||||
raise ValueError()
|
raise ValueError()
|
||||||
|
|
||||||
|
@ -189,7 +198,8 @@ def hexU32(n):
|
||||||
def usage():
|
def usage():
|
||||||
print '''
|
print '''
|
||||||
Usage: EECommander -[d|b|c] -s <serial port> -r <rom file>
|
Usage: EECommander -[d|b|c] -s <serial port> -r <rom file>
|
||||||
-d: Dump the contents of the attached ROM or EEPROM to a file'
|
-d: Dump the contents of the attached MASK ROM to a file
|
||||||
|
-R: Read the contents of the attached EEPROM to a file
|
||||||
-b: Burn the rom file to the attached EEPROM
|
-b: Burn the rom file to the attached EEPROM
|
||||||
-c: Check your connection to EETool (no other action taken)
|
-c: Check your connection to EETool (no other action taken)
|
||||||
|
|
||||||
|
|
|
@ -65,6 +65,7 @@ typedef enum
|
||||||
CMD_PING,
|
CMD_PING,
|
||||||
CMD_STARTRW,
|
CMD_STARTRW,
|
||||||
CMD_READBLOCK,
|
CMD_READBLOCK,
|
||||||
|
CMD_READBLOCK_MASK,
|
||||||
CMD_WRITEBLOCK
|
CMD_WRITEBLOCK
|
||||||
} Command;
|
} Command;
|
||||||
|
|
||||||
|
@ -132,6 +133,13 @@ int main(void)
|
||||||
gCurrentAddress += BUFF_SIZE;
|
gCurrentAddress += BUFF_SIZE;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
case CMD_READBLOCK_MASK:
|
||||||
|
{
|
||||||
|
ReadBlock(gCurrentAddress,BUFF_SIZE,true);
|
||||||
|
gCurrentAddress += BUFF_SIZE;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
default:
|
default:
|
||||||
FatalError();
|
FatalError();
|
||||||
|
|
Loading…
Reference in New Issue