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) 2008
|
| 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 | # To process CustImgNamesExt and put image information to ExtractObj.ini.
|
| 37 | #******************************************************************************
|
| 38 | # Subroutine: Usage
|
| 39 | #******************************************************************************
|
| 40 | sub usage {
|
| 41 | print "perl genThemeRomScatter.pl LIS_FILE ThemeRom_scatter.txt ~Theme_ROM.tmp\n";
|
| 42 | exit 1;
|
| 43 | }
|
| 44 |
|
| 45 | $lisfile = $ARGV[0];
|
| 46 | shift(@ARGV);
|
| 47 | $Scatter = $ARGV[0];
|
| 48 | shift(@ARGV);
|
| 49 | $LinkConfig = $ARGV[0];
|
| 50 | shift(@ARGV);
|
| 51 | $custPackDir = $ARGV[0];
|
| 52 | shift(@ARGV);
|
| 53 | $theme_rom_folder = $ARGV[0];
|
| 54 | shift(@ARGV);
|
| 55 | $custthemeres = $ARGV[0];
|
| 56 | shift(@ARGV);
|
| 57 | $empty_res = $ARGV[0];
|
| 58 | shift(@ARGV);
|
| 59 | @linkerOption = @ARGV;
|
| 60 | $CustPackResPreambleExist = 0;
|
| 61 | $addressNum = 0;
|
| 62 |
|
| 63 | # Process lisfile to get mtk_theme_header address
|
| 64 | # mtk_theme_header is from plutommi\customer\custResource\themres.c
|
| 65 |
|
| 66 | open (LIS,"<$lisfile") || die "Cannot open LIS file $lisfile:$!\n";
|
| 67 | while ($read_line = <LIS>) {
|
| 68 | if ($read_line =~ /\s*custpack2ndJumpTbl\s+(0x\S+)\s*Data\s*(\d+)/){
|
| 69 | $CustPackResPreamble = hex($1);
|
| 70 | $CustPackResPreambleLen = $2;
|
| 71 | $CustPackResPreambleExist = 1;
|
| 72 | $startaddress = $CustPackResPreamble + $CustPackResPreambleLen;#4 Byte
|
| 73 | last;
|
| 74 | }
|
| 75 | }
|
| 76 | ($CustPackResPreambleExist == 1) or die "CustPackResPreamble address does NOT exist!";
|
| 77 | close(LIS);
|
| 78 |
|
| 79 | #THEME_ROM 0x01aab108
|
| 80 | #{
|
| 81 | # THEME_ROM 0x01aab108 FIXED //fixed address from 1st build LIS file
|
| 82 | # {
|
| 83 | # themeRes.obj (RESOURCE_1ST_CONTENT, +First)
|
| 84 | # themeRes.obj (+RO)
|
| 85 | # }
|
| 86 | #}
|
| 87 |
|
| 88 | #THEME_OTHERS +0x0
|
| 89 | #{
|
| 90 | # THEME_OTHERS +0x0
|
| 91 | # {
|
| 92 | # *.obj (+RO)
|
| 93 | # *.obj (+RW, +ZI)
|
| 94 | # }
|
| 95 | #}
|
| 96 |
|
| 97 |
|
| 98 | open (FILE,">$Scatter") || die "Cannot open output scatter file:$!\n";
|
| 99 | print FILE "THEME_ROM ".sprintf("0x%08X", $startaddress)."\n";
|
| 100 | print FILE "{\n";
|
| 101 | print FILE " THEME_ROM ".sprintf("0x%08X", $startaddress)." FIXED\n";
|
| 102 | print FILE " {\n";
|
| 103 | print FILE " themeRes\.obj \(RESOURCE_1ST_CONTENT, +First\)\n";
|
| 104 | print FILE " themeRes.obj (+RO)\n";
|
| 105 | print FILE " }\n";
|
| 106 | print FILE "}\n\n";
|
| 107 | print FILE "THEME_OTHERS +0x0\n";
|
| 108 | print FILE "{\n";
|
| 109 | print FILE " THEME_OTHERS +0x0\n";
|
| 110 | print FILE " \{\n";
|
| 111 | print FILE " \*.obj \(+RO\)\n";
|
| 112 | print FILE " \*.obj \(+RW\, +ZI\)\n";
|
| 113 | print FILE " \}\n";
|
| 114 | print FILE "\}\n";
|
| 115 | close(FILE);
|
| 116 |
|
| 117 | # Generate link config file
|
| 118 | open (FILE,">$LinkConfig") || die "Cannot open the linker config file:$!\n";
|
| 119 | print FILE "@linkerOption -scatter $Scatter -output $custPackDir\\THEME_ROM.elf -symdefs $custPackDir\\THEME_ROM.sym -list $custPackDir\\THEME_ROM.lis\n";
|
| 120 | close(FILE);
|
| 121 |
|