sbsv1_os/e32toolp/platform/armutl.pm
changeset 0 83f4b4db085c
child 1 d4b442d23379
equal deleted inserted replaced
-1:000000000000 0:83f4b4db085c
       
     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 strict;
       
    40 use RVCT_plat2set;
       
    41 
       
    42 my $ArmInc='';
       
    43 my @ArmLibList=();
       
    44 my $ArmRT=0;
       
    45 my @AsmFileList=();
       
    46 
       
    47 # make sure that some of the tool subroutines  still work in case of Plat() does not exists in namespace main
       
    48 my $Plat = main::Plat() if defined &main::Plat;
       
    49 
       
    50 my ($RVCTMajorVersion, $RVCTMinorVersion, $RVCTBuildNumber) = RVCT_plat2set::get_version_list($Plat);
       
    51 
       
    52 my $RVCTVersion = "$RVCTMajorVersion.$RVCTMinorVersion";
       
    53 my $RVCTPatchLevel = 0;
       
    54 
       
    55 
       
    56 sub Armutl_Help_Mmp {
       
    57 # provide the help text for START <armedg platforms> END blocks
       
    58 
       
    59 	print
       
    60 		"ARMINC  // include value of RVCT*INC environment variable to search paths\n",
       
    61 		"ARMLIBS // list the ARM supplied libraries to be linked against\n",
       
    62 		"ARMRT   // indicates this target froms part of the runtime and so\n",
       
    63                 "        // shouldn't be linked against itself or other runtime libs\n",
       
    64 	        "ARMNAKEDASM // list .cpp files subject to auto-translation from GCC inline asm to ARM embedded asm\n"
       
    65 	;
       
    66 }
       
    67 
       
    68 sub Armutl_DoMmp (@) { # takes platform text
       
    69 	my @PlatTxt=@_;
       
    70 
       
    71 	my $BaseTrg=&main::BaseTrg;
       
    72 	my $BasicTrgType=&main::BasicTrgType;
       
    73 	my $MakeFilePath=&main::MakeFilePath;
       
    74 	my $MMPFILE=&main::MmpFile;
       
    75 	my @UidList=&main::UidList;
       
    76 
       
    77 	# set up START ARMV5|THUMB2 ... END block module variables
       
    78 	my @MmpWarn=();
       
    79 	my $Line;
       
    80 
       
    81 	LINE: foreach $Line (@PlatTxt) {
       
    82 		my $LineInfo=shift @$Line;
       
    83 		$_=shift @$Line;
       
    84 		if (/^ARMINC$/o) {
       
    85 			$ArmInc = RVCT_plat2set::get_inc_path($Plat);
       
    86 			next LINE;
       
    87 		}
       
    88 		if (/^ARMRT$/o) {
       
    89 		    $ArmRT = 1;
       
    90 		    next LINE;
       
    91 		}
       
    92 		if (/^ARMLIBS$/o) {
       
    93 			my $LibVar = "RVCT${RVCTMajorVersion}${RVCTMinorVersion}LIB";
       
    94 			my $ArmLibDir = RVCT_plat2set::get_lib_path($Plat);
       
    95 
       
    96 			push @MmpWarn, "$LineInfo : No libraries specified for keyword ARMLIBS\n" unless @$Line;
       
    97 
       
    98 			while (@$Line) {
       
    99 			  my $lib = shift @$Line;
       
   100 
       
   101               my $lib_path = RVCT_plat2set::find_lib( $Plat, $lib );
       
   102 
       
   103               if ($lib_path)
       
   104               {
       
   105 				  push @ArmLibList, $lib_path;
       
   106               }
       
   107               else
       
   108               {
       
   109 				  push @MmpWarn, "$LineInfo : arm library file $lib not found.\n" ;
       
   110               }
       
   111 			}
       
   112 			next LINE;
       
   113 		      }
       
   114 		if (/^ARMNAKEDASM$/o) {
       
   115 		    push @MmpWarn, "$LineInfo : No files specified for keyword ARMNAKEDASM\n" unless @$Line;
       
   116 		    push @AsmFileList, @$Line;
       
   117 		    next LINE;
       
   118 		}
       
   119 		push @MmpWarn, "$LineInfo : Unrecognised Keyword \"$_\"\n";
       
   120 	}
       
   121 
       
   122 	undef $Line;
       
   123 	if (@MmpWarn) {
       
   124 		warn
       
   125 			"\nMMPFILE \"$MMPFILE\"\n",
       
   126 			"START .. END BLOCK WARNINGS(S)\n",
       
   127 			@MmpWarn,
       
   128 			"\n"
       
   129 		;
       
   130 	}
       
   131 	undef @MmpWarn;
       
   132     }
       
   133 
       
   134 sub Armutl_ArmIncDir() {
       
   135     $ArmInc;
       
   136 }
       
   137 
       
   138 sub Armutl_ArmLibList() {
       
   139     @ArmLibList;
       
   140 }
       
   141 
       
   142 sub Armutl_ArmRT() {
       
   143     $ArmRT;
       
   144 }
       
   145 
       
   146 sub Armutl_AsmFileList() {
       
   147     @AsmFileList;
       
   148 }
       
   149 
       
   150 sub Armutl_ArmVersion() {
       
   151   return $RVCTVersion;
       
   152 }
       
   153 
       
   154 sub Armutl_RVCTMajorVersion() {
       
   155   return $RVCTMajorVersion;
       
   156 }
       
   157 
       
   158 sub Armutl_RVCTMinorVersion() {
       
   159   return $RVCTMinorVersion;
       
   160 }
       
   161 
       
   162 sub Armutl_RVCTPatchLevel() {
       
   163   return $RVCTPatchLevel;
       
   164 }
       
   165 
       
   166 sub Armutl_RVCTBuildNumber() {
       
   167   return $RVCTBuildNumber;
       
   168 }
       
   169 
       
   170 sub Armutl_ArmLibDir() {
       
   171   my $LibVar = "RVCT${RVCTMajorVersion}${RVCTMinorVersion}LIB";
       
   172   my $ArmLibDir = $ENV{$LibVar};
       
   173   return $ArmLibDir;
       
   174 }
       
   175 
       
   176 1;
       
   177 
       
   178 
       
   179 
       
   180 
       
   181