actually we have to write it in IRAM, thus we have to skip addresses for
[pyfrprog.git] / frprog.py
index f6a741846fe4bcd2798e1225edae2a4abd61eca2..8afad3f01e1f4ecb9dbe0181bd41afcc76dd6205 100755 (executable)
--- a/frprog.py
+++ b/frprog.py
@@ -118,6 +118,7 @@ class FlashSequence(object):
                self.address = address
                self.data = data
 
+# list of all our address/data pairs to flash
 flashseqs = []
 
 # check command line arguments
@@ -164,6 +165,7 @@ print "The following flash sequences have been read in:"
 for seq in flashseqs:
        print hex(seq.address) + ":", seq.data
 
+
 print "Initializing serial port..."
 tty = SerialPort(DEVICE, 100, INIT_BAUDRATE)
 
@@ -184,7 +186,18 @@ print "OK, trying to set baudrate..."
 cmdBAUDRATE(REAL_BAUDRATE)
 tty = SerialPort(DEVICE, 100, REAL_BAUDRATE)
 
+# let the fun begin!
+for seq in flashseqs:
+       if(seq.address >= 0x148000):
+               continue
+       print "RAMing", len(seq.data), "bytes at address", hex(seq.address)
+       cmdWRITE(seq.address - flashseqs[0].address + 0x30000, len(seq.data), seq.data)
+
+cmdCALL(0x30000);
+sys.exit(0)
+
 
+# some tests here.......
 """
 # execute (existing) program in ram
 cmdCALL(0x00033ffc)
@@ -262,7 +275,7 @@ print "Received Checksum:", last_checksum
 print
 """
 
-
+"""
 # write some data in the iram and try to execute it
 data_wr =[
                0x9B,0x00,
@@ -286,3 +299,4 @@ cmdWRITE(0x00030000, len(data_wr), data_wr)
 print "Received Checksum:", last_checksum
 print
 cmdCALL(0x00030000)
+"""