# HG changeset patch # User Shabe Razvi # Date 1277734852 -3600 # Node ID 99e0f09d12c30cf7a269426e82ec652df9a787fb # Parent cc88aabd867b5229d63d9b98d4cfc91904ec4618# Parent 23c4ec5a1df9114b6d284a4cb0f38f827ebef235 Merge diff -r cc88aabd867b -r 99e0f09d12c3 bsptemplate/asspandvariant/template_variant/bld.inf --- a/bsptemplate/asspandvariant/template_variant/bld.inf Wed Jun 09 10:31:37 2010 +0100 +++ b/bsptemplate/asspandvariant/template_variant/bld.inf Mon Jun 28 15:20:52 2010 +0100 @@ -109,6 +109,7 @@ PRJ_EXTENSIONS +#if 0 // Removing changes associated with introduction of bootstrap.flm - see Bug 2149 #ifdef SBSV2 // If using SBSv2 with bootstrap FLM, MEMMODEL MUST begin with a capital letter start extension base.bootstrap bootstrap @@ -130,6 +131,9 @@ end #else // !SBSV2 +#endif // more workaround - close the #ifdef SBSV2 here, to regain the other bit +#endif // first part of workaround - close the #ifdef 0 + start extension base/bootstrap bootstrap @@ -149,4 +153,5 @@ end +#if 0 // second part of workaround - avoid dangling #endif #endif // !SBSV2 diff -r cc88aabd867b -r 99e0f09d12c3 kernel/eka/compsupp/bld.inf diff -r cc88aabd867b -r 99e0f09d12c3 kernel/eka/compsupp/gcce/gcce.h --- a/kernel/eka/compsupp/gcce/gcce.h Wed Jun 09 10:31:37 2010 +0100 +++ b/kernel/eka/compsupp/gcce/gcce.h Mon Jun 28 15:20:52 2010 +0100 @@ -97,6 +97,7 @@ // __NAKED__ from cpudefs.h #define __NAKED__ __declspec(naked) #define ____ONLY_USE_NAKED_IN_CIA____ __declspec(naked) +#define __WEAK__ __attribute__((weak)) // Int64 and Uint64 from nkern\nklib.h typedef long long Int64; diff -r cc88aabd867b -r 99e0f09d12c3 kernel/eka/compsupp/rvct.h --- a/kernel/eka/compsupp/rvct.h Wed Jun 09 10:31:37 2010 +0100 +++ b/kernel/eka/compsupp/rvct.h Mon Jun 28 15:20:52 2010 +0100 @@ -116,6 +116,7 @@ // __NAKED__ from cpudefs.h #define __NAKED__ __asm #define ____ONLY_USE_NAKED_IN_CIA____ __asm +#define __WEAK__ __attribute__((weak)) // Int64 and Uint64 from nkern\nklib.h typedef long long Int64; diff -r cc88aabd867b -r 99e0f09d12c3 kernel/eka/drivers/pbus/mmc/sdcard/eabi/sdcard3c/epbusmu.def diff -r cc88aabd867b -r 99e0f09d12c3 kernel/eka/euser/epoc/arm/uc_dll.cpp --- a/kernel/eka/euser/epoc/arm/uc_dll.cpp Wed Jun 09 10:31:37 2010 +0100 +++ b/kernel/eka/euser/epoc/arm/uc_dll.cpp Mon Jun 28 15:20:52 2010 +0100 @@ -44,11 +44,11 @@ return 0; } -#elif defined(__ARMCC__) +#elif defined(__EABI__) void __DLL_Export_Table__(void); void __cpp_initialize__aeabi_(void); -__weak void run_static_dtors(void); +__WEAK__ void run_static_dtors(void); GLDEF_C TInt _E32Dll_Body(TInt aReason) { diff -r cc88aabd867b -r 99e0f09d12c3 kernel/eka/euser/epoc/arm/uc_exe.cpp --- a/kernel/eka/euser/epoc/arm/uc_exe.cpp Wed Jun 09 10:31:37 2010 +0100 +++ b/kernel/eka/euser/epoc/arm/uc_exe.cpp Mon Jun 28 15:20:52 2010 +0100 @@ -70,11 +70,11 @@ } } -#elif defined(__ARMCC__) +#elif defined(__EABI__) TInt CallThrdProcEntry(TInt (*aFn)(void*), void* aPtr, TInt aNotFirst); -__weak void run_static_dtors(void); +__WEAK__ void run_static_dtors(void); void globalDestructorFunc() { diff -r cc88aabd867b -r 99e0f09d12c3 kernel/eka/generic.inf --- a/kernel/eka/generic.inf Wed Jun 09 10:31:37 2010 +0100 +++ b/kernel/eka/generic.inf Mon Jun 28 15:20:52 2010 +0100 @@ -17,6 +17,10 @@ // // +PRJ_EXPORTS +rombuild/rom.flm /epoc32/tools/makefile_templates/base/rom.flm +rombuild/rom.meta /epoc32/tools/makefile_templates/base/rom.meta +rombuild/rom.xml /epoc32/tools/makefile_templates/base/rom.xml PRJ_EXTENSIONS start extension base/genexec diff -r cc88aabd867b -r 99e0f09d12c3 kernel/eka/include/e32def.h --- a/kernel/eka/include/e32def.h Wed Jun 09 10:31:37 2010 +0100 +++ b/kernel/eka/include/e32def.h Mon Jun 28 15:20:52 2010 +0100 @@ -446,7 +446,7 @@ #if __GNUC__ < 4 #define _FOFF(c,f) (((TInt)&(((c *)0x1000)->f))-0x1000) #else -#define _FOFF(c,f) __builtin_offsetof(c,f) +#define _FOFF(c,f) (__builtin_offsetof(c,f)) #endif #endif diff -r cc88aabd867b -r 99e0f09d12c3 kernel/eka/kernel/arm/d_entry.cpp --- a/kernel/eka/kernel/arm/d_entry.cpp Wed Jun 09 10:31:37 2010 +0100 +++ b/kernel/eka/kernel/arm/d_entry.cpp Mon Jun 28 15:20:52 2010 +0100 @@ -49,11 +49,11 @@ return KernelModuleEntry(aReason); } -#elif defined(__ARMCC__) +#elif defined(__EABI__) void __DLL_Export_Table__(void); void __cpp_initialize__aeabi_(void); -__weak void run_static_dtors(void); +__WEAK__ void run_static_dtors(void); GLDEF_C TInt _E32Dll_Body(TInt aReason) // diff -r cc88aabd867b -r 99e0f09d12c3 kernel/eka/kernel/arm/k_entry.cia --- a/kernel/eka/kernel/arm/k_entry.cia Wed Jun 09 10:31:37 2010 +0100 +++ b/kernel/eka/kernel/arm/k_entry.cia Mon Jun 28 15:20:52 2010 +0100 @@ -71,7 +71,7 @@ asm("__CtorList: "); asm(".word __CTOR_LIST__ "); } -#elif defined(__ARMCC__) +#elif defined(__EABI__) void __DLL_Export_Table__(void); void __cpp_initialize__aeabi_(); @@ -80,7 +80,7 @@ void __record_needed_destruction (void * d){} // 2.1 calls __aeabi_atexit passing __dso_handle. This can be a dummy (i.e. just a label) -__asm void __dso_handle(void) {} +__NAKED__ void __dso_handle(void) {} void __aeabi_atexit(void *object, void (*dtor)(void *), void *handle){} void _E32Startup_Body(TLinAddr aRomHeader, TLinAddr aSuperPage); diff -r cc88aabd867b -r 99e0f09d12c3 kernel/eka/kernel/arm/l_entry.cia --- a/kernel/eka/kernel/arm/l_entry.cia Wed Jun 09 10:31:37 2010 +0100 +++ b/kernel/eka/kernel/arm/l_entry.cia Mon Jun 28 15:20:52 2010 +0100 @@ -19,7 +19,7 @@ extern "C" { -#if defined(__ARMCC__) +#if defined(__EABI__) void __DLL_Export_Table__(void); #endif diff -r cc88aabd867b -r 99e0f09d12c3 kernel/eka/kernel/arm/v_entry.cpp --- a/kernel/eka/kernel/arm/v_entry.cpp Wed Jun 09 10:31:37 2010 +0100 +++ b/kernel/eka/kernel/arm/v_entry.cpp Mon Jun 28 15:20:52 2010 +0100 @@ -46,7 +46,7 @@ return KErrGeneral; } -#elif defined(__ARMCC__) +#elif defined(__EABI__) void __DLL_Export_Table__(void); void __cpp_initialize__aeabi_(); @@ -55,7 +55,7 @@ // needs destruction. But kernel side static objects will never need this so, define it as a nop void __record_needed_destruction (void * d){} // 2.1 calls __aeabi_atexit passing __dso_handle. This can just be a label since its not used -__asm void __dso_handle(void) {} +__NAKED__ void __dso_handle(void) {} void __aeabi_atexit(void *object, void (*dtor)(void *), void *handle){} GLDEF_C TInt _E32Dll_Body(TInt aReason) diff -r cc88aabd867b -r 99e0f09d12c3 kernel/eka/kernel/arm/x_entry.cpp --- a/kernel/eka/kernel/arm/x_entry.cpp Wed Jun 09 10:31:37 2010 +0100 +++ b/kernel/eka/kernel/arm/x_entry.cpp Mon Jun 28 15:20:52 2010 +0100 @@ -41,7 +41,7 @@ return KernelModuleEntry(aReason); } -#elif defined(__ARMCC__) +#elif defined(__EABI__) void __DLL_Export_Table__(void); void __cpp_initialize__aeabi_(); @@ -50,7 +50,7 @@ // needs destruction. But the kernel never will need this so, define it as a nop void __record_needed_destruction (void * d){} // 2.1 calls __aeabi_atexit passing __dso_handle. This can just be a label since its not used. -__asm void __dso_handle(void){} +__NAKED__ void __dso_handle(void){} void __aeabi_atexit(void *object, void (*dtor)(void *), void *handle){} GLDEF_C TInt _E32Dll_Body(TInt aReason) diff -r cc88aabd867b -r 99e0f09d12c3 kernel/eka/nkern/arm/nk_entry.cia --- a/kernel/eka/nkern/arm/nk_entry.cia Wed Jun 09 10:31:37 2010 +0100 +++ b/kernel/eka/nkern/arm/nk_entry.cia Mon Jun 28 15:20:52 2010 +0100 @@ -80,7 +80,7 @@ asm("__CtorList: "); asm(".word __CTOR_LIST__ "); } -#elif defined(__ARMCC__) +#elif defined(__EABI__) void __DLL_Export_Table__(void); void __cpp_initialize__aeabi_(); @@ -89,7 +89,7 @@ void __record_needed_destruction (void * d){} // 2.1 calls __aeabi_atexit passing __dso_handle. This can be a dummy (i.e. just a label) -__asm void __dso_handle(void) {} +__NAKED__ void __dso_handle(void) {} void __aeabi_atexit(void *object, void (*dtor)(void *), void *handle){} void _E32Startup_Body(TLinAddr aRomHeader, TLinAddr aSuperPage); diff -r cc88aabd867b -r 99e0f09d12c3 kernel/eka/personality/example/personality.h --- a/kernel/eka/personality/example/personality.h Wed Jun 09 10:31:37 2010 +0100 +++ b/kernel/eka/personality/example/personality.h Mon Jun 28 15:20:52 2010 +0100 @@ -41,6 +41,8 @@ typedef unsigned int size_t; #elif defined(__ARMCC__) typedef unsigned int size_t; +#elif defined(__GCCE__) +typedef unsigned int size_t; #endif #ifdef __cplusplus diff -r cc88aabd867b -r 99e0f09d12c3 kernel/eka/rombuild/e32tests.oby --- a/kernel/eka/rombuild/e32tests.oby Wed Jun 09 10:31:37 2010 +0100 +++ b/kernel/eka/rombuild/e32tests.oby Mon Jun 28 15:20:52 2010 +0100 @@ -28,6 +28,7 @@ // And now the tests #include + #if defined(SYMBIAN_INCLUDE_USB_OTG_HOST) #include "t_usbdi_helper.iby" #include "t_otgdi_helper.iby" @@ -35,10 +36,11 @@ #include #endif +/* #ifndef VARIANT_PATH #include #else #define inc(a,b,c) #include inc(rom##E32PATH##,VARIANT_PATH,\test\##MAIN##test.iby) #endif - +*/ diff -r cc88aabd867b -r 99e0f09d12c3 kernel/eka/rombuild/f32tests.oby --- a/kernel/eka/rombuild/f32tests.oby Wed Jun 09 10:31:37 2010 +0100 +++ b/kernel/eka/rombuild/f32tests.oby Mon Jun 28 15:20:52 2010 +0100 @@ -33,15 +33,17 @@ // Include e32 and f32 tests #include +/* #ifndef VARIANT_PATH #include #else #define inc(a,b,c) #include inc(rom##E32PATH##,VARIANT_PATH,\test\##MAIN##test.iby) #endif +*/ #include -#include +//#include // Required for t_pageldrtst data=EPOCROOT##Epoc32\Release\##MAIN##\##BUILD##\d_exc.exe \sys\bin\d_exc.exe diff -r cc88aabd867b -r 99e0f09d12c3 kernel/eka/rombuild/rom.flm --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/kernel/eka/rombuild/rom.flm Mon Jun 28 15:20:52 2010 +0100 @@ -0,0 +1,40 @@ +# +# Copyright (c) 2009 Symbian. All rights reserved. +# + +# macro for all the rules +define rom + +FINAL:: +ifeq ($(OSTYPE),unix) + $(call startrule,rom) \ + echo "This is not supported currently"; \ + $(call endrule,rom) +else + $(call startrule,rom) \ + $(PERL) $(EPOCROOT)/sf/os/kernelhwsrv/kernel/eka/rombuild/rom_sbs.pl --variant=$(REE_TARGET) --inst=$(PLATFORM) --build=$(CFG) --type=$(TYPE) --clean --name=$(REE_TARGET)_$(TYPE)_$(PLATFORM)_$(CFG).img \ + $(call endrule,rom) +endif + +FINAL:: + $(call startrule,copy) \ + mv rom.oby $(EPOCROOT)/epoc32/rom/$(REE_TARGET)/$(REE_TARGET)_$(TYPE)_$(PLATFORM)_$(CFG)_rom.oby; \ + mv ROMBUILD.LOG $(EPOCROOT)/epoc32/rom/$(REE_TARGET)/$(REE_TARGET)_$(TYPE)_$(PLATFORM)_$(CFG)_ROMBUILD.LOG; \ + mv $(REE_TARGET)_$(TYPE)_$(PLATFORM)_$(CFG).img $(EPOCROOT)/epoc32/rom/$(REE_TARGET)_$(TYPE)_$(PLATFORM)_$(CFG).img; \ + $(call endrule,copy) + +endef + +# expand +$(eval $(rom)) + +# The items produced by this FLM: +RELEASEABLES:=$(EPOCROOT)/epoc32/rom/$(REE_TARGET)/$(REE_TARGET)_$(TYPE)_$(PLATFORM)_$(CFG)_rom.oby $(EPOCROOT)/epoc32/rom/$(REE_TARGET)/$(REE_TARGET)_$(TYPE)_$(PLATFORM)_$(CFG)_ROMBUILD.LOG $(EPOCROOT)/epoc32/rom/$(REE_TARGET)_$(TYPE)_$(PLATFORM)_$(CFG).img + +## What targets -- declare the files produced here +$(eval $(call whatmacro, $(RELEASEABLES))) +## Clean up +$(eval $(call GenerateStandardCleanTarget, $(RELEASEABLES))) + + + diff -r cc88aabd867b -r 99e0f09d12c3 kernel/eka/rombuild/rom.meta --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/kernel/eka/rombuild/rom.meta Mon Jun 28 15:20:52 2010 +0100 @@ -0,0 +1,10 @@ +# Meta information for the syborg extension template +# +# Copyright (c) 2009 Symbian Foundation Ltd. All rights reserved. +# + +platform armv5 +makefile gnumake +techstream base + + diff -r cc88aabd867b -r 99e0f09d12c3 kernel/eka/rombuild/rom.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/kernel/eka/rombuild/rom.xml Mon Jun 28 15:20:52 2010 +0100 @@ -0,0 +1,26 @@ + + + + + + + + + + diff -r cc88aabd867b -r 99e0f09d12c3 kernel/eka/rombuild/rom_sbs.pl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/kernel/eka/rombuild/rom_sbs.pl Mon Jun 28 15:20:52 2010 +0100 @@ -0,0 +1,875 @@ +#!perl +# +# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +# All rights reserved. +# This component and the accompanying materials are made available +# under the terms of the License "Eclipse Public License v1.0" +# which accompanies this distribution, and is available +# at the URL "http://www.eclipse.org/legal/epl-v10.html". +# +# Initial Contributors: +# Nokia Corporation - initial contribution. +# +# Contributors: +# +# Description: +# + +# rom.pl - Build a rom +# +# Pre-processes the .oby/iby files then invokes rombuild.exe +# (or other specified builder) + +# First, read our config file + +use strict; +use Getopt::Long; +use Cwd; + +#Getopt::Long::Configure("ignore_case"); +my %opts=(); +my $param_count = scalar(@ARGV); +my $result = GetOptions (\%opts, "assp=s", + "inst=s", + "type=s", + "variant=s", + "build=s", + "conf=s", + "name=s", + "modules=s", + "xabi=s", + "clean", + "quiet", + "help", + "_debug", + "zip", + "symbol", + "noheader", + "kerneltrace=s", + "rombuilder=s", + "define=s@", + "rofsbuilder=s", + "compress", + ); + +my (@assps, @builds, %variants, @templates, %flags, %insts, %zip, %builder); +my $main; +my $kmain; +my $toroot; +my $e32path; +my $rombuildpath; +my $euserdir; +my $elocldir; +my $kbdir; +my $romname; +my $single; +my $smain; +my $pagedCode; +my $debug = $opts{_debug}; +my $quiet; +$quiet = $opts{quiet} unless $debug; + +my $drive; + +# discover where this script is running from to set the $toroot and $e32path variables + +my $toolpath; +my $Epoc32Path; +my $EpocRoot; +my $drive; +my $BasePath; + +BEGIN { + + $EpocRoot = $ENV{EPOCROOT}; + die "ERROR: Must set the EPOCROOT environment variable.\n" if (!defined($EpocRoot)); + print "Environmental epocroot - >$EpocRoot<\n"; + $EpocRoot =~ s-/-\\-go; # for those working with UNIX shells + if ($EpocRoot =~ /^([a-z]:)(.*)$/i) + { + # Raptor style: Drive letter and trailing \\ removed + $drive = $1; + $EpocRoot = "$2\\"; + $ENV{EPOCROOT} = $EpocRoot; + } + die "ERROR: EPOCROOT must be an absolute path, " . + "not containing a drive letter.\n" if ($EpocRoot !~ /^\\/); + die "ERROR: EPOCROOT must not be a UNC path.\n" if ($EpocRoot =~ /^\\\\/); + die "ERROR: EPOCROOT must end with a backslash.\n" if ($EpocRoot !~ /\\$/); + die "ERROR: EPOCROOT must specify an existing directory.\n" if (!-d $EpocRoot); + + # The cpp needed a drive apparently + my $cwd = Cwd::cwd(); + $cwd =~ /^(.)/; + $drive = "$1:" unless $drive; + print "epocroot = >$EpocRoot<\n"; + print "drive = >$drive<\n"; + + my $fp0 = $0; + $cwd =~ s/\//\\/g; + $fp0 =~ s/\//\\/g; + unless ($fp0 =~ /^([A-Za-z]:)?\\/) { + if ($cwd =~ /\\$/) { + $fp0 = "$cwd$fp0"; + } else { + $fp0 = "$cwd\\$fp0"; + } + } + + my @path = split(/\\/, $cwd); + shift(@path); + $toroot = ('..\\') x @path; + $e32path = $fp0; + $e32path =~ s/\\kernelhwsrv\\kernel\\eka\\rombuild\\rom\.pl$//i; + $e32path =~ s/^[A-Za-z]://; + $rombuildpath = $toroot."sf\\os\\kernelhwsrv\\kernel\\eka\\rombuild"; + $Epoc32Path = $toroot; + $Epoc32Path =~ s/\\$//; + $Epoc32Path .= $EpocRoot . "epoc32"; + $toolpath = "$Epoc32Path\\tools\\"; + push @INC, $toolpath; + $BasePath = $toroot . $e32path; +} + +use E32Plat; +{ + Plat_Init($toolpath); +} + +if ($debug) { + print "EpocRoot = $EpocRoot\n"; + print "Epoc32Path = $Epoc32Path\n"; + print "drive = $drive\n"; + print "toolpath = $toolpath\n"; + print "toroot = $toroot\n"; + print "e32path = $e32path\n"; + print "rombuildpath = $rombuildpath\n"; + print "BasePath = $BasePath\n"; +} + +my $cppflags="-P -undef -traditional -lang-c++ -nostdinc -iwithprefixbefore $rombuildpath -I $rombuildpath -I $drive$Epoc32Path "; + +# Include variant hrh file defines when processing oby and ibys with cpp +# (Code copied from \\EPOC\master\cedar\generic\tools\romkit\tools\buildrom.pm - +# it used relative path to the working dir but we are using absolute path seems neater) +use E32Variant; +use Pathutl; +my $variantMacroHRHFile = Variant_GetMacroHRHFile(); +if($variantMacroHRHFile){ + # Using absolute paths so must include drive letter otherwise cpp will fail + # Also adding the directory containing the HRH file to main includes paths in + # case it includes files + my $variantFilePath = Path_Split('Path',$variantMacroHRHFile); + $cppflags .= " -I $drive$variantFilePath -include $drive$variantMacroHRHFile"; +} + +if($param_count == 0 || $opts{'help'} || !$result) { + usage(); + exit 0; +} + +# Now check that the options we have make sense + +checkopts(); + +if (!$quiet) { + print "Starting directory: ", Cwd::cwd(), "\n"; + print < rom1.tmp") || die "Can't open output file, $!"; + +# First output the ROM name +print OUT "\nromname=$romname\n"; +while() { + s/\#\#ASSP\#\#/$opts{'assp'}/; + s/\#\#VARIANT\#\#/$opts{'variant'}/; + s/\#\#BUILD\#\#/$opts{'build'}/; + s/\#\#MAIN\#\#/$main/; + s/\#\#KMAIN\#\#/$kmain/; + s/\#\#E32PATH\#\#/$e32path/; + s/\#\#BASEPATH\#\#/$BasePath/; + s/\#\#EUSERDIR\#\#/$euserdir/; + s/\#\#ELOCLDIR\#\#/$elocldir/; + s/\#\#KBDIR\#\#/$kbdir/; + print OUT; +} + +close X; +close OUT; + +# Use cpp to pull in include chains and replace defines + +my $defines = ""; +$defines .= "-D MAIN=$main "; +$defines .= "-D KMAIN=$kmain "; +$defines .= "-D EUSERDIR=$euserdir "; +$defines .= "-D ELOCLDIR=$elocldir "; +$defines .= "-D E32PATH=$e32path "; +$defines .= "-D BASEPATH=$BasePath "; +$defines .= "-D EPOCROOT=$EpocRoot "; +$defines .= "-D SMAIN=$smain " if $smain; + +foreach (@{$opts{'define'}}) { + my @array=split(/,/,$_); + foreach (@array) { + $defines.="-D ".uc $_." "; + $pagedCode = 1 if $_ eq 'PAGED_CODE'; + } + } + +if ($opts{'modules'}) { + my @array=split(/,/,$opts{'modules'}); + foreach (@array) { + $defines.="-D ".uc $_." "; + } + } + +foreach (keys %opts) { + next if ($_ eq 'name'); + next if ($_ eq 'modules'); + next if ($_ eq 'zip'); + next if ($_ eq 'symbol'); + next if ($_ eq 'kerneltrace'); + next if ($_ eq 'define'); + $defines.="-D ".uc $_."=".$opts{$_}." "; + $defines.="-D ".uc $_."_".$opts{$_}." "; +} + +$defines.="-D SINGLE " if ($single); + +sub IsRVCTBuild($) { + my ($build)=@_; + return 1 if ($build =~ /^ARMV/i); + my @customizations = Plat_Customizations('ARMV5'); + return 1 if (grep /$build/, @customizations); + return 0; +} + +$defines.="-D RVCT " if (IsRVCTBuild($main)); + +print "Using defines $defines\n" if !$quiet; + +my $ret=1; +my $cppcmd; +if($opts{'build'}=~/^u/i) { + # Unicode build + $cppcmd = "$Epoc32Path/gcc/bin/cpp $cppflags -D UNICODE $defines rom1.tmp rom2.tmp"; +} else { + $cppcmd = "cpp $cppflags $defines rom1.tmp rom2.tmp"; +} +print "Executing CPP:\n\t$cppcmd\n" if $debug; +$ret = system($cppcmd); +die "ERROR EXECUTING CPP\n" if $ret; + +# Zap any ## marks REMS or blank lines + +cleanup("rom2.tmp", "rom3.tmp", $k); + +# scan tmp file and generate auxiliary files, if required +open TMP, "rom3.tmp" or die("Can't open rom3.tmp\n"); +my $line; +while ($line=) + { + if ($line=~/\s*gentestpaged/i) { + genfile("paged"); } + if ($line=~/\s*gentestnonpaged/i) { + genfile("nonpaged"); } + } + +parsePatchData("rom3.tmp", "rom4.tmp"); + +# break down the oby file into rom, rofs and extensions oby files + +my $oby_index =0; +my $dumpfile="rom.oby"; +my $rofs=0; +my $extension=0; +my $corerofsname=""; +open DUMPFILE, ">$dumpfile" or die("Can't create $dumpfile\n"); +my $line; +open TMP, "rom4.tmp" or die("Can't open rom4.tmp\n"); +while ($line=) + { + if ($line=~/^\s*rofsname/i) + { + close DUMPFILE; # close rom.oby or previous rofs#/extension#.oby + $oby_index=1; + $corerofsname=$line; + $corerofsname =~ s/rofsname\s*=\s*//i; # save core rofs name + $corerofsname =~ s/\s*$//g; # remove trailing \n + unlink $corerofsname || print "unable to delete $corerofsname"; + my $dumpfile="rofs".$rofs.".oby"; + $rofs++; + open DUMPFILE, ">$dumpfile" or (close TMP and die("Can't create $dumpfile\n")); + } + + if ($line=~/^\s*coreimage/i) + { + close DUMPFILE; # close rofs.oby + if ($oby_index ne 1) { + close TMP; + die "Must specify ROFS image before ROFS extension\n"; + } + my $name=$line; + $name =~ s/coreimage\s*=\s*//i; # read core rofs name + $name =~ s/\s*$//g; # remove trailing \n + if ($name ne $corerofsname) { + close TMP; + die "This extension does not relate to previous ROFS\n"; + } + $oby_index=33; # open window + my $dumpfile="extension".$extension.".oby"; + $extension++; + open DUMPFILE, ">$dumpfile" or (close TMP and die("Can't create $dumpfile\n")); + } + + if ($line=~/^\s*extensionrofs/i) + { + $oby_index=3 if ($oby_index eq 2); + } + + if (($oby_index eq 2) && !($line=~/^\s*$/)) { + close TMP; + die "Bad ROFS extension specification\n"; + } + print DUMPFILE $line; + $oby_index=2 if ($oby_index eq 33); # close window + } +close DUMPFILE; +close TMP; + +# 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 +# is automatically put into rofs +rename('rom.oby', 'rom4.tmp') || die; + +open(IN, 'rom4.tmp') || die "Can't read rom4.tmp"; +open(ROM, '>rom.oby') || die "Can't write to rom.oby"; + +if ($oby_index >= 1 && $pagedCode) { + open(ROFS, '>>rofs0.oby') || die "Can't append to rofs0.oby"; +} + +while ($line=) +{ + if(($oby_index >= 1) && ($pagedCode) && ($line=~/^\s*data\s*=/) && !($line=~/\.*paging_unmovable\s*/)) { + print ROFS $line; + } + else { + $line=~s/paging_unmovable//; + print ROM $line; + } +} + +close IN; +close ROM; + +if ($oby_index >= 1 && $pagedCode) { + close ROFS; +} + unlink 'rom4.tmp'; + +my $flags; + +foreach (@{$flags{$opts{'assp'}}}) { + $flags.=" -$_"; +} + +if($opts{'noheader'}) { + $flags.=" -no-header"; +} + +if($opts{'compress'}) { + $flags.=" -compress"; +} + +my $builder = $opts{'rombuilder'}; +$builder = "rombuild" unless ($builder); + + + +print "$builder $flags -type-safe-link -S rom.oby 2>&1\n\n"; + +open(Y, "$builder $flags -type-safe-link -S rom.oby 2>&1 |") || + die "Can't start $builder command, $!"; + +my $nerrors=0; +my $nwarnings=0; + +while() { + my $error=(/^error:/i); + my $warning=(/^warning:/i); + print if ($error or $warning or !$quiet); + $nerrors++ if ($error); + $nwarnings++ if ($warning); +} + +print "\nGenerated .oby file is rom.oby\n" if !$quiet; +print "\nGenerated image file is $romname\n" if (!$nerrors); + +my$rerrors; +my $rofsbuilder; +if ($rofs) { + $rofsbuilder = $opts{'rofsbuilder'}; + $rofsbuilder = "rofsbuild" unless ($rofsbuilder); + for(my $i=0;$i<$rofs;++$i) { + print "Executing $rofsbuilder on main rofs\n" if !$quiet; + my $image="rofs".$i.".oby"; + system("$rofsbuilder $image"); + if ($? != 0) + { + print "$rofsbuilder $image returned $?\n"; + $rerrors++; + } + rename "rofsbuild.log", "rofs$i.log" + } +} + +if ($rofs and $extension) { + for(my $i=0;$i<$extension;++$i) { + print "Executing $rofsbuilder on extension rofs\n" if !$quiet; + my $image="extension".$i.".oby"; + system("$rofsbuilder $image"); + if ($? != 0) + { + print "$rofsbuilder $image returned $?\n"; + $rerrors++; + } + rename "rofsbuild.log", "extension$i.log" + } +} + +if ($nerrors) { + print "\n\n Errors found during $builder!!\n\nLeaving tmp files\n"; +} elsif ($nwarnings) { + print "\n\n Warnings during $builder!!\n\nLeaving tmp files\n"; +} elsif ($rerrors) { + print "\n\n Errors during $rofsbuilder!!\n\nLeaving tmp files\n"; +} else { + unlink glob("*.tmp") if !$debug; +} +if ($opts{zip} or $zip{$opts{assp}}) { + my $zipname=$romname; + $zipname =~ s/\.(\w+)$/\.zip/i; + unlink $zipname; + system("zip $zipname $romname"); +} +if ($opts{symbol}) { + my $logname=$romname; + $logname =~ s/\.(\w+)$/\.log/i; + my $obyname=$romname; + $obyname =~ s/\.(\w+)$/\.oby/i; + unlink $logname; + unlink $obyname; + system("rename rombuild.log $logname"); + system("rename rom.oby $obyname"); + system("maksym $logname"); +} + +if ($nerrors || $nwarnings || $rerrors) { + exit 4; +} + +exit 0; + + +################################ Subroutines ################################## + +sub usage { + print < + +Generate a rom image for the specified target, along with a rom.oby file +that can be fed to (a) rombuild to regenerate the image. + +The following options are required: + --variant= e.g. --variant=assabet + --inst= e.g. --inst=arm4 + --build= e.g. --build=udeb + --type= + tshell for a text shell rom + e32tests for a rom with e32tests + f32tests for rom with f32tests + alltests for all the tests + +The following are optional: + --name= Give image file specified name + --noheader Pass -no-header option on to rombuild + --help This help message. + --clean Remove existing generated files first + --quiet Be less verbose + --modules= List of additional modules for this ROM + --define= List of CPP macros to define + +Options may be specified as a short abbreviation +e.g. -b udeb instead of --build udeb + +EOT +} + +sub cleanup($$$) { + my ($in, $out, $k) = @_; + my ($line, $lastblank); + + open(OUTPUT_FILE, "> $out") or die "Cannot open $out for output"; + open(INPUT_FILE, "< $in") or die "Cannot open for $in input"; + + while ($line=) { + $line=~s/##//g; + + # file=\epoc32\... ==> file=%EPOCROOT%\epoc32\... + $line =~ s/(=\s*)\\epoc32/\1${EpocRoot}Epoc32/i; + + # Now compress blank lines down to one + + if($line=~/^\s*$/) { + if($lastblank) { + # Do nothing + } else { + # This is the first blank line + $lastblank=1; + print OUTPUT_FILE $line; + } + } else { + # Not blank + $lastblank=0; + if ($k and $line=~/^\s*kerneltrace/i) { + $line = "kerneltrace $k\n"; + } + print OUTPUT_FILE $line if !($line=~/^\s*REM\s+/i); + } + } + close(INPUT_FILE); + close(OUTPUT_FILE); +} + +sub IsSmp($) { + my %SmpKernelDirs=( + 'x86smp' => 1, + 'x86gmp' => 1, + 'arm4smp' => 1, + 'armv4smp' => 1, + 'armv5smp' => 1 + ); + + my ($kdir) = @_; + return $SmpKernelDirs{lc $kdir}; +} + +sub checkopts { + unless($opts{variant}) { die "No Variant specified"; } + $opts{'build'}="UDEB" unless($opts{'build'}); + $opts{'type'}="TSHELL" unless($opts{'type'}); + $opts{'inst'}="ARM4" unless($opts{'inst'}); + + my $additional; + if ($opts{'modules'}) { + $additional="_".$opts{modules}; + $additional=~ s/,/_/ig; + } + my $build=lc $opts{build}; + my $inst=uc $opts{'inst'}; + if ($inst eq "MARM") { + # Hackery to cope with old compiler + $main="MARM"; + $euserdir="MARM"; + $elocldir="MARM"; + } + else { + $main=$inst; + if ($main eq "THUMB") { + $euserdir="ARMI"; + } else { + $euserdir=$main; + } + if ($main eq "ARMI" or $main eq "THUMB") { + $elocldir="ARM4"; + } else { + $elocldir=$main; + } + } + $kmain = $opts{'xabi'}; + $kmain = $main unless ($kmain); + if (IsSmp($kmain)) { + $euserdir = $kmain; + } + if ($opts{name}) { + $romname=$opts{name}; + } else { + $romname=uc($opts{variant}.$additional.$main); + if ($build=~/^\w*DEB$/i) { + $romname.='D'; + } + $romname.='.IMG'; + } +} + +sub lookupFileInfo($$) +{ + my ($infile, $fullname) = @_; + + my ($name, $ext) = $fullname =~ /^(.+)\.(\w+)$/ ? ($1, $2) : ($fullname, undef); + + open TMP, $infile or die("Can't open $infile\n"); + while() + { + $_ = lc; + if(/^\s*(\S+)\s*=\s*(\S+)\s+(\S+)/i) + { + my ($src, $dest) = ($2, $3); + + my $destFullname = $dest =~ /^.*\\(.+)$/ ? $1 : $dest; + my ($destName, $destExt) = $destFullname =~ /^(.+?)\.(\w+)$/ ? ($1, $2) : ($destFullname, undef); + + if ($destName eq $name && (!$ext || $ext eq $destExt)) + { + close TMP; + return ($src, $dest); + } + } + } + + die "patchdata: Can't find file $fullname\n"; +} + +sub lookupSymbolInfo($$) +{ + my ($file, $name) = @_; + + open TMP, $file or die "Can't read $file\n"; + + # ignore local symbols. + while ( !~ /Global Symbols/) { } + + while () + { + if (/^\s*(\S+)\s+(\S+)\s+data\s+(\S+)/i) + { + my ($symbol, $addr, $size) = ($1, $2, $3); + if ($symbol eq $name) + { + close TMP; + return ($addr, $size); + } + } + + # This is a quick fix for RVCT 3.1, which uses the text "(EXPORTED)" + # in the map file. Here is an example: + # + # KHeapMinCellSize (EXPORTED) 0x0003d81c Data 4 mem.o(.constdata) + # + elsif (/^\s*(\S+)\s+\(exported\)\s+(\S+)\s+data\s+(\S+)/i) + { + my ($symbol, $addr, $size) = ($1, $2, $3); + if ($symbol eq $name) + { + close TMP; + return ($addr, $size); + } + } + } + + die "patchdata: Can't find symbol $name\n"; +} + +sub parsePatchData($$) +{ + my ($infile, $outfile) = @_; + + open IN, $infile or die("Can't read $infile\n"); + open OUT, ">$outfile" or die("Can't write $outfile\n"); + + my $line; + while($line = ) + { + if ($line =~ /^\s*patchdata\s+(.+?)\s*$/i) + { + if ($1 !~ /(\S+)\s*@\s*(\S+)\s+(\S+)\s*$/) + { + die "Bad patchdata command: $line\n"; + } + + my ($file, $symbol, $value) = (lc $1, $2, $3); + my ($srcFile, $destFile) = lookupFileInfo($infile, $file); + my ($index, $elementSize) = (undef, undef); + if ($symbol =~ s/:(\d+)\[(\d+)\]$//) + { + ($index, $elementSize) = ($2, $1); + $index = hex($index) if $index =~ /^0x/i; + } + + if ($srcFile =~ /\\armv5(smp)?\\/i) + { + my ($symbolAddr, $symbolSize) = lookupSymbolInfo("$srcFile.map", $symbol); + + my $max; + if (defined($index)) + { + my $bytes; + $bytes = 1, $max = 0xff if $elementSize == 8; + $bytes = 2, $max = 0xffff if $elementSize == 16; + $bytes = 4, $max = 0xffffffff if $elementSize == 32; + die("patchdata: invalid element size $elementSize: $line\n") unless defined($bytes); + + if ($bytes > 1 && (($symbolSize & ($bytes-1)) != 0)) + { + die("patchdata: unexpected symbol size $symbolSize for array $symbol ($elementSize-bit elements)\n"); + } + + if ($index >= int($symbolSize / $bytes)) + { + die("patchdata: index $index out of bounds for $symbol of $symbolSize bytes ($elementSize-bit elements)\n"); + } + + $symbolAddr = hex($symbolAddr) if $symbolAddr =~ /^0x/i; + $symbolAddr += $index * $bytes; + $symbolAddr = sprintf("0x%x", $symbolAddr); + + $symbolSize = $bytes; + } + elsif ($symbolSize == 1) { $max = 0xff; } + elsif ($symbolSize == 2) { $max = 0xffff; } + elsif ($symbolSize == 4) { $max = 0xffffffff; } + else { die "patchdata: Unexpected symbol size $symbolSize for $symbol\n"; } + + $value = hex($value) if $value =~ /^0x/i; + if ($value > $max) + { + print("Warning: Value overflow of $symbol\n"); + $value &= $max; + } + $value = sprintf("0x%08x", $value); + + $line = "patchdata $destFile addr $symbolAddr $symbolSize $value\n"; + } + else + { + $line = ""; + } + + } + + print OUT $line; + } + + close IN; + close OUT; +} + +sub genfile { + my $count=0; + if($_[0] eq 'paged') { + my $file='gentestpaged.txt'; + unlink $file; + open(OUTFILE, ">$file") or die "Can't open output file, $!"; + for(my $i=0;$i<50000;++$i) { + if(($i >5) && ($i % 40 ==0)) { + print OUTFILE "\n"; + $count++; + } + if(($i+$count) % 5 ==0) { + print OUTFILE "SATOR "; + } + if(($i+$count) % 5 ==1) { + print OUTFILE "AREPO "; + } + if(($i+$count) % 5 ==2) { + print OUTFILE "TENET "; + } + if(($i+$count) % 5 ==3) { + print OUTFILE "OPERA "; + } + if(($i+$count) % 5 ==4) { + print OUTFILE "ROTAS "; + } + } + } else { + my $file='gentestnonpaged.txt'; + unlink $file; + open(OUTFILE, ">$file") or die "Can't open output file, $!"; + for(my $i=0;$i<20000;++$i) { + if(($i >5) && ($i % 40 ==0)) { + print OUTFILE "\n"; + $count++; + } + if(($i+$count) % 4 ==0) { + print OUTFILE "STEP "; + } + if(($i+$count) % 4 ==1) { + print OUTFILE "TIME "; + } + if(($i+$count) % 4 ==2) { + print OUTFILE "EMIT "; + } + if(($i+$count) % 4 ==3) { + print OUTFILE "PETS "; + } + } + } +} + +__END__ + +# Tell emacs that this is a perl script even 'though it has a .bat extension +# Local Variables: +# mode:perl +# tab-width:4 +# End: + diff -r cc88aabd867b -r 99e0f09d12c3 kerneltest/e32utils/group/bld.inf diff -r cc88aabd867b -r 99e0f09d12c3 userlibandfileserver/fileserver/sfile/sf_func.h --- a/userlibandfileserver/fileserver/sfile/sf_func.h Wed Jun 09 10:31:37 2010 +0100 +++ b/userlibandfileserver/fileserver/sfile/sf_func.h Mon Jun 28 15:20:52 2010 +0100 @@ -918,9 +918,12 @@ public: static TInt Initialise(CFsRequest* aRequest); static TInt DoRequestL(CFsRequest* aRequest); + +#ifndef __GCCE__ // GCC does not like AddFsToCompositeMountL() being private #ifndef __GCC32__ // GCC does not like AddFsToCompositeMountL() being private private: #endif +#endif static void AddFsToCompositeMountL(TInt aDriveNumber, CFileSystem& aFileSystem, TInt aLocalDriveNumber); };