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