X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=blobdiff_plain;f=frprog.py;h=e14eb94ba8aab2fc7ef3afeea7a3735adb51060f;hb=8aa120e1a3c303d27b1924ed70a635206bb87332;hp=cc250050eebeb2af08cab80ad151c12712badda8;hpb=b9fee154b7467b52b9c17f3f4d98c7a9b26e82ea;p=pyfrprog.git diff --git a/frprog.py b/frprog.py index cc25005..e14eb94 100755 --- a/frprog.py +++ b/frprog.py @@ -15,7 +15,6 @@ last_checksum = 0 def sendByte(byte): time.sleep(0.001) # just to get sure, wait 1ms tty.write(chr(byte)) - tty.flush() def sendWord(word): sendByte(word & 0xFF) @@ -98,8 +97,6 @@ def cmdCHECKSUM(): recvChecksum() def cmdBAUDRATE(baudrate): - global last_checksum - # send BAUDRATE command sendByte(0x01) if (recvByte() != 0xF1): @@ -108,10 +105,7 @@ def cmdBAUDRATE(baudrate): if (recvByte() != 0x86): raise Exception # send desired baudrate - sendByte(baudrate & 0xFF) - sendByte((baudrate >> 8) & 0xFF) - sendByte((baudrate >> 16) & 0xFF) - sendByte((baudrate >> 24) & 0xFF) + sendDWord(baudrate) class FlashSequence(object): def __init__(self, address, data): @@ -188,8 +182,15 @@ tty = SerialPort(DEVICE, 100, REAL_BAUDRATE) # let the fun begin! for seq in flashseqs: - print "Flashing", len(seq.data), "bytes at address", hex(seq.address) - cmdWRITE(seq.address, len(seq.data), seq.data) + if(seq.address <= 0x40000): + addr = seq.address + else: + continue + print "RAMing", len(seq.data), "bytes at address", hex(addr) + cmdWRITE(addr, len(seq.data), seq.data) + tty.flush() + +cmdCALL(0x30000); sys.exit(0) @@ -271,7 +272,7 @@ print "Received Checksum:", last_checksum print """ - +""" # write some data in the iram and try to execute it data_wr =[ 0x9B,0x00, @@ -295,3 +296,4 @@ cmdWRITE(0x00030000, len(data_wr), data_wr) print "Received Checksum:", last_checksum print cmdCALL(0x00030000) +"""