Added LF frequency adjustments from d18c7db, cleaned up code,

typo fixes in iso14443a code, added the missing "tools" directory,
added initial elements for online/offline detection for commands.
This commit is contained in:
edouard@lafargue.name 2009-04-15 08:09:06 +00:00
commit 30f2a7d38f
16 changed files with 10914 additions and 161 deletions

18
tools/merge-srec.pl Normal file
View file

@ -0,0 +1,18 @@
# merge the code that initially executes out of flash with the RAM image
($flashFile, $ramFile) = @ARGV;
open(FLASH, $flashFile) or die "$flashFile: $!\n";
while(<FLASH>) {
print if /^S3/;
}
open(RAM, $ramFile) or die "$ramFile: $!\n";
while(<RAM>) {
if(/^S3(..)(........)(.*)/) {
$addr = sprintf('%08X', hex($2) - 0x00200000 + 0x200);
print "S3$1$addr$3\n";
}
}

39
tools/rbt2c.pl Normal file
View file

@ -0,0 +1,39 @@
#!/usr/bin/perl
# This tool converts a Xilinx xxx.rbt FPGA bitstream to a table that will
# compile as C source code. The output format is DWORDs, MSB first.
print "// Generated by rbt2c.pl, do not edit!\n\n";
for(1..7) {
chomp($_ = <>);
print "//// $_\n";
}
print <<EOT;
#include <proxmark3.h>
const DWORD FpgaImage[] = {
EOT
while(<>) {
chomp;
$v = 0;
for $b (split(//, $_)) {
$v <<= 1;
if($b eq '1') {
$v |= 1;
} elsif($b ne '0') {
die;
}
}
printf("\t0x%08x,\n", $v);
}
print <<EOT;
};
const DWORD FpgaImageLen = sizeof(FpgaImage) / sizeof(FpgaImage[0]);
EOT

35
tools/srecswap.pl Normal file
View file

@ -0,0 +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";
}