+ device = 0;
+ verbose = false;
+ action = NONE;
+ image = 0;
+ telosb = false;
+
+ poptOption optionsTable[] = {
+ {"debug",'D', 0, 0, 'd', "print many statements on progress"},
+ {"f1x",'1', 0, 0, '1', "Specify CPU family, in case autodetect fails"},
+ {"invert-reset",'R', 0, 0, 'R', "RESET pin is inverted"},
+ {"invert-test",'T', 0, 0, 'T', "TEST pin is inverted"},
+ {"telosb",'b', 0, 0, 'b', "Assume a TelosB node"},
+ {"tmote",'b', 0, 0, 'b', "Assume a Tmote node"},
+ {"intelhex",'I', 0, 0, 'I', "force fileformat to be IntelHex"},
+ {"erase",'e', 0, 0, 'e', "erase device"},
+ {"reset",'r', 0, 0, 'r', "reset device"},
+ {"program",'p', POPT_ARG_STRING, &image, 0,
+ "Program file", ""},
+ {"comport",'c', POPT_ARG_STRING, &device, 0,
+ "communicate with MSP430 using this device", ""},
+ POPT_AUTOHELP
+ POPT_TABLEEND
+ };
+
+ poptContext optCon; /* context for parsing command-line options */
+ optCon = poptGetContext(NULL, argc, (const char**)argv, optionsTable, 0);
+ /* Now do options processing */
+ while((c = poptGetNextOpt(optCon)) >= 0) {
+ switch(c) {
+ case 'R':
+ invertReset = true;
+ break;
+ case 'T':
+ invertTest = true;
+ break;
+ case 'd':
+ verbose = true;
+ break;
+ case 'r':
+ if(action < RESET) {
+ action = RESET;
+ }
+ break;
+ case 'e':
+ if(action < ERASE) {
+ action = ERASE;
+ }
+ break;
+ case 'b':
+ telosb = true;
+ break;
+ default:
+ break;
+ }