def recvByte():
i = tty.read()
- while len(i)==0:
- time.sleep(0.03)
- i = tty.read()
return ord(i)
def sendByte(byte):
sendDWord(address)
sendWord(size)
- if (recvByte() != 0x04):
- raise Exception
- print "Received Metadata."
-
# write binary stream of data
for i in range(0, size):
sendByte(data[i])
- if (recvByte() != 0x08):
- raise Exception
- print "Received Data."
-
if (recvByte() != 0x28):
raise Exception
print "Flashing done."
print "Initializing serial port..."
-tty = SerialPort(DEVICE, 0, KERNEL_BAUDRATE)
+tty = SerialPort(DEVICE, None, KERNEL_BAUDRATE)
# check command line arguments
if len(sys.argv) != 2:
print "Flashing", len(seq.data), "bytes at address", hex(seq.address)
pkernWRITE(seq.address, len(seq.data), seq.data)
-sendByte(0x99);
-
+"""
+sendByte(0x99) #exit and wait
print "Reset your board now to run code from Flash"
+"""
+
+sendByte(0x97) #exit and restart