+# execute our pkernel finally and set pkernel conform baudrate
+cmdCALL(0x30000)
+time.sleep(0.5) # just to get sure that the pkernel is really running!
+del tty
+tty = SerialPort(DEVICE, None, KERNEL_BAUDRATE)
+
+print "Performing ChipErase..."
+pkernCHIPERASE()
+print "Chip erasing done."
+
+print "Flashing",
+for seq in pkernelseqs:
+ # skip seqs only consisting of 0xffs
+ seqset = list(set(seq.data))
+ if len(seqset) == 1 and seqset[0] == 0xff:
+ continue
+ #print "Flashing", len(seq.data), "bytes at address", hex(seq.address)
+ pkernWRITE(seq.address, len(seq.data), seq.data)
+ tty.flush()
+ sys.stdout.write(".")
+ sys.stdout.flush()
+print
+print "Flashing done."