change MFPR version to 2.4.2 to fix install script fail
[proxmark3.git] / tools / srecswap.pl
blob24ef8e84eac1f0a79f95f412bf31a613ebb58689
1 #!/usr/bin/perl
3 # endian-swap S records; we need this because the JTAG tools we're using
4 # expect the memory image in byte-swapped format
6 # Jonathan Westhues, April 2004
8 if(@ARGV == 0) {
9 die "usage: $0 file-to-endian-swap.s19 > out.s19\n";
12 while(<>) {
13 chomp;
15 if(/^S0/) {
16 next;
18 if(/^S7/) {
19 print "$_\n";
20 next;
23 if(not /^S3(..)(........)(.*)(..)$/) {
24 die "bad S record at line $.\n";
27 $data = $3;
28 $checksum = $4;
30 print "S3$1$2";
31 while($data =~ m#(..)(..)(..)(..)#g) {
32 print "$4$3$2$1";
34 print "$checksum\n";