added further exit function, so the board restarts after reset
authorBernhard Urban <lewurm@gmx.net>
Mon, 14 Dec 2009 08:53:20 +0000 (09:53 +0100)
committerBernhard Urban <lewurm@gmx.net>
Mon, 14 Dec 2009 08:53:20 +0000 (09:53 +0100)
pkernel/kernel.py
pkernel/main.c

index e495a86b693f10d2a9557d15a57f1052898e5ca4..8bf955b377dd0ec822f430910f666829292d0684 100755 (executable)
@@ -56,18 +56,10 @@ def pkernWRITE(address, size, data):
        sendDWord(address)
        sendWord(size)
 
        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])
 
        # 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."
        if (recvByte() != 0x28):
                raise Exception
        print "Flashing done."
@@ -144,6 +136,9 @@ for seq in flashseqs:
        print "Flashing", len(seq.data), "bytes at address", hex(seq.address)
        pkernWRITE(seq.address, len(seq.data), seq.data)
 
        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"
 print "Reset your board now to run code from Flash"
+"""
+
+sendByte(0x97) #exit and restart
index c40924f4b3c9c3c39e484a486734bba55491b5bb..8852877433a882dc458d29d55851a5aea253f1d2 100644 (file)
@@ -7,7 +7,6 @@
 static void increaseled(void)
 {
        PDR14 = ~(((~PDR14)+1)%256);
 static void increaseled(void)
 {
        PDR14 = ~(((~PDR14)+1)%256);
-       HWWD_CL = 0;
 }
 
 static unsigned char recvbyte(void)
 }
 
 static unsigned char recvbyte(void)
@@ -106,13 +105,11 @@ void main(void)
                                size = recvword();
                                increaseled();
 
                                size = recvword();
                                increaseled();
 
-                               Putch4(0x04); //Received Metadata.
                                PDR14 = 0xff;
                                for(i=0; i<size; i++) { /* get data */
                                        increaseled();
                                        data[i] = recvbyte();
                                }
                                PDR14 = 0xff;
                                for(i=0; i<size; i++) { /* get data */
                                        increaseled();
                                        data[i] = recvbyte();
                                }
-                               Putch4(0x08); //Received Data.
 
                                PDR14 = 0xff;
                                for(i=0; i<size; i+=2) { /* flash the data */
 
                                PDR14 = 0xff;
                                for(i=0; i<size; i+=2) { /* flash the data */
@@ -125,6 +122,11 @@ void main(void)
                                Putch4(0x28); //Flashing done.
                                break;
 
                                Putch4(0x28); //Flashing done.
                                break;
 
+                       case 0x97: /* exit and restart (let do this by the watchdog!) */
+                               while(1) {
+                                       increaseled();
+                               }
+
                        case 0x99: /* exit */
                                running = 0;
                                break;
                        case 0x99: /* exit */
                                running = 0;
                                break;