imgtools/romtools/maksym/maksymrofs.pl
changeset 590 360bd6b35136
parent 0 044383f39525
child 654 7c11c3d8d025
equal deleted inserted replaced
588:c7c26511138f 590:360bd6b35136
    18 require 5.003_07;
    18 require 5.003_07;
    19 no strict 'vars';
    19 no strict 'vars';
    20 use English;
    20 use English;
    21 use FindBin;		# for FindBin::Bin
    21 use FindBin;		# for FindBin::Bin
    22 
    22 
    23 my $PerlLibPath;    # fully qualified pathname of the directory containing our Perl modules
    23 # Version
    24 
    24 my $MajorVersion = 1;
    25 BEGIN {
    25 my $MinorVersion = 1;
    26     # check user has a version of perl that will cope require 5.005_03;
    26 my $PatchVersion = 0;
    27     # establish the path to the Perl libraries: currently the same directory as this script
       
    28     $PerlLibPath = $FindBin::Bin; # X:/epoc32/tools
       
    29     $PerlLibPath =~ s/\//\\/g;	# X:\epoc32\tools
       
    30     $PerlLibPath .= "\\";
       
    31 }
       
    32 
       
    33 use lib $PerlLibPath;
       
    34 use Modload;
       
    35 Load_SetModulePath($PerlLibPath);
       
    36 
    27 
    37 # Globals
    28 # Globals
    38 my $maksym = "";
    29 my $maksym = "";
    39 my $rofsbuild;
    30 my $rofsbuild;
    40 my $debug = 0;
    31 my $debug = 0;
   192 				
   183 				
   193 				# it is possible that there will be more than one entry in a log file for a
   184 				# it is possible that there will be more than one entry in a log file for a
   194 				# particular address, this is because aliases are included.
   185 				# particular address, this is because aliases are included.
   195 				# The following code checks that the correct function (i.e. the one with
   186 				# The following code checks that the correct function (i.e. the one with
   196 				# non-zero size) is being included in the symbol file.
   187 				# non-zero size) is being included in the symbol file.
   197 				if(exists $syms{$addr})
   188                                 if($addr > 0) {
   198 				{ # an entry at this address exists, replace if it is an alias
   189                                     if( ! defined $baseOffset ) {
   199 					if( ($size != 0) && ($addr > 0) )
   190                                         $baseOffset = $addr;
   200 					{
   191                                     }
   201 						if( ! defined $baseOffset )
   192                                     # no entry at this address so create one regardless of whether size is zero
   202 						{
   193                                     # an entry at this address exists, replace if it is an alias
   203 							$baseOffset = $addr;
   194                                     if( (! exists $syms{$addr-$baseOffset}) || !($size eq "0000")) {
   204 						}
   195                                         $syms{$addr - $baseOffset} = "$size    $sym $section";
   205 						$syms{$addr - $baseOffset} = "$size    $sym $section";
   196                                     }
   206 					}
   197                                 }
   207 				}
       
   208 				else
       
   209 				{ # no entry at this address so create one regardless of whether size is zero
       
   210 					if( $addr > 0 )
       
   211 					{
       
   212 						if( ! defined $baseOffset )
       
   213 						{
       
   214 							$baseOffset = $addr;
       
   215 						}	
       
   216 						$syms{$addr - $baseOffset} = "$size    $sym $section";
       
   217 					}
       
   218 				}
       
   219 
       
   220 			}
   198 			}
   221 		}
   199 		}
   222 
   200 
   223 		# Write symbols in address order
   201 		# Write symbols in address order
   224 		my @addrs = sort CompareAddrs keys %syms;
   202 		my @addrs = sort CompareAddrs keys %syms;
   314 
   292 
   315 	while (@ARGV) 
   293 	while (@ARGV) 
   316 	{
   294 	{
   317 		$arg = shift @ARGV;
   295 		$arg = shift @ARGV;
   318 
   296 
   319 		if ($arg=~/^[\-\/](\S*)$/) 
   297 		if ($arg=~/^[\-](\S*)$/) 
   320 		{
   298 		{
   321 			$flag=$1;
   299 			$flag=$1;
   322 
   300 
   323 			if ($flag=~/^[\?h]$/i) 
   301 			if ($flag=~/^[\?h]$/i) 
   324 			{
   302 			{
   359 
   337 
   360 sub help ()
   338 sub help ()
   361 {
   339 {
   362 	my $build;
   340 	my $build;
   363 
   341 
   364 	&Load_ModuleL('E32TPVER');
   342 	print "\nmaksymrofs - Produce symbolic information given a ROFS image V${MajorVersion}.${MinorVersion}.${PatchVersion}\n";
   365 	print "\nmaksymrofs - Produce symbolic information given a ROFS image (Build ",
       
   366 	&E32tpver, ")\n";
       
   367 	&usage;
   343 	&usage;
   368 	exit 0;
   344 	exit 0;
   369 }
   345 }
   370 
   346 
   371 sub usage ()
   347 sub usage ()