yu.dong | c33b307 | 2024-08-21 23:14:49 -0700 | [diff] [blame^] | 1 | #!/usr/bin/perl
|
| 2 | #
|
| 3 | # Copyright Statement:
|
| 4 | # --------------------
|
| 5 | # This software is protected by Copyright and the information contained
|
| 6 | # herein is confidential. The software may not be copied and the information
|
| 7 | # contained herein may not be used or disclosed except with the written
|
| 8 | # permission of MediaTek Inc. (C) 2006
|
| 9 | #
|
| 10 | # BY OPENING THIS FILE, BUYER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES
|
| 11 | # THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("MEDIATEK SOFTWARE")
|
| 12 | # RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE PROVIDED TO BUYER ON
|
| 13 | # AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL WARRANTIES,
|
| 14 | # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
|
| 15 | # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NONINFRINGEMENT.
|
| 16 | # NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH RESPECT TO THE
|
| 17 | # SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY, INCORPORATED IN, OR
|
| 18 | # SUPPLIED WITH THE MEDIATEK SOFTWARE, AND BUYER AGREES TO LOOK ONLY TO SUCH
|
| 19 | # THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO. MEDIATEK SHALL ALSO
|
| 20 | # NOT BE RESPONSIBLE FOR ANY MEDIATEK SOFTWARE RELEASES MADE TO BUYER'S
|
| 21 | # SPECIFICATION OR TO CONFORM TO A PARTICULAR STANDARD OR OPEN FORUM.
|
| 22 | #
|
| 23 | # BUYER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S ENTIRE AND CUMULATIVE
|
| 24 | # LIABILITY WITH RESPECT TO THE MEDIATEK SOFTWARE RELEASED HEREUNDER WILL BE,
|
| 25 | # AT MEDIATEK'S OPTION, TO REVISE OR REPLACE THE MEDIATEK SOFTWARE AT ISSUE,
|
| 26 | # OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE CHARGE PAID BY BUYER TO
|
| 27 | # MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE.
|
| 28 | #
|
| 29 | # THE TRANSACTION CONTEMPLATED HEREUNDER SHALL BE CONSTRUED IN ACCORDANCE
|
| 30 | # WITH THE LAWS OF THE STATE OF CALIFORNIA, USA, EXCLUDING ITS CONFLICT OF
|
| 31 | # LAWS PRINCIPLES. ANY DISPUTES, CONTROVERSIES OR CLAIMS ARISING THEREOF AND
|
| 32 | # RELATED THERETO SHALL BE SETTLED BY ARBITRATION IN SAN FRANCISCO, CA, UNDER
|
| 33 | # THE RULES OF THE INTERNATIONAL CHAMBER OF COMMERCE (ICC).
|
| 34 | #
|
| 35 | #*****************************************************************************
|
| 36 | #*
|
| 37 | #* Filename:
|
| 38 | #* ---------
|
| 39 | #* ckMemLayout.pl
|
| 40 | #*
|
| 41 | #* Project:
|
| 42 | #* --------
|
| 43 | #*
|
| 44 | #*
|
| 45 | #* Description:
|
| 46 | #* ------------
|
| 47 | #* This script is to check memory layout
|
| 48 | #*
|
| 49 | #* Author:
|
| 50 | #* -------
|
| 51 | #* Qmei Yang (mtk03726)
|
| 52 | #*
|
| 53 | #****************************************************************************/
|
| 54 |
|
| 55 | #****************************************************************************
|
| 56 | # Included Modules
|
| 57 | #****************************************************************************
|
| 58 | BEGIN { push @INC , './tools/' } # add additional library path
|
| 59 | use sysGenUtility; #pm file name without case sensitivity
|
| 60 | use strict;
|
| 61 | use FileInfoParser;
|
| 62 |
|
| 63 | #****************************************************************************
|
| 64 | # Constants
|
| 65 | #****************************************************************************
|
| 66 | my $CKMEMLAYOUT_VERNO = " m0.04";
|
| 67 | # m0.04 by Tero, ckregion added
|
| 68 | # m0.03 by mei, Support infomake.log input
|
| 69 | # m0.02 by mei, support ckLDS
|
| 70 | # m0.01 by mei, Fix error message
|
| 71 | # v0.02 by mei, Support path and filename case sensitive on Linux
|
| 72 | # v0.01 by mei, initial version
|
| 73 |
|
| 74 | #****************************************************************************
|
| 75 | # Global Variables
|
| 76 | #****************************************************************************
|
| 77 | my $g_exit = 0;
|
| 78 | my %g_MAKEFILE_OPTIONS;
|
| 79 | my $b_debug = 0;
|
| 80 |
|
| 81 | #****************************************************************************
|
| 82 | # Input Parameters
|
| 83 | #****************************************************************************
|
| 84 | my $phase = $ARGV[0];
|
| 85 | my $stop_build = $ARGV[1];
|
| 86 | my $IMAGELAYOUT = $ARGV[2];
|
| 87 | my $LIS_TEMP = $ARGV[3];
|
| 88 | my $FLASH_CFG_TMP = $ARGV[4];
|
| 89 | my $themf = $ARGV[5];
|
| 90 | my $BB_FOLDER = $ARGV[6];
|
| 91 | my $DUMMY_IMAGELAYOUT_ALLOW = $ARGV[7];
|
| 92 | my $INFOMAKE_PATH = $ARGV[8];
|
| 93 |
|
| 94 | print "[ckMemLayout.pl][Input]\nPhase=".$ARGV[0].
|
| 95 | "\nstop_build=".$ARGV[1].
|
| 96 | "\nIMAGELAYOUT=".$ARGV[2].
|
| 97 | "\nMap=".$ARGV[3].
|
| 98 | "\nFLASH_CFG_TMP=".$ARGV[4].
|
| 99 | "\nMakeFile=".$ARGV[5].
|
| 100 | "\nBBFolder=".$ARGV[6].
|
| 101 | "\nDUMMY_IMAGELAYOUT_ALLOW=".$ARGV[7].
|
| 102 | "\nINFOMAKE_PATH=".$ARGV[8].
|
| 103 | "\n\n\n" if($b_debug);
|
| 104 |
|
| 105 |
|
| 106 | #****************************************************************************
|
| 107 | # 1 >>> ParseMakeFile to get GCC/RVCT
|
| 108 | #****************************************************************************
|
| 109 | if(1!= &FileInfo::Parse_MAKEFILE($themf, \%g_MAKEFILE_OPTIONS))
|
| 110 | {
|
| 111 | &sysUtil::sysgen_die("Parse MakeFile failed");
|
| 112 | }
|
| 113 |
|
| 114 | #****************************************************************************
|
| 115 | # 2 >>> Run tool
|
| 116 | #****************************************************************************
|
| 117 | my $strCompiler = &FileInfo::GetCompiler();
|
| 118 | if("GCC" eq $strCompiler)
|
| 119 | {
|
| 120 | $g_exit |= &SendCommand("perl tools/ckLDS.pl $ARGV[0] $ARGV[1] $ARGV[2] $ARGV[3] $ARGV[4] \"$ARGV[5]\" $ARGV[6] $ARGV[7] $ARGV[8]");
|
| 121 | if ($ARGV[0] == 2) {
|
| 122 | my $sym_file = $ARGV[3];
|
| 123 | $sym_file =~ s/map/sym/;
|
| 124 | $g_exit |= &SendCommand("perl tools/AutoGen/postBuild/ckRegion.pl $sym_file") if -e $sym_file or die "No $sym_file found\n";
|
| 125 | my ($tempdir) = ($IMAGELAYOUT =~ /^(.*)custom/);
|
| 126 | $tempdir .= "tmp/";
|
| 127 | $g_exit |= &SendCommand("perl tools/AutoGen/postBuild/ckL2CacheSection.pl $ARGV[3] $tempdir");
|
| 128 | }
|
| 129 | }
|
| 130 | elsif("RVCT" eq $strCompiler)
|
| 131 | {
|
| 132 | $g_exit = &SendCommand("perl tools/ckScatter.pl $ARGV[0] $ARGV[1] $ARGV[2] $ARGV[3] $ARGV[4] \"$ARGV[5]\" $ARGV[6] $ARGV[7] $ARGV[8]");
|
| 133 | }
|
| 134 |
|
| 135 | #****************************************************************************
|
| 136 | # 3 >>> exit - no error: 0, error code: > 0
|
| 137 | #****************************************************************************
|
| 138 | exit $g_exit;
|
| 139 |
|
| 140 | #****************************************************************************
|
| 141 | # subroutines
|
| 142 | #****************************************************************************
|
| 143 | sub SendCommand
|
| 144 | {
|
| 145 | my ($strCommand) = @_;
|
| 146 | my $nRet;
|
| 147 | print "cmd=$strCommand\n";
|
| 148 | print "======================================================================\n";
|
| 149 | $nRet = system($strCommand);
|
| 150 | print "==============================$nRet=====================================\n";
|
| 151 | return ($nRet>>8);
|
| 152 | }
|