diff --git a/MAC/APL/PIC/rsuctl/crsuctl.sh b/MAC/APL/PIC/rsuctl/crsuctl.sh new file mode 100755 index 0000000000000000000000000000000000000000..ccb2cad9f2f221b5ba9c72d07e065b06d17940fc --- /dev/null +++ b/MAC/APL/PIC/rsuctl/crsuctl.sh @@ -0,0 +1,25 @@ +#!/bin/sh + +# +# Script to run rsuctl on a number of MAC addresses using a MAC address template +# and filling in the missing index (MM). +# + +MM="00 01 02 03 04 05 06 07 08 09 0a 0b" +#MM="08 09 0a 0b" + +if [ $# -eq 0 ]; then + echo "usage: `basename $0` arg*" + echo " String MM in any of the args will replaced by 00 01 02 etc" + echo " E.g. `basename $0` -m 10:fa:00:00:MM:00 -i eth0 -l" + exit +fi + +#echo args=$* + +for mac in $MM; do + realargs=`echo $* | sed -e "s/MM/$mac/"` + echo Running rsuctl $realargs + sudo rsuctl $realargs +# sudo rsuctl -m $mac_address -i eth1 -w -p $page -f $image $extra_options +done diff --git a/MAC/APL/PIC/rsuctl/rsuctl b/MAC/APL/PIC/rsuctl/rsuctl index 2615995a8d50917466260c9a78377f82d7c54eb7..2ca5d3c05554fca903917ae948ab46cb8db6fd50 100755 --- a/MAC/APL/PIC/rsuctl/rsuctl +++ b/MAC/APL/PIC/rsuctl/rsuctl @@ -129,14 +129,16 @@ sub usage Usage: rsuctl [options] command + standalone command (doesn't need an RSP MAC address to run) + [-b -f in.ttf -o out.bin] # Convert a ttf file to a binary file + options [-i ifname] # Ethernet interface name on which to communicate (default is eth1) -m mac-address # MAC-address of the target board (Mandatory) - command (specify at least one of the following) + command (specify at least one of the following, need -m option at least) [-l] # List the images currently stored in all pages of the flash - [-b -f in.ttf -o out.bin] # Convert a ttf file to a binary file [-e -p page [-F]] # Erase flash page, 0 <= page < 16 (-F forces erase of page 0) [-x -p page # Start (load & reset) new firmware from the specified page [-w -p page -f image[.ttf] [-F]] # Write img.bin into specified page (-F forces write to page 0) @@ -209,7 +211,7 @@ sub readresponse return ('', $retval, ''); } - my ($ethdr, $type, $status, $framesize, $blp, $rsp, $pid, $regid, $offset, $size, $seqnr, $reserved) = + ($ethdr, $type, $status, $framesize, $blp, $rsp, $pid, $regid, $offset, $size, $seqnr, $reserved) = unpack($MEPRECVFORMAT, $g_packet); if ($TYPE_WRITEACK != $type && $TYPE_READACK != $type) { @@ -772,6 +774,25 @@ sub main # check that at least one argument is present usage() if ($opt_h); + + if (defined($opt_b)) { + + # CONVERT TO BINARY + # + # readimage + + die "=== ERR no input file specified" if (!defined($opt_f) || ($opt_f eq "")); + die "=== ERR no output file specified" if (!defined($opt_o) || ($opt_o eq "")); + $image = readimage($opt_f); + + open(DUMPFILE, ">$opt_o") || die "=== ERR failed to open file '$opt_o' for writing\n"; + print DUMPFILE $image; + close(DUMPFILE); + report($error, true); + + return; + } + if (!defined($opt_m)) { print STDERR "=== ERR Must specify MAC address using -m option"; usage(); @@ -823,24 +844,6 @@ sub main return; } - if (defined($opt_b)) { - - # CONVERT TO BINARY - # - # readimage - - die "=== ERR no input file specified" if (!defined($opt_f) || ($opt_f eq "")); - die "=== ERR no output file specified" if (!defined($opt_o) || ($opt_o eq "")); - $image = readimage($opt_f); - - open(DUMPFILE, ">$opt_o") || die "=== ERR failed to open file '$opt_o' for writing\n"; - print DUMPFILE $image; - close(DUMPFILE); - report($error, true); - - return; - } - if (defined($opt_e)) { # ERASE