[Tinyos-2-commits] CVS: tinyos-2.x/tools/platforms/msp430/cppbsl/src cppbsl.cc, 1.1, 1.2 Parameters.h, 1.1, 1.2 Parameters.cc, 1.2, 1.3 Bsl.h, 1.1, 1.2 Bsl.cc, 1.1, 1.2
akoepke
andreaskoepke at users.sourceforge.net
Tue May 6 07:19:38 PDT 2008
Update of /cvsroot/tinyos/tinyos-2.x/tools/platforms/msp430/cppbsl/src
In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv29059
Modified Files:
cppbsl.cc Parameters.h Parameters.cc Bsl.h Bsl.cc
Log Message:
incorporate a patch from Frederik Hermans -- looks like the 2.4 kernel can not
send all 260 bytes of a normal msp430 program chunk at once, so now you can
choose a proper chunk size on the command line.
Index: cppbsl.cc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tools/platforms/msp430/cppbsl/src/cppbsl.cc,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** cppbsl.cc 31 Oct 2007 18:54:56 -0000 1.1
--- cppbsl.cc 6 May 2008 14:19:36 -0000 1.2
***************
*** 72,76 ****
bs = new BaseSerial(oldterm, readFD, writeFD, parameters->invertTest, parameters->invertReset);
}
! bsl = new Bsl(bs, parameters->img.c_str());
switch(parameters->action) {
case Parameters::ERASE:
--- 72,76 ----
bs = new BaseSerial(oldterm, readFD, writeFD, parameters->invertTest, parameters->invertReset);
}
! bsl = new Bsl(bs, parameters->img.c_str(), parameters->chunksize);
switch(parameters->action) {
case Parameters::ERASE:
***************
*** 105,108 ****
delete bs;
delete parameters;
! return 0;
}
--- 105,108 ----
delete bs;
delete parameters;
! return (r != 0);
}
Index: Parameters.h
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tools/platforms/msp430/cppbsl/src/Parameters.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** Parameters.h 31 Oct 2007 18:54:56 -0000 1.1
--- Parameters.h 6 May 2008 14:19:36 -0000 1.2
***************
*** 62,65 ****
--- 62,66 ----
actions_t action;
+ int chunksize;
public:
Index: Parameters.cc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tools/platforms/msp430/cppbsl/src/Parameters.cc,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** Parameters.cc 5 Nov 2007 18:03:21 -0000 1.2
--- Parameters.cc 6 May 2008 14:19:36 -0000 1.3
***************
*** 45,49 ****
image = 0;
telosb = false;
!
poptOption optionsTable[] = {
{"debug",'D', 0, 0, 'd', "print many statements on progress"},
--- 45,50 ----
image = 0;
telosb = false;
! chunksize = 250;
!
poptOption optionsTable[] = {
{"debug",'D', 0, 0, 'd', "print many statements on progress"},
***************
*** 56,59 ****
--- 57,62 ----
{"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", ""},
***************
*** 121,124 ****
--- 124,137 ----
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);
};
Index: Bsl.h
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tools/platforms/msp430/cppbsl/src/Bsl.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** Bsl.h 31 Oct 2007 18:54:55 -0000 1.1
--- Bsl.h 6 May 2008 14:19:36 -0000 1.2
***************
*** 47,50 ****
--- 47,51 ----
BaseSerial *s;
const char *image;
+ const int CHUNKSIZE;
enum commands_t {
***************
*** 82,86 ****
public:
! Bsl(BaseSerial* ser, const char *img) : s(ser), image(img) {
};
--- 83,87 ----
public:
! Bsl(BaseSerial* ser, const char *img, int cs=250) : s(ser), image(img), CHUNKSIZE(cs) {
};
Index: Bsl.cc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tools/platforms/msp430/cppbsl/src/Bsl.cc,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** Bsl.cc 31 Oct 2007 18:54:55 -0000 1.1
--- Bsl.cc 6 May 2008 14:19:36 -0000 1.2
***************
*** 153,157 ****
for(int i=0; i<len; i+=l) {
l=len-i;
! if(l>250) l=250;
adr=addr+i;
r = writeBlock(err, adr, &data[i], l);
--- 153,157 ----
for(int i=0; i<len; i+=l) {
l=len-i;
! if(l>CHUNKSIZE) l=CHUNKSIZE;
adr=addr+i;
r = writeBlock(err, adr, &data[i], l);
More information about the Tinyos-2-commits
mailing list