kernel/eka/rombuild/rom_sbs.pl
author Arnaud Lenoir
Wed, 24 Mar 2010 19:33:09 +0000
branchRCL_3
changeset 82 3ef8482ae3ed
permissions -rw-r--r--
Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
82
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
     1
#!perl
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
     2
#
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
     3
# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
     4
# All rights reserved.
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
     5
# This component and the accompanying materials are made available
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
     6
# under the terms of the License "Eclipse Public License v1.0"
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
     7
# which accompanies this distribution, and is available
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
     8
# at the URL "http://www.eclipse.org/legal/epl-v10.html".
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
     9
#
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
    10
# Initial Contributors:
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
    11
# Nokia Corporation - initial contribution.
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
    12
#
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
    13
# Contributors:
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
    14
#
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
    15
# Description:
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
    16
#
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
    17
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
    18
# rom.pl - Build a rom
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
    19
#
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
    20
# Pre-processes the .oby/iby files then invokes rombuild.exe
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
    21
# (or other specified builder)
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
    22
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
    23
# First, read our config file
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
    24
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
    25
use strict;
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
    26
use Getopt::Long;
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
    27
use Cwd;
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
    28
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
    29
#Getopt::Long::Configure("ignore_case");
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
    30
my %opts=();
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
    31
my $param_count = scalar(@ARGV);
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
    32
my $result = GetOptions (\%opts, "assp=s",
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
    33
						 "inst=s",
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
    34
						 "type=s",
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
    35
						 "variant=s",
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
    36
						 "build=s", 
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
    37
						 "conf=s",
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
    38
						 "name=s",
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
    39
						 "modules=s",
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
    40
						 "xabi=s",
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
    41
						 "clean",
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
    42
						 "quiet",
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
    43
						 "help",
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
    44
						 "_debug",
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
    45
						 "zip",
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
    46
						 "symbol",
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
    47
						 "noheader",
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
    48
						 "kerneltrace=s",
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
    49
						 "rombuilder=s",
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
    50
						 "define=s@",
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
    51
						 "rofsbuilder=s",
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
    52
						 "compress",
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
    53
						 );
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
    54
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
    55
my (@assps, @builds, %variants, @templates, %flags, %insts, %zip, %builder);
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
    56
my $main;
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
    57
my $kmain;
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
    58
my $toroot;
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
    59
my $e32path;
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
    60
my $rombuildpath;
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
    61
my $euserdir;
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
    62
my $elocldir;
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
    63
my $kbdir;
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
    64
my $romname;
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
    65
my $single;
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
    66
my $smain;
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
    67
my $pagedCode;
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
    68
my $debug = $opts{_debug};
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
    69
my $quiet;
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
    70
$quiet = $opts{quiet} unless $debug;
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
    71
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
    72
my $drive;
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
    73
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
    74
# discover where this script is running from to set the $toroot and $e32path variables
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
    75
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
    76
my $toolpath;
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
    77
my $Epoc32Path;
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
    78
my $EpocRoot;
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
    79
my $drive;
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
    80
my $BasePath;
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
    81
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
    82
