[Tinyos-2-commits]
CVS: tinyos-2.x/tools/platforms/msp430/cppbsl/src
Parameters.cc, 1.1, 1.2 Makefile.am, 1.1, 1.2 cmdline.h, 1.1,
NONE cmdline.cc, 1.1, NONE
akoepke
andreaskoepke at users.sourceforge.net
Mon Nov 5 10:03:23 PST 2007
Update of /cvsroot/tinyos/tinyos-2.x/tools/platforms/msp430/cppbsl/src
In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv21394/src
Modified Files:
Parameters.cc Makefile.am
Removed Files:
cmdline.h cmdline.cc
Log Message:
getopt is not re-entrant, so we rely on the external popt library to parse
command line options
Index: Parameters.cc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tools/platforms/msp430/cppbsl/src/Parameters.cc,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** Parameters.cc 31 Oct 2007 18:54:56 -0000 1.1
--- Parameters.cc 5 Nov 2007 18:03:21 -0000 1.2
***************
*** 32,36 ****
#include <errno.h>
#include <iostream>
! #include "cmdline.h"
#include "Parameters.h"
--- 32,36 ----
#include <errno.h>
#include <iostream>
! #include <popt.h>
#include "Parameters.h"
***************
*** 38,81 ****
Parameters::Parameters(int argc, char **argv) {
action = NONE;
! gengetopt_args_info args_info;
! cmdline_parser_init(&args_info);
! if(cmdline_parser(argc, argv, &args_info) != 0) {
! exit(1);
}
! if(args_info.invert_test_given) {
! invertTest = true;
! } else {
! invertTest = false;
}
! if(args_info.invert_reset_given) {
! invertReset = true;
! } else {
invertReset = false;
}
! if(args_info.debug_given) {
! verbose = true;
! } else {
! verbose = false;
! }
! if((args_info.erase_given) && (action < ERASE)) {
! action = ERASE;
}
! if((args_info.reset_given) && (action < RESET)) {
! action = RESET;
}
! if(args_info.program_given) {
! action = FLASH;
! img = args_info.program_arg;
}
! if(args_info.comport_given) {
! dev = args_info.comport_arg;
}
! if(args_info.telosb_given || args_info.tmote_given) {
! telosb = true;
! invertReset = false;
! invertTest = false;
}
! cmdline_parser_free(&args_info);
};
--- 38,125 ----
Parameters::Parameters(int argc, char **argv) {
+ int c;
action = NONE;
! 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;
! }
}
! if (c < -1) {
! /* an error occurred during option processing */
! fprintf(stderr, "%s: %s\n",
! poptBadOption(optCon, POPT_BADOPTION_NOALIAS),
! poptStrerror(c));
! exit(1);
}
! if(telosb) {
invertReset = false;
+ invertTest = false;
}
! if(image != 0) {
! action = FLASH;
}
! if(device != 0) {
! dev = device;
}
! else {
! exit(1);
}
! if(image != 0) {
! img = image;
}
! else if(action == FLASH) {
! exit(1);
}
! poptFreeContext(optCon);
};
Index: Makefile.am
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tools/platforms/msp430/cppbsl/src/Makefile.am,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** Makefile.am 31 Oct 2007 18:54:55 -0000 1.1
--- Makefile.am 5 Nov 2007 18:03:21 -0000 1.2
***************
*** 4,9 ****
bin_PROGRAMS=cppbsl
cppbsl_SOURCES=\
- cmdline.h \
- cmdline.cc \
Parameters.h \
Parameters.cc \
--- 4,7 ----
--- cmdline.h DELETED ---
--- cmdline.cc DELETED ---
More information about the Tinyos-2-commits
mailing list