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