mirror of
https://github.com/oliverschmidt/contiki.git
synced 2024-09-09 23:54:32 +00:00
add autoreset command and do_exit option
This commit is contained in:
parent
a6813372bf
commit
6d437591fc
@ -13,6 +13,8 @@ my $term = '/dev/ttyUSB0';
|
||||
my $baud = '115200';
|
||||
my $verbose;
|
||||
my $rts = 'rts';
|
||||
my $command = '';
|
||||
my $do_exit;
|
||||
|
||||
GetOptions ('file=s' => \$filename,
|
||||
'secondfile=s' => \$second,
|
||||
@ -20,6 +22,8 @@ GetOptions ('file=s' => \$filename,
|
||||
'verbose' => \$verbose,
|
||||
'baud=s' => \$baud,
|
||||
'rts=s' => \$rts,
|
||||
'command=s' => \$command,
|
||||
'exit' => \$do_exit,
|
||||
) or die 'bad options';
|
||||
|
||||
$| = 1;
|
||||
@ -29,11 +33,15 @@ if($filename eq '') {
|
||||
print " or : mc1322x-load.pl -f flasher.bin -s flashme.bin 0x1e000,0x11223344,0x55667788\n";
|
||||
print " -f required: binary file to load\n";
|
||||
print " -s optional: secondary binary file to send\n";
|
||||
print " -t default: /dev/ttyUSB0\n";
|
||||
print " -b default: 115200\n";
|
||||
print " -t terminal default: /dev/ttyUSB0\n";
|
||||
print " -b baud rate default: 115200\n";
|
||||
print " -r [none|rts] flow control default: rts\n";
|
||||
print " anything on the command line is sent\n";
|
||||
print " after all of the files.\n";
|
||||
print " -c command to run for autoreset: \n";
|
||||
print " e.g. -c 'bbmc -l redbee-econotag -i 0 reset'\n";
|
||||
print " -e exit instead of dropping to terminal display\n";
|
||||
print "\n";
|
||||
print "anything on the command line is sent\n";
|
||||
print "after all of the files.\n\n";
|
||||
exit;
|
||||
}
|
||||
|
||||
@ -56,6 +64,7 @@ $ob->read_const_time(1000); # 1 second per unfulfilled "read" call
|
||||
$ob->rts_active(1);
|
||||
|
||||
my $s = 0;
|
||||
my $reset = 0;
|
||||
|
||||
while(1) {
|
||||
|
||||
@ -65,6 +74,12 @@ while(1) {
|
||||
|
||||
$ob->write(pack('C','0'));
|
||||
|
||||
if(($command ne '') &&
|
||||
($reset eq 0)) {
|
||||
$reset++;
|
||||
system($command);
|
||||
}
|
||||
|
||||
if($s == 1) {
|
||||
$test = 'ready';
|
||||
} else {
|
||||
@ -121,6 +136,10 @@ if(scalar(@ARGV)!=0) {
|
||||
$ob->write(',');
|
||||
}
|
||||
|
||||
if(defined($do_exit)) {
|
||||
exit;
|
||||
}
|
||||
|
||||
my $c; my $count;
|
||||
while(1) {
|
||||
($count, $c) = $ob->read(1);
|
||||
|
Loading…
Reference in New Issue
Block a user