tools/repair_obyfile.pl
changeset 9 b5c893269cd5
parent 8 36cb9eb36988
child 57 a44af1db196f
equal deleted inserted replaced
8:36cb9eb36988 9:b5c893269cd5
    12 #
    12 #
    13 # Description: 
    13 # Description: 
    14 # Process file ROM log to make it suitable for re-use by buildrom.pl
    14 # Process file ROM log to make it suitable for re-use by buildrom.pl
    15 
    15 
    16 use strict;
    16 use strict;
       
    17 use Getopt::Long;
       
    18 
       
    19 my $featurelist = "syborg_stem_features.iby";
       
    20 GetOptions(
       
    21   "f|features=s" => \$featurelist,   # name of featurelist file
       
    22   );
       
    23 
       
    24 print "ROM_IMAGE[0] {\n";
       
    25 print "#include \"$featurelist\"\n";
       
    26 
    17 my $line;
    27 my $line;
    18 
       
    19 while ($line = <>)
    28 while ($line = <>)
    20 	{
    29 	{
    21 	# Put back original auto-btmap statements for any "mbm_rom" derived files
    30 	# Put back original auto-btmap statements for any "mbm_rom" derived files
    22 	$line =~ s/data="(.*mbm)_rom"(\s+)"(.*)"/auto-bitmap=$1$2$3/;
    31 	$line =~ s/data="(.*mbm)_rom"(\s+)"(.*)"/auto-bitmap=$1$2$3/;
    23 	
    32 	
    31 	
    40 	
    32 	if ($line =~ /REM processed spidata/)
    41 	if ($line =~ /REM processed spidata/)
    33 		{
    42 		{
    34 		next;		# discard this line - it will be regenerated by the __ECOM_PLUGIN
    43 		next;		# discard this line - it will be regenerated by the __ECOM_PLUGIN
    35 		}
    44 		}
    36 	
    45 		
    37 	$line =~ s/REM processed //;	# re-enable other directives
    46 	$line =~ s/REM processed //;	# re-enable other directives
    38 	
    47 	
    39 	if ($line =~ /^time=/)
    48 	if ($line =~ /^time=/)
    40 		{
    49 		{
    41 		$line = "time=##TODAY## 12:00:00\n";
    50 		$line = "time=##TODAY## 12:00:00\n";
    42 		}
    51 		}
    43 	
    52 	
       
    53 	# remove lines added by buildrom for generated files
       
    54 	
       
    55 	if ($line =~ /^data=\S+\\([^\\]+)\s+"\S+"/)
       
    56 		{
       
    57 		my $file = $1;
       
    58 		if ($file =~ /features.dat|ecom-\d-\d\.s/)
       
    59 			{
       
    60 			# print STDERR "Discarded: $line";
       
    61 			next;
       
    62 			}
       
    63 		}
       
    64 
       
    65 	if ($line =~ /^REM (ROM_IMAGE\[\d\])$/)
       
    66 		{
       
    67 		$line = "$1 {\n";
       
    68 		print "}\n";		# close the preceeding ROM_IMAGE
       
    69 		}
       
    70 
    44 	print $line;
    71 	print $line;
    45 	}
    72 	}
       
    73 
       
    74 print "}\n";