Shellcode is now only loaded when
authortravisutk <travisutk@12e2690d-a6be-4b82-a7b7-67c4a43b65c8>
Sat, 11 Dec 2010 18:56:26 +0000 (18:56 +0000)
committertravisutk <travisutk@12e2690d-a6be-4b82-a7b7-67c4a43b65c8>
Sat, 11 Dec 2010 18:56:26 +0000 (18:56 +0000)
a new filename is presented.  Old code remains in place without
reloading, which significantly reduces the number of dropped
Simpliciti packets.

git-svn-id: https://svn.code.sf.net/p/goodfet/code/trunk@789 12e2690d-a6be-4b82-a7b7-67c4a43b65c8

client/GoodFETCC.py
client/goodfet.cc
shellcode/chipcon/cc1110/reflex.c
shellcode/chipcon/cc1110/rxpacket.c

index 67c1be9..01b6668 100644 (file)
@@ -126,21 +126,22 @@ class GoodFETCC(GoodFET):
         hz=freq*396.728515625;
         
         return hz;
         hz=freq*396.728515625;
         
         return hz;
+    lastshellcode="none";
     def shellcodefile(self,filename,wait=1):
         """Run a fragment of shellcode by name."""
         #FIXME: should identify chip model number, use shellcode for that chip.
     def shellcodefile(self,filename,wait=1):
         """Run a fragment of shellcode by name."""
         #FIXME: should identify chip model number, use shellcode for that chip.
-        file=__file__;
-        file=file.replace("GoodFETCC.pyc","GoodFETCC.py");
-        path=file.replace("client/GoodFETCC.py","shellcode/chipcon/cc1110/");
-        #print "File\t%s" % file;
-        #print "Path\t%s" % path;
-        filename=path+filename;
-        #print "Loading shelcode from %s" % filename;
-        
-        #Load the shellcode.
-        h=IntelHex(filename);
-        for i in h._buf.keys():
-            self.CCpokedatabyte(i,h[i]);
+        
+        if self.lastshellcode!=filename:
+            self.lastshellcode=filename;
+            file=__file__;
+            file=file.replace("GoodFETCC.pyc","GoodFETCC.py");
+            path=file.replace("client/GoodFETCC.py","shellcode/chipcon/cc1110/");
+            filename=path+filename;
+        
+            #Load the shellcode.
+            h=IntelHex(filename);
+            for i in h._buf.keys():
+                self.CCpokedatabyte(i,h[i]);
         
         #Execute it.
         self.CCdebuginstr([0x02, 0xf0, 0x00]); #ljmp 0xF000
         
         #Execute it.
         self.CCdebuginstr([0x02, 0xf0, 0x00]); #ljmp 0xF000
index e8de384..20b0405 100755 (executable)
@@ -48,11 +48,16 @@ def handlesimplicitipacket(packet):
     port=packet[9];
     info=packet[10];
     seq=packet[11];
     port=packet[9];
     info=packet[10];
     seq=packet[11];
-    #payload begins at byte 12.
+    #payload begins at byte 10.
     
     
     
     
-    
-    if port==0x03:
+    if port==0x20:
+        #data packet
+        x=packet[11];
+        y=packet[13];
+        z=packet[15];
+        print "%02x: %i %i %i" % (seq,x,y,z);
+    elif port==0x03:
         #print "Join request.";
         if packet[12]!=1:
             print "Not a join request.  WTF?";
         #print "Join request.";
         if packet[12]!=1:
             print "Not a join request.  WTF?";
@@ -145,6 +150,7 @@ if(sys.argv[1]=="reflex"):
             rssi=0;
         rssi=client.peek8(0xFE00,"xdata");
         print "Activated jamming with RSSI of %i, going again for another packet." % rssi;
             rssi=0;
         rssi=client.peek8(0xFE00,"xdata");
         print "Activated jamming with RSSI of %i, going again for another packet." % rssi;
+        #client.CCdebuginstr([0x02, 0xf0, 0x00]); #ljmp 0xF000
         client.resume();
     
     RFST=0xDFE1
         client.resume();
     
     RFST=0xDFE1
index 6bfec59..ced2f90 100644 (file)
@@ -19,12 +19,13 @@ void main(){
   RFTXRXIE=0;
   
   //idle a bit.
   RFTXRXIE=0;
   
   //idle a bit.
-  RFST=RFST_SIDLE;
-  while(MARCSTATE!=MARC_STATE_IDLE);
+  //RFST=RFST_SIDLE;
+  //while(MARCSTATE!=MARC_STATE_IDLE);
 
   while(1){
     //Wait for the transmission.
     RFST=RFST_SRX;
 
   while(1){
     //Wait for the transmission.
     RFST=RFST_SRX;
+    while(MARCSTATE!=MARC_STATE_RX);
     rssi=0;
     //Wait for RSSI to settle.
     sleepMillis(10);
     rssi=0;
     //Wait for RSSI to settle.
     sleepMillis(10);
index a294aac..5ba32a5 100644 (file)
@@ -17,8 +17,8 @@ void main(){
   RFTXRXIE=0;
   
   //idle a bit.
   RFTXRXIE=0;
   
   //idle a bit.
-  RFST=RFST_SIDLE;
-  while(MARCSTATE!=MARC_STATE_IDLE);
+  //RFST=RFST_SIDLE;
+  //while(MARCSTATE!=MARC_STATE_IDLE);
   
   //Begin to receive.
   RFST=RFST_SRX;
   
   //Begin to receive.
   RFST=RFST_SRX;
@@ -28,13 +28,9 @@ void main(){
     while(!RFTXRXIF); //Wait for byte to be ready.
     RFTXRXIF=0;      //Clear the flag.
     
     while(!RFTXRXIF); //Wait for byte to be ready.
     RFTXRXIF=0;      //Clear the flag.
     
-    if (MARCSTATE == MARC_STATE_RX) {
-      packet[i]=RFD; //Grab the next byte.
-      i++;
-      len=packet[0];   //First byte of the packet is the length.
-    }else
-      HALT;
-
+    packet[i]=RFD; //Grab the next byte.
+    i++;
+    len=packet[0];   //First byte of the packet is the length.
   }
   RFST = RFST_SIDLE; //End receive.
   HALT;
   }
   RFST = RFST_SIDLE; //End receive.
   HALT;