BEGIN {
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
    83
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
    84
	$EpocRoot = $ENV{EPOCROOT};
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
    85
	die "ERROR: Must set the EPOCROOT environment variable.\n" if (!defined($EpocRoot));
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
    86
	print "Environmental epocroot - >$EpocRoot<\n";
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
    87
	$EpocRoot =~ s-/-\\-go;	# for those working with UNIX shells
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
    88
	if ($EpocRoot =~ /^([a-z]:)(.*)$/i)
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
    89
	{
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
    90
		# Raptor style: Drive letter and trailing \\ removed
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
    91
		$drive = $1;
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
    92
		$EpocRoot = "$2\\";
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
    93
		$ENV{EPOCROOT} = $EpocRoot;
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
    94
	}
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
    95
	die "ERROR: EPOCROOT must be an absolute path, " .
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
    96
		"not containing a drive letter.\n" if ($EpocRoot !~ /^\\/);
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
    97
	die "ERROR: EPOCROOT must not be a UNC path.\n" if ($EpocRoot =~ /^\\\\/);
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
    98
	die "ERROR: EPOCROOT must end with a backslash.\n" if ($EpocRoot !~ /\\$/);
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
    99
	die "ERROR: EPOCROOT must specify an existing directory.\n" if (!-d $EpocRoot);
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   100
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   101
	# The cpp needed a drive apparently
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   102
	my $cwd = Cwd::cwd();
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   103
	$cwd =~ /^(.)/;
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   104
	$drive = "$1:" unless $drive;
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   105
	print "epocroot = >$EpocRoot<\n";
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   106
	print "drive = >$drive<\n";
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   107
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   108
	my $fp0 = $0;
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   109
	$cwd =~ s/\//\\/g;
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   110
	$fp0 =~ s/\//\\/g;
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   111
	unless ($fp0 =~ /^([A-Za-z]:)?\\/) {
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   112
		if ($cwd =~ /\\$/) {
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   113
			$fp0 = "$cwd$fp0";
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   114
		} else {
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   115
			$fp0 = "$cwd\\$fp0";
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   116
		}
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   117
	}
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   118
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   119
	my @path = split(/\\/, $cwd);
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   120
	shift(@path);
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   121
	$toroot = ('..\\') x @path;
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   122
	$toroot =~ s/\\$//;
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   123
	#e32path supposed to be = to "\sf\os"
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   124
	$e32path = $fp0;
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   125
	$e32path =~ s/\\kernelhwsrv\\kernel\\eka\\rombuild\\rom_sbs\.pl$//i;
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   126
	$e32path =~ s/^[A-Za-z]://;
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   127
	$rombuildpath = $toroot."\\sf\\os\\kernelhwsrv\\kernel\\eka\\rombuild";
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   128
	$Epoc32Path = $toroot;
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   129
	$Epoc32Path =~ s/\\$//;
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   130
	$Epoc32Path .= $EpocRoot . "epoc32";
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   131
	$toolpath = "$Epoc32Path\\tools\\";
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   132
	push @INC, $toolpath;
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   133
	$BasePath = $toroot . $e32path."\\";
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   134
}
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   135
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   136
use E32Plat;
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   137
{
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   138
        Plat_Init($toolpath);
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   139
}
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   140
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   141
if ($debug) {
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   142
	print "EpocRoot = $EpocRoot\n";
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   143
	print "Epoc32Path = $Epoc32Path\n";
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   144
	print "drive = $drive\n";
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   145
	print "toolpath = $toolpath\n";
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   146
	print "toroot = $toroot\n";
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   147
	print "e32path = $e32path\n";
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   148
	print "rombuildpath = $rombuildpath\n";
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   149
	print "BasePath = $BasePath\n";
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   150
}
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   151
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   152
my $cppflags="-P -undef -traditional -lang-c++ -nostdinc -iwithprefixbefore $rombuildpath -I $rombuildpath -I $drive$Epoc32Path ";
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   153
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   154
# Include variant hrh file defines when processing oby and ibys with cpp
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   155
# (Code copied from \\EPOC\master\cedar\generic\tools\romkit\tools\buildrom.pm -
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   156
# it used relative path to the working dir but we are using absolute path seems neater)
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   157
use E32Variant;
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   158
use Pathutl;
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   159
my $variantMacroHRHFile = Variant_GetMacroHRHFile();
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   160
if($variantMacroHRHFile){
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   161
	# Using absolute paths so must include drive letter otherwise cpp will fail
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   162
	# Also adding the directory containing the HRH file to main includes paths in
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   163
	# case it includes files
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   164
	my $variantFilePath = Path_Split('Path',$variantMacroHRHFile);
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   165
	$cppflags .= " -I $drive$variantFilePath -include $drive$variantMacroHRHFile";
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   166
}
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   167
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   168
if($param_count == 0 || $opts{'help'} || !$result) {
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   169
	usage();
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   170
	exit 0;
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   171
}
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   172
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   173
# Now check that the options we have make sense
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   174
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   175
checkopts();
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   176
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   177
if (!$quiet) {
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   178
	print "Starting directory: ", Cwd::cwd(), "\n";
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   179
	print <<EOF;
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   180
OPTIONS:
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   181
\tTYPE: $opts{'type'}
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   182
\tVARIANT: $opts{'variant'}
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   183
\tINSTRUCTION SET: $opts{'inst'}
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   184
\tBUILD: $opts{'build'}
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   185
\tMODULES: $opts{'modules'}
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   186
EOF
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   187
}
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   188
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   189
#Pick out the type file
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   190
my $skel;
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   191
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   192
if (-e "$opts{'type'}.oby") {
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   193
	$skel="$opts{'type'}.oby";
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   194
} elsif (-e "$rombuildpath\\$opts{'type'}.oby") {
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   195
	$skel="$rombuildpath\\$opts{'type'}.oby";
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   196
} else {
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   197
	die "Can't find type file for type $opts{'type'}, $!";
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   198
}
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   199
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   200
print "Using type file $skel\n" if !$quiet;
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   201
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   202
# If clean is specified, zap all the image and .oby files
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   203
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   204
if($opts{'clean'}) {
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   205
	unlink glob("*.img");
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   206
	unlink "rom.oby";
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   207
	unlink "rombuild.log";
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   208
	unlink glob("*.rofs");
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   209
	unlink "rofsbuild.log";
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   210
}
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   211
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   212
# Now pre-pre-process this file to point to the right places for .ibys
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   213
# Unfortunately cpp won't do macro replacement in #include strings, so
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   214
# we have to do it by hand
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   215
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   216
my $k = $opts{kerneltrace};
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   217
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   218
if ($opts{assp}=~/^m(\S+)/i) {
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   219
	$kbdir="kb$1";
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   220
	$kbdir="kbarm" if (lc $1 eq 'eig');
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   221
} else {
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   222
	$kbdir="kb$opts{assp}";
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   223
}
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   224
$single=1 if ($opts{assp}=~/^s(\S+)/i);
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   225
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   226
if ($single) {
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   227
	# Hackery to cope with old compiler
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   228
	if ($main eq 'MARM') {
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   229
		$smain='SARM';
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   230
	} else {
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   231
		$smain="S$main";
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   232
	}
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   233
} else {
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   234
	$smain=$main;
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   235
}
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   236
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   237
open(X, "$skel") || die "Can't open type file $skel, $!";
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   238
open(OUT, "> rom1.tmp") || die "Can't open output file, $!";
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   239
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   240
# First output the ROM name
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   241
print OUT "\nromname=$romname\n";
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   242
# Go through the iby file passed as parameter of this script and replace flags by proper values before copying the line in rom1.tmp.
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   243
while(<X>) {
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   244
	s/\#\#ASSP\#\#/$opts{'assp'}/;
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   245
	s/\#\#VARIANT\#\#/$opts{'variant'}/;
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   246
	s/\#\#BUILD\#\#/$opts{'build'}/;
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   247
	s/\#\#MAIN\#\#/$main/;
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   248
	s/\#\#KMAIN\#\#/$kmain/;
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   249
	s/\#\#E32PATH\#\#/$e32path/;
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   250
	s/\#\#BASEPATH\#\#/$BasePath/;
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   251
	s/\#\#EUSERDIR\#\#/$euserdir/;
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   252
	s/\#\#ELOCLDIR\#\#/$elocldir/;
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   253
	s/\#\#KBDIR\#\#/$kbdir/;
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   254
	print OUT;
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   255
}
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   256
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   257
close X;
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   258
close OUT;
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   259
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   260
# Use cpp to pull in include chains and replace defines
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   261
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   262
my $defines = "";
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   263
$defines .= "-D MAIN=$main ";
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   264
$defines .= "-D KMAIN=$kmain ";
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   265
$defines .= "-D EUSERDIR=$euserdir ";
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   266
$defines .= "-D ELOCLDIR=$elocldir ";
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   267
$defines .= "-D E32PATH=$e32path ";
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   268
$defines .= "-D BASEPATH=$BasePath ";
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   269
$defines .= "-D EPOCROOT=$EpocRoot ";
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   270
$defines .= "-D SMAIN=$smain " if $smain;
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   271
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   272
foreach (@{$opts{'define'}}) {
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   273
	my @array=split(/,/,$_);
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   274
	foreach (@array) {
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   275
		$defines.="-D ".uc $_." ";
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   276
		$pagedCode = 1 if $_ eq 'PAGED_CODE';
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   277
		}
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   278
	}
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   279
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   280
if ($opts{'modules'}) {
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   281
	my @array=split(/,/,$opts{'modules'});
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   282
	foreach (@array) {
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   283
		$defines.="-D ".uc $_." ";
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   284
		}
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   285
	}
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   286
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   287
foreach (keys %opts) {
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   288
	next if ($_ eq 'name');
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   289
	next if ($_ eq 'modules');
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   290
	next if ($_ eq 'zip');
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   291
	next if ($_ eq 'symbol');
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   292
	next if ($_ eq 'kerneltrace');
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   293
	next if ($_ eq 'define');
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   294
	$defines.="-D ".uc $_."=".$opts{$_}." ";
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   295
	$defines.="-D ".uc $_."_".$opts{$_}." ";
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   296
}
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   297
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   298
$defines.="-D SINGLE " if ($single);
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   299
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   300
sub IsRVCTBuild($) {
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   301
    my ($build)=@_;
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   302
    return 1 if ($build =~ /^ARMV/i);
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   303
	my @customizations = Plat_Customizations('ARMV5');
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   304
	return 1 if (grep /$build/, @customizations);
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   305
	return 0;
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   306
}
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   307
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   308
$defines.="-D RVCT " if (IsRVCTBuild($main));
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   309
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   310
print "Using defines $defines\n" if !$quiet;
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   311
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   312
my $ret=1;
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   313
my $cppcmd;
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   314
if($opts{'build'}=~/^u/i) {
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   315
	# Unicode build
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   316
	$cppcmd = "$Epoc32Path/gcc/bin/cpp $cppflags -D UNICODE $defines rom1.tmp rom2.tmp";
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   317
} else {
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   318
	$cppcmd = "$Epoc32Path/gcc/bin/cpp $cppflags $defines rom1.tmp rom2.tmp";
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   319
}
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   320
print "Executing CPP:\n\t$cppcmd\n" if $debug;
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   321
$ret = system($cppcmd);
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   322
die "ERROR EXECUTING CPP\n" if $ret;
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   323
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   324
# Zap any ## marks REMS or blank lines
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   325
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   326
cleanup("rom2.tmp", "rom3.tmp", $k);
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   327
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   328
# scan tmp file and generate auxiliary files, if required
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   329
open TMP, "rom3.tmp" or die("Can't open rom3.tmp\n");
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   330
my $line;
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   331
while ($line=<TMP>)
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   332
	{
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   333
	if ($line=~/\s*gentestpaged/i) {
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   334
		genfile("paged");	}
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   335
	if ($line=~/\s*gentestnonpaged/i) {
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   336
		genfile("nonpaged");	}
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   337
	}
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   338
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   339
parsePatchData("rom3.tmp", "rom4.tmp");
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   340
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   341
# break down the oby file into rom, rofs and extensions oby files
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   342
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   343
my $oby_index =0;
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   344
my $dumpfile="rom.oby";
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   345
my $rofs=0;
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   346
my $extension=0;
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   347
my $corerofsname="";
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   348
open DUMPFILE, ">$dumpfile" or die("Can't create $dumpfile\n");
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   349
my $line;
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   350
open TMP, "rom4.tmp" or die("Can't open rom4.tmp\n");
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   351
while ($line=<TMP>)
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   352
	{
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   353
	if ($line=~/^\s*rofsname/i)
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   354
		{
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   355
		close DUMPFILE;							# close rom.oby or previous rofs#/extension#.oby
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   356
		$oby_index=1;
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   357
		$corerofsname=$line;
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   358
		$corerofsname =~ s/rofsname\s*=\s*//i;		# save core rofs name
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   359
		$corerofsname =~ s/\s*$//g; 			# remove trailing \n
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   360
		unlink $corerofsname || print "unable to delete $corerofsname";
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   361
		my $dumpfile="rofs".$rofs.".oby";
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   362
		$rofs++;
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   363
		open DUMPFILE, ">$dumpfile" or (close TMP and die("Can't create $dumpfile\n"));
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   364
		}
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   365
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   366
	if ($line=~/^\s*coreimage/i)
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   367
		{
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   368
		close DUMPFILE;							# close rofs.oby
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   369
		if ($oby_index ne 1) {
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   370
			close TMP;
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   371
			die "Must specify ROFS image before ROFS extension\n";
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   372
		}
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   373
		my $name=$line;
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   374
		$name =~ s/coreimage\s*=\s*//i;		# read core rofs name
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   375
		$name =~ s/\s*$//g; 			# remove trailing \n
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   376
		if ($name ne $corerofsname) {
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   377
			close TMP;
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   378
			die "This extension does not relate to previous ROFS\n";
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   379
		}
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   380
		$oby_index=33;						# open window
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   381
		my $dumpfile="extension".$extension.".oby";
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   382
		$extension++;
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   383
		open DUMPFILE, ">$dumpfile" or (close TMP and die("Can't create $dumpfile\n"));
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   384
		}
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   385
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   386
	if ($line=~/^\s*extensionrofs/i)
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   387
		{
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   388
		$oby_index=3 if ($oby_index eq 2);
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   389
		}
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   390
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   391
	if (($oby_index eq 2) && !($line=~/^\s*$/)) {
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   392
		close TMP;
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   393
		die "Bad ROFS extension specification\n";
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   394
	}
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   395
	print DUMPFILE $line;
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   396
	$oby_index=2 if ($oby_index eq 33);		# close window
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   397
	}
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   398
close DUMPFILE;
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   399
close TMP;
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   400
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   401
# For paged roms that use rofs, move all data= lines in rom which are not 'paging_unmovable' to rofs, so that paged ram-loaded code
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   402
# is automatically put into rofs
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   403
rename('rom.oby', 'rom4.tmp') || die;
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   404
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   405
open(IN, 'rom4.tmp') || die "Can't read rom4.tmp";
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   406
open(ROM, '>rom.oby') || die "Can't write to rom.oby";
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   407
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   408
if ($oby_index >= 1 && $pagedCode)	{
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   409
	open(ROFS, '>>rofs0.oby') || die "Can't append to rofs0.oby";
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   410
}
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   411
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   412
while ($line=<IN>)
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   413
{
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   414
	if(($oby_index >= 1) && ($pagedCode) && ($line=~/^\s*data\s*=/) && !($line=~/\.*paging_unmovable\s*/)) {
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   415
		print ROFS $line;
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   416
	}
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   417
	else {
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   418
		$line=~s/paging_unmovable//;
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   419
		print ROM $line;
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   420
	}
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   421
}
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   422
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   423
close IN;
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   424
close ROM;
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   425
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   426
if ($oby_index >= 1 && $pagedCode)	{
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   427
	close ROFS;
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   428
}
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   429
	unlink 'rom4.tmp';
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   430
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   431
my $flags;
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   432
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   433
foreach (@{$flags{$opts{'assp'}}}) {
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   434
	$flags.=" -$_";
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   435
}
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   436
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   437
if($opts{'noheader'}) {
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   438
	$flags.=" -no-header";
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   439
}
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   440
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   441
if($opts{'compress'}) {
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   442
	$flags.=" -compress";
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   443
}
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   444
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   445
my $builder = $opts{'rombuilder'};
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   446
$builder = "rombuild" unless ($builder);
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   447
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   448
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   449
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   450
print "$builder $flags -type-safe-link -S rom.oby 2>&1\n\n";
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   451
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   452
open(Y, "$builder $flags -type-safe-link -S rom.oby 2>&1 |") || 
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   453
	die "Can't start $builder command, $!";
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   454
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   455
my $nerrors=0;
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   456
my $nwarnings=0;
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   457
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   458
while(<Y>) {
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   459
	my $error=(/^error:/i);
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   460
	my $warning=(/^warning:/i);
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   461
	print if ($error or $warning or !$quiet);
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   462
	$nerrors++ if ($error);
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   463
	$nwarnings++ if ($warning);
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   464
}
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   465
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   466
print "\nGenerated .oby file is rom.oby\n" if !$quiet;
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   467
print "\nGenerated image file is $romname\n" if (!$nerrors);
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   468
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   469
my$rerrors;
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   470
my $rofsbuilder;
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   471
if ($rofs) {
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   472
	$rofsbuilder = $opts{'rofsbuilder'};
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   473
	$rofsbuilder = "rofsbuild" unless ($rofsbuilder);
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   474
	for(my $i=0;$i<$rofs;++$i) {
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   475
		print "Executing $rofsbuilder on main rofs\n" if !$quiet;
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   476
		my $image="rofs".$i.".oby";
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   477
		system("$rofsbuilder $image");
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   478
		if ($? != 0)
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   479
			{
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   480
			print "$rofsbuilder $image returned $?\n";
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   481
			$rerrors++;
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   482
			}
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   483
		rename "rofsbuild.log", "rofs$i.log"
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   484
		}
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   485
}
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   486
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   487
if ($rofs and $extension) {
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   488
	for(my $i=0;$i<$extension;++$i) {
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   489
		print "Executing $rofsbuilder on extension rofs\n" if !$quiet;
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   490
		my $image="extension".$i.".oby";
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   491
		system("$rofsbuilder $image");
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   492
		if ($? != 0)
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   493
			{
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   494
			print "$rofsbuilder $image returned $?\n";
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   495
			$rerrors++;
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   496
			}
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   497
		rename "rofsbuild.log", "extension$i.log"
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   498
		}
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   499
}
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   500
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   501
if ($nerrors) {
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   502
	print "\n\n Errors found during $builder!!\n\nLeaving tmp files\n";
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   503
} elsif ($nwarnings) {
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   504
	print "\n\n Warnings during $builder!!\n\nLeaving tmp files\n";
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   505
} elsif ($rerrors) {
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   506
	print "\n\n Errors during $rofsbuilder!!\n\nLeaving tmp files\n";
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   507
} else {
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   508
	unlink glob("*.tmp") if !$debug;
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   509
}
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   510
if ($opts{zip} or $zip{$opts{assp}}) {
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   511
	my $zipname=$romname;
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   512
	$zipname =~ s/\.(\w+)$/\.zip/i;
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   513
	unlink $zipname;
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   514
	system("zip $zipname $romname");
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   515
}
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   516
if ($opts{symbol}) {
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   517
	my $logname=$romname;
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   518
	$logname =~ s/\.(\w+)$/\.log/i;
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   519
	my $obyname=$romname;
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   520
	$obyname =~ s/\.(\w+)$/\.oby/i;
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   521
	unlink $logname;
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   522
	unlink $obyname;
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   523
	system("rename rombuild.log $logname");
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   524
	system("rename rom.oby $obyname");
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   525
	system("maksym $logname");
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   526
}
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   527
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   528
if ($nerrors || $nwarnings || $rerrors) {
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   529
	exit 4;
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   530
}	
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   531
	
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   532
exit 0;
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   533
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   534
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   535
################################ Subroutines  ##################################
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   536
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   537
sub usage {
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   538
	print <<EOT;
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   539
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   540
rom <options>
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   541
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   542
Generate a rom image for the specified target, along with a rom.oby file
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   543
that can be fed to (a) rombuild to regenerate the image.
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   544
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   545
The following options are required:
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   546
  --variant=<variant>         e.g. --variant=assabet
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   547
  --inst=<instruction set>    e.g. --inst=arm4
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   548
  --build=<build>             e.g. --build=udeb
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   549
  --type=<type of rom>  
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   550
         tshell for a text shell rom
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   551
         e32tests for a rom with e32tests
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   552
         f32tests for rom with f32tests
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   553
         alltests for all the tests
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   554
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   555
The following are optional:
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   556
  --name=<image name>               Give image file specified name
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   557
  --noheader                        Pass -no-header option on to rombuild
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   558
  --help                            This help message.
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   559
  --clean                           Remove existing generated files first
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   560
  --quiet                           Be less verbose
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   561
  --modules=<comma separated list>  List of additional modules for this ROM
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   562
  --define=<comma separated list>   List of CPP macros to define
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   563
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   564
Options may be specified as a short abbreviation 
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   565
e.g. -b udeb instead of --build udeb
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   566
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   567
EOT
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   568
}
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   569
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   570
sub cleanup($$$) {
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   571
print "What's going on!\n";
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   572
	my ($in, $out, $k) = @_;
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   573
	my ($line, $lastblank);
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   574
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   575
	open(OUTPUT_FILE, "> $out") or die "Cannot open $out for output";
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   576
	open(INPUT_FILE, "< $in") or die "Cannot open for $in input";
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   577
  
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   578
	while ($line=<INPUT_FILE>) {
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   579
		$line=~s/##//g;
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   580
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   581
		# file=\epoc32\...  ==> file=%EPOCROOT%\epoc32\...
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   582
		$line =~ s/(=\s*)\\epoc32/\1${EpocRoot}Epoc32/i;
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   583
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   584
		# Now compress blank lines down to one
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   585
	
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   586
		if($line=~/^\s*$/) {
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   587
			if($lastblank) {
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   588
				# Do nothing
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   589
			} else {
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   590
				# This is the first blank line
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   591
				$lastblank=1;
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   592
				print OUTPUT_FILE $line;
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   593
			}
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   594
		} else {
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   595
			# Not blank
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   596
			$lastblank=0;
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   597
			if ($k and $line=~/^\s*kerneltrace/i) {
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   598
				$line = "kerneltrace $k\n";
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   599
			}
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   600
			
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   601
			# This next line is about converting all the / to \ to make sure that we are using the right format for the build generation	
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   602
			$line =~ s/\//\\/g;
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   603
			
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   604
			print OUTPUT_FILE $line if !($line=~/^\s*REM\s+/i);
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   605
		}
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   606
	}
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   607
	close(INPUT_FILE);
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   608
	close(OUTPUT_FILE);
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   609
}
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   610
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   611
sub IsSmp($) {
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   612
	my %SmpKernelDirs=(
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   613
		'x86smp' => 1,
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   614
		'x86gmp' => 1,
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   615
		'arm4smp' => 1,
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   616
		'armv4smp' => 1,
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   617
		'armv5smp' => 1
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   618
	);
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   619
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   620
	my ($kdir) = @_;
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   621
	return $SmpKernelDirs{lc $kdir};
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   622
}
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   623
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   624
sub checkopts {
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   625
	unless($opts{variant}) { die "No Variant specified"; }
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   626
	$opts{'build'}="UDEB" unless($opts{'build'});
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   627
	$opts{'type'}="TSHELL" unless($opts{'type'});
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   628
	$opts{'inst'}="ARM4" unless($opts{'inst'});
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   629
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   630
	my $additional;
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   631
	if ($opts{'modules'}) {
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   632
		$additional="_".$opts{modules};
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   633
		$additional=~ s/,/_/ig;
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   634
	}
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   635
	my $build=lc $opts{build};
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   636
	my $inst=uc $opts{'inst'};
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   637
	if ($inst eq "MARM") {
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   638
		# Hackery to cope with old compiler
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   639
		$main="MARM";
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   640
		$euserdir="MARM";
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   641
		$elocldir="MARM";
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   642
	}
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   643
	else {
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   644
		$main=$inst;
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   645
		if ($main eq "THUMB") {
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   646
			$euserdir="ARMI";
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   647
		} else {
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   648
			$euserdir=$main;
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   649
		}
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   650
		if ($main eq "ARMI" or $main eq "THUMB") {
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   651
			$elocldir="ARM4";
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   652
		} else {
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   653
			$elocldir=$main;
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   654
		}
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   655
	}
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   656
	$kmain = $opts{'xabi'};
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   657
	$kmain = $main unless ($kmain);
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   658
	if (IsSmp($kmain)) {
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   659
		$euserdir = $kmain;
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   660
	}
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   661
	if ($opts{name}) {
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   662
		$romname=$opts{name};
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   663
	} else {
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   664
		$romname=uc($opts{variant}.$additional.$main);
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   665
		if ($build=~/^\w*DEB$/i) {
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   666
			$romname.='D';
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   667
		}
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   668
		$romname.='.IMG';
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   669
	}
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   670
}
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   671
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   672
sub lookupFileInfo($$)
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   673
{
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   674
	my ($infile, $fullname) = @_;
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   675
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   676
	my ($name, $ext) = $fullname =~ /^(.+)\.(\w+)$/ ? ($1, $2) : ($fullname, undef);
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   677
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   678
	open TMP, $infile or die("Can't open $infile\n");
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   679
	while(<TMP>)
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   680
	{
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   681
		$_ = lc;
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   682
		if(/^\s*(\S+)\s*=\s*(\S+)\s+(\S+)/i)
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   683
		{
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   684
			my ($src, $dest) = ($2, $3);
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   685
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   686
			my $destFullname = $dest =~ /^.*\\(.+)$/ ? $1 : $dest;
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   687
			my ($destName, $destExt) = $destFullname =~ /^(.+?)\.(\w+)$/ ? ($1, $2) : ($destFullname, undef);
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   688
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   689
			if ($destName eq $name && (!$ext || $ext eq $destExt))
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   690
			{
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   691
				close TMP;
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   692
				return ($src, $dest);
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   693
			}
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   694
		}
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   695
	}
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   696
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   697
	die "patchdata: Can't find file $fullname\n";
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   698
}
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   699
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   700
sub lookupSymbolInfo($$)
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   701
{
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   702
	my ($file, $name) = @_;
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   703
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   704
	open TMP, $file or die "Can't read $file\n";
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   705
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   706
	# ignore local symbols.
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   707
	while (<TMP> !~ /Global Symbols/) { }
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   708
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   709
	while (<TMP>)
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   710
	{
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   711
		if (/^\s*(\S+)\s+(\S+)\s+data\s+(\S+)/i)
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   712
		{
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   713
			my ($symbol, $addr, $size) = ($1, $2, $3);
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   714
			if ($symbol eq $name)
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   715
			{
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   716
				close TMP;
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   717
				return ($addr, $size);
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   718
			}
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   719
		}
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   720
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   721
		# This is a quick fix for RVCT 3.1, which uses the text "(EXPORTED)"
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   722
		# in the map file. Here is an example:
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   723
		#
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   724
		# KHeapMinCellSize (EXPORTED) 0x0003d81c Data 4 mem.o(.constdata)
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   725
		#
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   726
		elsif (/^\s*(\S+)\s+\(exported\)\s+(\S+)\s+data\s+(\S+)/i)
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   727
		{
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   728
			my ($symbol, $addr, $size) = ($1, $2, $3);
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   729
			if ($symbol eq $name)
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   730
			{
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   731
				close TMP;
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   732
				return ($addr, $size);
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   733
			}
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   734
		}
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   735
	}
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   736
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   737
	die "patchdata: Can't find symbol $name\n";
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   738
}
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   739
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   740
sub parsePatchData($$)
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   741
{
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   742
	my ($infile, $outfile) = @_;
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   743
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   744
	open IN, $infile or die("Can't read $infile\n");
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   745
	open OUT, ">$outfile" or die("Can't write $outfile\n");
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   746
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   747
	my $line;
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   748
	while($line = <IN>)
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   749
	{
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   750
		if ($line =~ /^\s*patchdata\s+(.+?)\s*$/i)
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   751
		{
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   752
			if ($1 !~ /(\S+)\s*@\s*(\S+)\s+(\S+)\s*$/)
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   753
			{
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   754
				die "Bad patchdata command: $line\n";
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   755
			}
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   756
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   757
			my ($file, $symbol, $value) = (lc $1, $2, $3);
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   758
			my ($srcFile, $destFile) = lookupFileInfo($infile, $file);
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   759
			my ($index, $elementSize) = (undef, undef);
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   760
			if ($symbol =~ s/:(\d+)\[(\d+)\]$//)
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   761
			{
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   762
				($index, $elementSize) = ($2, $1);
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   763
				$index = hex($index) if $index =~ /^0x/i;
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   764
			}
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   765
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   766
			if ($srcFile =~ /\\armv5(smp)?\\/i)
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   767
			{
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   768
				my ($symbolAddr, $symbolSize) = lookupSymbolInfo("$srcFile.map", $symbol);
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   769
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   770
				my $max;
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   771
				if (defined($index))
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   772
				{
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   773
					my $bytes;
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   774
					$bytes = 1, $max = 0xff       if $elementSize ==  8;
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   775
					$bytes = 2, $max = 0xffff     if $elementSize == 16;
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   776
					$bytes = 4, $max = 0xffffffff if $elementSize == 32;
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   777
					die("patchdata: invalid element size $elementSize: $line\n") unless defined($bytes);
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   778
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   779
					if ($bytes > 1 && (($symbolSize & ($bytes-1)) != 0))
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   780
					{
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   781
						die("patchdata: unexpected symbol size $symbolSize for array $symbol ($elementSize-bit elements)\n");
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   782
					}
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   783
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   784
					if ($index >= int($symbolSize / $bytes))
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   785
					{
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   786
						die("patchdata: index $index out of bounds for $symbol of $symbolSize bytes ($elementSize-bit elements)\n");
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   787
					}
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   788
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   789
					$symbolAddr = hex($symbolAddr) if $symbolAddr =~ /^0x/i;
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   790
					$symbolAddr += $index * $bytes;
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   791
					$symbolAddr = sprintf("0x%x", $symbolAddr);
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   792
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   793
					$symbolSize = $bytes;
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   794
				}
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   795
				elsif ($symbolSize == 1) { $max = 0xff; }
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   796
				elsif ($symbolSize == 2) { $max = 0xffff; }
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   797
				elsif ($symbolSize == 4) { $max = 0xffffffff; }
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   798
				else { die "patchdata: Unexpected symbol size $symbolSize for $symbol\n"; }
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   799
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   800
				$value = hex($value) if $value =~ /^0x/i;
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   801
				if ($value > $max)
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   802
				{
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   803
					print("Warning:  Value overflow of $symbol\n");
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   804
					$value &= $max;
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   805
				}					
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   806
				$value = sprintf("0x%08x", $value);
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   807
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   808
				$line = "patchdata $destFile addr $symbolAddr $symbolSize $value\n";
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   809
			}
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   810
			else
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   811
			{
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   812
				$line = "";
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   813
			}
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   814
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   815
		}
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   816
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   817
		print OUT $line;
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   818
	}
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   819
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   820
	close IN;
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   821
	close OUT;
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   822
}
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   823
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   824
sub genfile {
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   825
	my $count=0;
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   826
	if($_[0] eq 'paged') {
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   827
		my $file='gentestpaged.txt';
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   828
		unlink $file;
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   829
		open(OUTFILE, ">$file") or die "Can't open output file, $!";
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   830
		for(my $i=0;$i<50000;++$i) {
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   831
			if(($i >5) && ($i % 40 ==0)) {
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   832
			print OUTFILE "\n";
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   833
			$count++;
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   834
			} 
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   835
			if(($i+$count) % 5 ==0) {
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   836
			print OUTFILE "SATOR ";
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   837
			}
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   838
			if(($i+$count) % 5 ==1) {
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   839
			print OUTFILE "AREPO ";
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   840
			}
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   841
			if(($i+$count) % 5 ==2) {
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   842
			print OUTFILE "TENET ";
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   843
			}
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   844
			if(($i+$count) % 5 ==3) {
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   845
			print OUTFILE "OPERA ";
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   846
			}
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   847
			if(($i+$count) % 5 ==4) {
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   848
			print OUTFILE "ROTAS ";
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   849
			}
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   850
		}
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   851
	} else {
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   852
		my $file='gentestnonpaged.txt';
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   853
		unlink $file;
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   854
		open(OUTFILE, ">$file") or die "Can't open output file, $!";
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   855
		for(my $i=0;$i<20000;++$i) {
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   856
			if(($i >5) && ($i % 40 ==0)) {
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   857
			print OUTFILE "\n";
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   858
			$count++;
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   859
			} 
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   860
			if(($i+$count) % 4 ==0) {
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   861
			print OUTFILE "STEP ";
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   862
			}
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   863
			if(($i+$count) % 4 ==1) {
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   864
			print OUTFILE "TIME ";
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   865
			}
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   866
			if(($i+$count) % 4 ==2) {
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   867
			print OUTFILE "EMIT ";
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   868
			}
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   869
			if(($i+$count) % 4 ==3) {
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   870
			print OUTFILE "PETS ";
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   871
			}
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   872
		}
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   873
	}
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   874
}
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   875
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   876
__END__
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   877
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   878
# Tell emacs that this is a perl script even 'though it has a .bat extension
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   879
# Local Variables:
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   880
# mode:perl
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   881
# tab-width:4
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   882
# End:
3ef8482ae3ed Modify the script to solve problem with e32path and change all / to \ to allow to build rom image without any errors!!
Arnaud Lenoir
parents:
diff changeset
   883