]> oss.titaniummirror.com Git - tinyos-2.x.git/blobdiff - tools/platforms/msp430/cppbsl/src/Parameters.cc
incorporate a patch from Frederik Hermans -- looks like the 2.4 kernel can not
[tinyos-2.x.git] / tools / platforms / msp430 / cppbsl / src / Parameters.cc
index 578035c3e8ed5830e22a89ca2ce92431910839fc..56d7cb1ee64699f5e5f0558709fd38c654dc4366 100644 (file)
@@ -44,7 +44,8 @@ Parameters::Parameters(int argc, char **argv) {
     action = NONE;
     image = 0;
     telosb = false;
-
+    chunksize = 250;
+    
     poptOption optionsTable[] = {
         {"debug",'D', 0, 0, 'd', "print many statements on progress"},
         {"f1x",'1', 0, 0, '1', "Specify CPU family, in case autodetect fails"},
@@ -55,6 +56,8 @@ Parameters::Parameters(int argc, char **argv) {
         {"intelhex",'I', 0, 0, 'I', "force fileformat to be  IntelHex"},
         {"erase",'e', 0, 0, 'e', "erase device"},
         {"reset",'r', 0, 0, 'r', "reset device"},
+        {"send-chunk-size",'s', POPT_ARG_INT | POPT_ARGFLAG_SHOW_DEFAULT,
+         &chunksize, 0, "program msp430 using chunks of this size", ""},
         {"program",'p', POPT_ARG_STRING, &image, 0,
          "Program file", ""},
         {"comport",'c', POPT_ARG_STRING, &device, 0,
@@ -120,6 +123,16 @@ Parameters::Parameters(int argc, char **argv) {
     else if(action == FLASH) {
         exit(1);
     }
+    // force sane chunk size
+    if(chunksize < 150) {
+        chunksize = 150;
+    }
+    else if(chunksize > 250) {
+        chunksize = 250;
+    }
+    // must be even!
+    chunksize /= 2; 
+    chunksize *= 2;
     poptFreeContext(optCon);
 };