]> git.zerfleddert.de Git - proxmark3-svn/blob - tools/merge-srec.pl
Added tiread command to demod TI tags on the PM3
[proxmark3-svn] / tools / merge-srec.pl
1 # merge the code that initially executes out of flash with the RAM image
2
3 ($flashFile, $ramFile) = @ARGV;
4
5 open(FLASH, $flashFile) or die "$flashFile: $!\n";
6
7 while(<FLASH>) {
8 print if /^S3/;
9 $EOF_record = $_ if /^S[789]/;
10 }
11
12 open(RAM, $ramFile) or die "$ramFile: $!\n";
13
14 while(<RAM>) {
15 if(/^S3(..)(........)(.*)([0-9a-fA-F]{2})/) {
16 $addr = sprintf('%08X', hex($2) - 0x00200000 + 0x200);
17 $line = "$1$addr$3";
18 $checksum = 0;
19 $checksum += $_ foreach map(hex, unpack("a2"x40, $line));
20 print "S3$line", sprintf("%02X", ($checksum%256)^0xff ), "\n";
21 }
22 }
23 print $EOF_record;
Impressum, Datenschutz