only flush once for a sequence, detect 0xffs seqs
[pyfrprog.git] / frprog.py
index cc250050eebeb2af08cab80ad151c12712badda8..da4f399dcdbdc179a4d63b50f984e77bd0962768 100755 (executable)
--- 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)
@@ -188,8 +187,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 +277,7 @@ print "Received Checksum:", last_checksum
 print
 """
 
-
+"""
 # write some data in the iram and try to execute it
 data_wr =[
                0x9B,0x00,
@@ -295,3 +301,4 @@ cmdWRITE(0x00030000, len(data_wr), data_wr)
 print "Received Checksum:", last_checksum
 print
 cmdCALL(0x00030000)
+"""