X-Git-Url: http://cvs.zerfleddert.de/cgi-bin/gitweb.cgi/proxmark3-svn/blobdiff_plain/30f2a7d38fd35b2427a7eb42e1cd75fb1105f927..1d6f7bc8ac10ed1761f9181eb74245e53ef6d978:/tools/srecswap.pl?ds=sidebyside diff --git a/tools/srecswap.pl b/tools/srecswap.pl index 24ef8e84..fd6f9a94 100644 --- a/tools/srecswap.pl +++ b/tools/srecswap.pl @@ -1,35 +1,35 @@ -#!/usr/bin/perl - -# endian-swap S records; we need this because the JTAG tools we're using -# expect the memory image in byte-swapped format -# -# Jonathan Westhues, April 2004 - -if(@ARGV == 0) { - die "usage: $0 file-to-endian-swap.s19 > out.s19\n"; -} - -while(<>) { - chomp; - - if(/^S0/) { - next; - } - if(/^S7/) { - print "$_\n"; - next; - } - - if(not /^S3(..)(........)(.*)(..)$/) { - die "bad S record at line $.\n"; - } - - $data = $3; - $checksum = $4; - - print "S3$1$2"; - while($data =~ m#(..)(..)(..)(..)#g) { - print "$4$3$2$1"; - } - print "$checksum\n"; -} +#!/usr/bin/perl + +# endian-swap S records; we need this because the JTAG tools we're using +# expect the memory image in byte-swapped format +# +# Jonathan Westhues, April 2004 + +if(@ARGV == 0) { + die "usage: $0 file-to-endian-swap.s19 > out.s19\n"; +} + +while(<>) { + chomp; + + if(/^S0/) { + next; + } + if(/^S7/) { + print "$_\n"; + next; + } + + if(not /^S3(..)(........)(.*)(..)$/) { + die "bad S record at line $.\n"; + } + + $data = $3; + $checksum = $4; + + print "S3$1$2"; + while($data =~ m#(..)(..)(..)(..)#g) { + print "$4$3$2$1"; + } + print "$checksum\n"; +}