-# merge the code that initially executes out of flash with the RAM image\r
-\r
-($flashFile, $ramFile) = @ARGV;\r
-\r
-open(FLASH, $flashFile) or die "$flashFile: $!\n";\r
-\r
-while(<FLASH>) {\r
- print if /^S3/;\r
- $EOF_record = $_ if /^S[789]/;\r
-}\r
-\r
-open(RAM, $ramFile) or die "$ramFile: $!\n";\r
-\r
-while(<RAM>) {\r
- if(/^S3(..)(........)(.*)([0-9a-fA-F]{2})/) {\r
- $addr = sprintf('%08X', hex($2) - 0x00200000 + 0x200);\r
- $line = "$1$addr$3";\r
- $checksum = 0;\r
- $checksum += $_ foreach map(hex, unpack("a2"x40, $line));\r
- print "S3$line", sprintf("%02X", ($checksum%256)^0xff ), "\n";\r
- }\r
-}\r
-print $EOF_record;\r