sbsv1/abld/platform/armutl.pm
changeset 599 fa7a3cc6effd
equal deleted inserted replaced
596:9f25be3da657 599:fa7a3cc6effd
       
     1 # Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 # All rights reserved.
       
     3 # This component and the accompanying materials are made available
       
     4 # under the terms of "Eclipse Public License v1.0"
       
     5 # which accompanies this distribution, and is available
       
     6 # at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 #
       
     8 # Initial Contributors:
       
     9 # Nokia Corporation - initial contribution.
       
    10 #
       
    11 # Contributors:
       
    12 #
       
    13 # Description:
       
    14 # this package does various ancillary things for armedg modules
       
    15 # 
       
    16 #
       
    17 
       
    18 package Armutl;
       
    19 
       
    20 require Exporter;
       
    21 @ISA=qw(Exporter);
       
    22 @EXPORT=qw(
       
    23 	Armutl_Help_Mmp
       
    24 
       
    25 	Armutl_DoMmp
       
    26 
       
    27 	Armutl_ArmIncDir
       
    28 	Armutl_ArmLibList
       
    29 	Armutl_ArmRT
       
    30 	Armutl_AsmFileList
       
    31 	Armutl_ArmVersion
       
    32 	Armutl_RVCTMajorVersion
       
    33 	Armutl_RVCTMinorVersion
       
    34 	Armutl_RVCTPatchLevel
       
    35 	Armutl_RVCTBuildNumber
       
    36 	Armutl_ArmLibDir
       
    37 );
       
    38 
       
    39 use RVCT_plat2set;
       
    40 
       
    41 my $ArmInc='';
       
    42 my @ArmLibList=();
       
    43 my $ArmRT=0;
       
    44 my @AsmFileList=();
       
    45 
       
    46 # make sure that some of the tool subroutines  still work in case of Plat() does not exists in namespace main
       
    47 my $Plat = main::Plat() if defined &main::Plat;
       
    48 
       
    49 my ($RVCTMajorVersion, $RVCTMinorVersion, $RVCTBuildNumber) = RVCT_plat2set::get_version_list($Plat);
       
    50 
       
    51 my $RVCTVersion = "$RVCTMajorVersion.$RVCTMinorVersion";
       
    52 my $RVCTPatchLevel = 0;
       
    53 
       
    54 
       
    55 sub Armutl_Help_Mmp {
       
    56 # provide the help text for START <armedg platforms> END blocks
       
    57 
       
    58 	print
       
    59 		"ARMINC  // include value of RVCT*INC environment variable to search paths\n",
       
    60 		"ARMLIBS // list the ARM supplied libraries to be linked against\n",
       
    61 		"ARMRT   // indicates this target froms part of the runtime and so\n",
       
    62                 "        // shouldn't be linked against itself or other runtime libs\n",
       
    63 	        "ARMNAKEDASM // list .cpp files subject to auto-translation from GCC inline asm to ARM embedded asm\n"
       
    64 	;
       
    65 }
       
    66 
       
    67 sub Armutl_DoMmp (@) { # takes platform text
       
    68 	my @PlatTxt=@_;
       
    69 
       
    70 	my $BaseTrg=&main::BaseTrg;
       
    71 	my $BasicTrgType=&main::BasicTrgType;
       
    72 	my $MakeFilePath=&main::MakeFilePath;
       
    73 	my $MMPFILE=&main::MmpFile;
       
    74 	my @UidList=&main::UidList;
       
    75 
       
    76 	# set up START ARMV5|THUMB2 ... END block module variables
       
    77 	my @MmpWarn=();
       
    78 	my $Line;
       
    79 
       
    80 	LINE: foreach $Line (@PlatTxt) {
       
    81 		my $LineInfo=shift @$Line;
       
    82 		$_=shift @$Line;
       
    83 		if (/^ARMINC$/o) {
       
    84 			$ArmInc = RVCT_plat2set::get_inc_path($Plat);
       
    85 			next LINE;
       
    86 		}
       
    87 		if (/^ARMRT$/o) {
       
    88 		    $ArmRT = 1;
       
    89 		    next LINE;
       
    90 		}
       
    91 		if (/^ARMLIBS$/o) {
       
    92 			my $LibVar = "RVCT${RVCTMajorVersion}${RVCTMinorVersion}LIB";
       
    93 			my $ArmLibDir = RVCT_plat2set::get_lib_path($Plat);
       
    94 
       
    95 			push @MmpWarn, "$LineInfo : No libraries specified for keyword ARMLIBS\n" unless @$Line;
       
    96 
       
    97 			while (@$Line) {
       
    98 			  my $lib = shift @$Line;
       
    99 
       
   100               my $lib_path = RVCT_plat2set::find_lib( $Plat, $lib );
       
   101 
       
   102               if ($lib_path)
       
   103               {
       
   104 				  push @ArmLibList, $lib_path;
       
   105               }
       
   106               else
       
   107               {
       
   108 				  push @MmpWarn, "$LineInfo : arm library file $lib not found.\n" ;
       
   109               }
       
   110 			}
       
   111 			next LINE;
       
   112 		      }
       
   113 		if (/^ARMNAKEDASM$/o) {
       
   114 		    push @MmpWarn, "$LineInfo : No files specified for keyword ARMNAKEDASM\n" unless @$Line;
       
   115 		    push @AsmFileList, @$Line;
       
   116 		    next LINE;
       
   117 		}
       
   118 		push @MmpWarn, "$LineInfo : Unrecognised Keyword \"$_\"\n";
       
   119 	}
       
   120 
       
   121 	undef $Line;
       
   122 	if (@MmpWarn) {
       
   123 		warn
       
   124 			"\nMMPFILE \"$MMPFILE\"\n",
       
   125 			"START .. END BLOCK WARNINGS(S)\n",
       
   126 			@MmpWarn,
       
   127 			"\n"
       
   128 		;
       
   129 	}
       
   130 	undef @MmpWarn;
       
   131     }
       
   132 
       
   133 sub Armutl_ArmIncDir() {
       
   134     $ArmInc;
       
   135 }
       
   136 
       
   137 sub Armutl_ArmLibList() {
       
   138     @ArmLibList;
       
   139 }
       
   140 
       
   141 sub Armutl_ArmRT() {
       
   142     $ArmRT;
       
   143 }
       
   144 
       
   145 sub Armutl_AsmFileList() {
       
   146     @AsmFileList;
       
   147 }
       
   148 
       
   149 sub Armutl_ArmVersion() {
       
   150   return $RVCTVersion;
       
   151 }
       
   152 
       
   153 sub Armutl_RVCTMajorVersion() {
       
   154   return $RVCTMajorVersion;
       
   155 }
       
   156 
       
   157 sub Armutl_RVCTMinorVersion() {
       
   158   return $RVCTMinorVersion;
       
   159 }
       
   160 
       
   161 sub Armutl_RVCTPatchLevel() {
       
   162   return $RVCTPatchLevel;
       
   163 }
       
   164 
       
   165 sub Armutl_RVCTBuildNumber() {
       
   166   return $RVCTBuildNumber;
       
   167 }
       
   168 
       
   169 sub Armutl_ArmLibDir() {
       
   170   my $LibVar = "RVCT${RVCTMajorVersion}${RVCTMinorVersion}LIB";
       
   171   my $ArmLibDir = $ENV{$LibVar};
       
   172   return $ArmLibDir;
       
   173 }
       
   174 
       
   175 1;
       
   176 
       
   177 
       
   178 
       
   179 
       
   180