blob: c5bba24673fa33dc41b8dccc2024f6f1681cf02f [file] [log] [blame]
rjw6c1fd8f2022-11-30 14:33:01 +08001#!/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#* CMMAutoGen.pl
40#*
41#* Project:
42#* --------
43#*
44#*
45#* Description:
46#* ------------
47#* This script generates the CMM files for debugging
48#*
49#* Author:
50#* -------
51#* Qmei Yang (mtk03726)
52#*
53#****************************************************************************/
54
55#****************************************************************************
56# Included Modules
57#****************************************************************************
58use strict;
59BEGIN { push @INC , './tools/' } # add additional library path
60use sysGenUtility; #pm file name without case sensitivity
61use FileInfoParser;
62use LISInfo;
63use File::Copy;
64use File::Path;
65use File::Copy::Recursive qw(fcopy rcopy dircopy fmove rmove dirmove);
66use File::Basename;
67use CommonUtility;
68#****************************************************************************
69# Constants
70#****************************************************************************
71my $CMMGEN_VERNO = " UMOLYA_u1.04";
72 # u1.04 , support to copy coretracer osa
73 # u1.03 , support coretracer path
74 # u1.02 , Modify bbreg path
75 # u1.01 , Support for core spesific regions
76 # u1.00 , initial version for mips support
77my $CMMGEN_AUTHOR = "Qmei Yang";
78
79#****************************************************************************
80# Input Parameters and Global Variables
81#****************************************************************************
82my $ACTION = $ARGV[0]; # 0: MAUI nocode.cmm; 1: HQ_Only.cmm;
83my $CMMFILE = $ARGV[1];
84my $ELFFILE = $ARGV[2];
85my $MAKEFILE = $ARGV[3];
86my $MAUI_BIN = $ARGV[4];
87my $LISFILE = $ARGV[5]; #PCORE
88my $L1CORE_LISFILE = $ARGV[6];
89my $CC_CMD = $ARGV[7];
90my $VIA_CMD = $ARGV[8];
91my $OPTION_TMP = $ARGV[9];
92my $TMP_FOLDER = $ARGV[10];
93my $INFOMAKE_PATH = $ARGV[11];
94my $TMPFILE_PATH = $ARGV[12];
95my $MD_GENERATION = $ARGV[13];
96
97
98my $DebugPrint = 0;
99my $CMMDIR = dirname($CMMFILE);
100my $BUILDDIR = dirname($ELFFILE);
101my $g_strCOMPILER = undef;
102my $g_strDSPBinName = "";
103print "ACTION: $ACTION,\nCMMFILE: $CMMFILE,\nCMMDIR: $CMMDIR,\n
104ELFFILE: $ELFFILE, \nMAKEFILE: $MAKEFILE,\n
105MAUI_BIN: $MAUI_BIN, \nLISFILE: $LISFILE, \n
106L1CORE_LISFILE: $L1CORE_LISFILE\n
107CC_CMD: $CC_CMD, \nVIA_CMD: $VIA_CMD, \nOPTION_TMP: $OPTION_TMP\n
108TMP_FOLDER: $TMP_FOLDER\nINFOMAKE_PATH: $INFOMAKE_PATH\n
109TMPFILE_PATH: $TMPFILE_PATH\n";
110
111#****************************************************************************
112# 1 >>> Parse makefile
113#****************************************************************************
114my %MAKEFILE_OPTIONS;
115my %CmplOption;
116my %RelOption;
117FileInfo::PreProcess($MAKEFILE, \%MAKEFILE_OPTIONS, $INFOMAKE_PATH, \%CmplOption, \%RelOption, 1);
118my $PLATFORM = &FileInfo::GetChip();
119$PLATFORM = &sysUtil::SwitchToClonedChip($PLATFORM);
120$PLATFORM =~ s/\_COPRO// if($PLATFORM =~ /\_COPRO/); # temporarily workaround
121$g_strCOMPILER = &FileInfo::GetCompiler();
122
123
124#****************************************************************************
125# 2 >>> Parse reg_base.h
126#****************************************************************************
127my $REG_BASE_TMP_AFTER_TRANSFORM = "$TMP_FOLDER/~reg_base_after_transform.h";
128my $REG_BASE_TMP_AFTER_PRECOMPILE = "$TMP_FOLDER/~reg_base_after_precompile.h";
129my $REG_BASE_H = "./interface/driver/regbase/".$MD_GENERATION."/";
130my %REG_BASE_DEFS;
131
132### Determine reg_base.h by platform
133my $platform_lc = lc($PLATFORM);
134my $reg_base_h_file = "reg_base_" . $platform_lc . "\.h";
135if (-e $REG_BASE_H.$reg_base_h_file) {
136 $REG_BASE_H .= $reg_base_h_file;
137} else {
138 my $platform_uc = uc($PLATFORM);
139 $reg_base_h_file = "reg_base_" . $platform_uc . "\.h";
140 $REG_BASE_H .= $reg_base_h_file;
141}
142
143if (!(-e $REG_BASE_H)) {
144 my $platform_uc = uc($PLATFORM);
145 $REG_BASE_H = "./interface/driver/regbase/".$MD_GENERATION."/";
146 $REG_BASE_H .= "reg_base_" . $platform_uc . "_FPGA\.h";
147}
148copy ($REG_BASE_H, "$TMP_FOLDER/$reg_base_h_file") if -e $REG_BASE_H or die "Missing $REG_BASE_H\n";
149
150### Change reg_base definitions to data structure for pre-compile
151&reg_base_define_to_struct($TMP_FOLDER, $reg_base_h_file, $REG_BASE_TMP_AFTER_TRANSFORM);
152
153### Pre-compile reg_base.h to get the correct register base addresses
154my $status = system("$CC_CMD $VIA_CMD $OPTION_TMP -E $REG_BASE_TMP_AFTER_TRANSFORM > $REG_BASE_TMP_AFTER_PRECOMPILE") if($g_strCOMPILER eq "RVCT");
155my $status = system("$CC_CMD $VIA_CMD$OPTION_TMP -E $REG_BASE_TMP_AFTER_TRANSFORM > $REG_BASE_TMP_AFTER_PRECOMPILE") if($g_strCOMPILER eq "GCC");
156&error_handler("tools/CMMAutoGen.pl: pre-compile $REG_BASE_TMP_AFTER_TRANSFORM error!", __FILE__, __LINE__) if ($status != 0);
157
158### Parse pre-compiled results and get the correct base address for each address
159&parse_reg_base($REG_BASE_TMP_AFTER_PRECOMPILE, \%REG_BASE_DEFS);
160if ($DebugPrint == 1)
161{
162 foreach (keys %REG_BASE_DEFS)
163 {
164 my $key = $_;
165 my $value = $REG_BASE_DEFS{$_};
166 print "#define $key $value\n";
167 }
168}
169#****************************************************************************
170# 2.5 >>> Parse dsp bin path
171#****************************************************************************
172if(-f $TMPFILE_PATH)
173{
174 my %TMP;
175 my $strTMPFILE = CommonUtil::GetFileContent($TMPFILE_PATH);
176 CommonUtil::HashStringParser($strTMPFILE, \%TMP);
177 $g_strDSPBinName = basename($TMP{DSPMOLY_BIN});
178}
179#****************************************************************************
180# 3 >>> Generate utility cmm files
181#****************************************************************************
182if ($ACTION == 0)
183{
184 ### Parse LIS file first (do not parse LIS file outside to prevent unnecessary errors when LIS does not exist)
185 &LISInfo::Parse($LISFILE);
186
187 ### Generate BuildInfo.cmm
188 {
189 my $BuildInfoCMM = "$CMMDIR/BuildInfo.cmm";
190 my $TemplateFolder = "./tools/DebuggingSuite/Misc/";
191 my $template = &CommonUtil::GetFileContent($TemplateFolder."BuildInfoTemplate.cmm");
192 $template = &Gen_Info_CMMContent($PLATFORM, $template, $ELFFILE, $MAUI_BIN, "../../../../");
193 my $bbreg = &Gen_bb_reg_content(\%REG_BASE_DEFS);
194 $template =~ s/\[CMMAUTOGEN_BBREG\]/$bbreg/g;
195 open (OUTPUT_FILE, ">$BuildInfoCMM") or &error_handler("Unable to open $BuildInfoCMM!\n", __FILE__, __LINE__);
196 print OUTPUT_FILE $template;
197 close OUTPUT_FILE;
198 print "Generate $BuildInfoCMM from ./tools/DebuggingSuite/Misc/BuildInfoTemplate.cmm\n";
199 }
200}
201#****************************************************************************
202# 3.1 >>> Generate load_elf.py
203#****************************************************************************
204if ($ACTION == 0)
205{
206 ### Generate load_elf.py
207 {
208 my $LOAD_ELF_PY = "$CMMDIR/codescape_simulator_load_elf.py";
209 my $TemplateFolder = "./tools/DebuggingSuite/Misc/";
210 my $ELF_PATH_TEMPLATE = $TemplateFolder."codescape_simulator_load_elf_template.py";
211 if( -e $ELF_PATH_TEMPLATE)
212 {
213 my $template = &CommonUtil::GetFileContent($ELF_PATH_TEMPLATE);
214 $template =~ s/\[CMMAUTOGEN_ELFPath\]/$ELFFILE/g;
215 open (OUTPUT_FILE, ">$LOAD_ELF_PY") or &error_handler("Unable to open $LOAD_ELF_PY!\n", __FILE__, __LINE__);
216 print OUTPUT_FILE $template;
217 close OUTPUT_FILE;
218 print "Generate $LOAD_ELF_PY from ./tools/DebuggingSuite/Misc/codescape_simulator_load_elf_template.py\n";
219 }
220 }
221}
222
223#****************************************************************************
224# 4 >>> Generate OnTargetMemoryDump.cmm
225#****************************************************************************
226if ($ACTION == 1)
227{
228 ### Parse LIS file first (do not parse LIS file outside to prevent unnecessary errors when LIS does not exist)
229 &LISInfo::Parse($LISFILE);
230
231 # [note]must be running gen_dump_address_size_template()
232 # after generating hqonly.cmm for ClassifyRegionType()
233 ### Generate OnTargetMemoryDump.cmm
234 {
235 my $DumpCMM = "$CMMDIR/OnTargetMemoryDump.cmm";
236 if(-e $DumpCMM)
237 {
238 my @dump_regions = (["CMMAUTOGEN_DUMP_UC_COMMON_REGIONS",MemType::CommonUnCached],
239 ["CMMAUTOGEN_DUMP_UC_CORE_REGIONS",MemType::CoreUnCached],
240 ["CMMAUTOGEN_DUMP_C_COMMON_REGIONS",MemType::CommonCached],
241 ["CMMAUTOGEN_DUMP_CORE0_C_REGIONS",MemType::Core0Cached],
242 ["CMMAUTOGEN_DUMP_CORE1_C_REGIONS",MemType::Core1Cached],
243 ["CMMAUTOGEN_DUMP_CORE2_C_REGIONS",MemType::Core2Cached],
244 ["CMMAUTOGEN_DUMP_CORE3_C_REGIONS",MemType::Core3Cached]);
245 my $template = &CommonUtil::GetFileContent($DumpCMM);
246 foreach my $dump (@dump_regions)
247 {
248 my $regions = &gen_dump_address_size_template($$dump[1]);
249 $template =~ s/\[$$dump[0]\]/$regions/g;
250 }
251 open (OUTPUT_FILE, ">$DumpCMM") or &error_handler("Unable to open $DumpCMM!\n", __FILE__, __LINE__);
252 print OUTPUT_FILE $template;
253 close OUTPUT_FILE;
254 print "Generate $DumpCMM\n";
255 }
256 }
257}
258#****************************************************************************
259# 5 >>> Replace coretracer config path
260#****************************************************************************
261if ($ACTION == 0)
262{
263 my $elf_path_from_ct_view = "../../".$ELFFILE;
264 my $ct_config_folder = $CMMDIR."/coretracer/config";
265 if (-e $ct_config_folder)
266 {
267 opendir( my $DIR, $ct_config_folder) || &error_handler("Can't open $ct_config_folder!", __FILE__, __LINE__);
268 my @ConfigFile = grep { /\.launch/ && -f "$ct_config_folder/$_" } readdir( $DIR );
269 closedir $DIR;
270 print "Replace coretracer config path:\n";
271 foreach my $launchfile (@ConfigFile)
272 {
273 my $launchpath = $ct_config_folder."/".$launchfile;
274 my $template = &CommonUtil::GetFileContent($launchpath);
275 chmod 0755, $launchpath;
276 $template = &Gen_Info_CMMContent($PLATFORM, $template, $elf_path_from_ct_view, $MAUI_BIN, "../../../../../../");
277 open (OUTPUT_FILE, ">$launchpath") or &error_handler("Unable to open $launchpath!\n", __FILE__, __LINE__);
278 print OUTPUT_FILE $template;
279 close OUTPUT_FILE;
280 print "replace elfpath in ".$launchfile."\n";
281 }
282 }
283}
284#****************************************************************************
285# 5 >>> Copy OSA for coretracer
286#****************************************************************************
287if ($ACTION == 0)
288{
289 my $dest_ct_osa_folder = $CMMDIR."/coretracer";
290 my $org_ct_osa_folder = "./tools/DebuggingSuite/Misc/coretracer";
291 if (-e $org_ct_osa_folder)
292 {
293 if(!-e $dest_ct_osa_folder)
294 {
295 mkpath($dest_ct_osa_folder);
296 }
297 dircopy($org_ct_osa_folder, $dest_ct_osa_folder);
298 }
299}
300
301exit;
302
303sub gen_dump_address_size_template
304{
305 my ($memtype) = @_;
306 my $bb = $PLATFORM;
307 my $template;
308 print "------------On Target Dump Region Info--------------\n";
309 my $DumpRegion_aref = LISInfo::GetCMMDumpRegionInfo($bb,$memtype);
310 foreach my $item (@$DumpRegion_aref)
311 {
312 my $strBase = $item->[1];
313 my $strEnd;
314 if (hex($item->[2]) != 0) {
315 $strEnd = CommonUtil::Dec2Hex(hex($item->[1])+hex($item->[2])-0x1);
316 } else {
317 $strEnd = CommonUtil::Dec2Hex(hex($item->[1])+hex($item->[2]));
318 }
319 print $item->[0].":".$item->[1].",".$item->[2].", $strEnd\n";
320 $template .= "print \"Dumping [$item->[0]]sys_mem_$strBase.bin\"\n";
321 #$template .= "DATA.SAVE.BINARY \"\&store_folder\\sys_mem_$strBase.bin\" $strBase--$strEnd\n";
322 $template .= "DATA.SAVE.BINARY \&store_folder\\sys_mem_$strBase.bin $strBase--$strEnd\n"; #coretracer unsupported now
323 }
324 print "----------------------------------------------\n";
325
326 return $template;
327}
328
329
330#****************************************************************************
331# subroutine: reg_base_define_to_struct
332# input: $strInputFileFolder : folder of input reg_base.h
333# $strInputFile: reg_base.h
334# $strOutputFilePath: path of output file for definitions of reg_base
335#****************************************************************************
336sub reg_base_define_to_struct
337{
338 my ($strInputFileFolder, $strInputFile, $strOutputFilePath) = @_;
339
340 open (INPUT_FILE, "<$strInputFileFolder/$strInputFile") or &error_handler("$strInputFileFolder/$strInputFile: Unable to open $strInputFile!\n", __FILE__, __LINE__);
341 open (OUTPUT_FILE, ">$strOutputFilePath") or &error_handler("$strOutputFilePath: Unable to open $strOutputFilePath!\n", __FILE__, __LINE__);
342
343 print OUTPUT_FILE "\#include \"$strInputFile\"\n\n";
344 print OUTPUT_FILE "typedef struct dummy_reg\n{\n";
345 while (<INPUT_FILE>)
346 {
347 my ($reg);
348
349 if (/^#define\s+(\w+)\s+\(*\w+\)*/)
350 {
351 $reg = $1;
352 print OUTPUT_FILE "\tint $reg\_decl = $reg;\n";
353 }
354 }
355 print OUTPUT_FILE "}\n";
356
357 close INPUT_FILE;
358 close OUTPUT_FILE;
359
360 return;
361}
362
363#****************************************************************************
364# subroutine: parse_reg_base
365# input: $strInputFilePath: pre-compiled reg_base.h
366# $hrefRegBase: hash reference to reg_base
367#****************************************************************************
368sub parse_reg_base
369{
370 my ($strInputFilePath, $hrefRegBase) = @_;
371
372 open (INPUT_FILE, "<$strInputFilePath") or &error_handler("$strInputFilePath: Unable to open $strInputFilePath!\n", __FILE__, __LINE__);
373
374 while (<INPUT_FILE>)
375 {
376 if (/\s*int\s+(\w+)\_decl\s+\=\s+\((.*)\);/)
377 {
378 my $reg = uc($1);
379 my $nDecl = eval($2);
380 $hrefRegBase->{$reg} = CommonUtil::Dec2Hex($nDecl);
381 }
382 }
383
384 close INPUT_FILE;
385
386 return;
387}
388
389#****************************************************************************
390# subroutine: get_cpu_type
391# input: $bb: platform
392# output: CPU type string
393#****************************************************************************
394sub get_cpu_type
395{
396 my ($bb) = @_;
397
398 ### Determine CPU type
399 my $strCPUType;
400 if (&sysUtil::is_arm7($bb))
401 {
402 $strCPUType = "ARM7EJS";
403 }
404 elsif (&sysUtil::is_arm9($bb))
405 {
406 $strCPUType = "ARM926EJ";
407 }
408 elsif (&sysUtil::is_arm11($bb))
409 {
410 $strCPUType = "ARM1176JZ";
411 }
412 elsif (&sysUtil::is_CR4($bb))
413 {
414 $strCPUType = "CortexR4";
415 }
416 else
417 {
418 &error_handler("$MAKEFILE: Unsupported platform $bb!\n", __FILE__, __LINE__);
419 }
420
421 return $strCPUType;
422}
423
424sub FindBBRelatedFile
425{
426 my ($Folder, $bb, $FileExtension) = @_;
427 opendir( my $DIR, $Folder) || &sysUtil::sysgen_die("Can't open $Folder!", __FILE__, __LINE__);
428 my @Files = grep { /$bb/i and /$FileExtension/i} readdir( $DIR );
429 closedir $DIR;
430 return \@Files;
431}
432
433sub Gen_Info_CMMContent #called by gen_info_cmm_from_template
434{
435 my ($org_bb, $template, $strELFPath, $strBinName, $root) = @_;
436 my $strBinPath = dirname($strELFPath)."/".$strBinName;
437
438 $template =~ s/\[CMMAUTOGEN_ELFPath\]/$strELFPath/g;
439 $template =~ s/\[CMMAUTOGEN_BINPath\]/$strBinPath/g;
440 my $cmmgen_verno = &template_verno();
441 $template =~ s/\[CMMAUTOGEN_VERNO\]/$cmmgen_verno/g;
442 $template =~ s/\[CMMAUTOGEN_ROOT\]/$root/g;
443
444 return $template;
445}
446
447sub Gen_bb_reg_content
448{
449 my ($reg_base_href) = @_;
450 my $template;
451 foreach my $key (keys %$reg_base_href)
452 {
453 my $value = $reg_base_href->{$key};
454 $template .= "GLOBAL &$key\n&$key=($value)\n";
455 }
456 return $template;
457}
458
459
460
461
462#****************************************************************************
463# subroutine: template_copyright_file_header
464# (this template will be used by MAUI nocode.cmm, BL nocode.cmm, EXT_BL nocode.cmm, and FOTA nocode.cmm)
465# output: template of copyright file header
466#****************************************************************************
467sub template_copyright_file_header
468{
469 my $template = <<"__TEMPLATE";
470; Copyright Statement:
471; --------------------
472; This software is protected by Copyright and the information contained
473; herein is confidential. The software may not be copied and the information
474; contained herein may not be used or disclosed except with the written
475; permission of MediaTek Inc. (C) 2005
476;
477; BY OPENING THIS FILE, BUYER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES
478; THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("MEDIATEK SOFTWARE")
479; RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE PROVIDED TO BUYER ON
480; AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL WARRANTIES,
481; EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
482; MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NONINFRINGEMENT.
483; NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH RESPECT TO THE
484; SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY, INCORPORATED IN, OR
485; SUPPLIED WITH THE MEDIATEK SOFTWARE, AND BUYER AGREES TO LOOK ONLY TO SUCH
486; THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO. MEDIATEK SHALL ALSO
487; NOT BE RESPONSIBLE FOR ANY MEDIATEK SOFTWARE RELEASES MADE TO BUYER'S
488; SPECIFICATION OR TO CONFORM TO A PARTICULAR STANDARD OR OPEN FORUM.
489;
490; BUYER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S ENTIRE AND CUMULATIVE
491; LIABILITY WITH RESPECT TO THE MEDIATEK SOFTWARE RELEASED HEREUNDER WILL BE,
492; AT MEDIATEK'S OPTION, TO REVISE OR REPLACE THE MEDIATEK SOFTWARE AT ISSUE,
493; OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE CHARGE PAID BY BUYER TO
494; MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE.
495;
496; THE TRANSACTION CONTEMPLATED HEREUNDER SHALL BE CONSTRUED IN ACCORDANCE
497; WITH THE LAWS OF THE STATE OF CALIFORNIA, USA, EXCLUDING ITS CONFLICT OF
498; LAWS PRINCIPLES. ANY DISPUTES, CONTROVERSIES OR CLAIMS ARISING THEREOF AND
499; RELATED THERETO SHALL BE SETTLED BY ARBITRATION IN SAN FRANCISCO, CA, UNDER
500; THE RULES OF THE INTERNATIONAL CHAMBER OF COMMERCE (ICC).
501
502__TEMPLATE
503
504 return $template;
505}
506
507#****************************************************************************
508# subroutine: template_verno
509# (this template will be used by MAUI nocode.cmm, BL nocode.cmm, EXT_BL nocode.cmm, and FOTA nocode.cmm)
510# output: template of verno and author information
511#****************************************************************************
512sub template_verno
513{
514 my $template = <<"__TEMPLATE";
515; CMMAutoGen$CMMGEN_VERNO by $CMMGEN_AUTHOR
516
517__TEMPLATE
518
519 return $template;
520}
521
522
523
524
525
526
527
528#****************************************************************************
529# subroutine: error_handler
530# input: $error_msg: error message
531#****************************************************************************
532sub error_handler
533{
534 my ($strErrorMsg, $strFile, $strLine) = @_;
535
536 my $strFinalErrorMsg = "CMMGEN ERROR: $strErrorMsg at $strFile line $strLine\n";
537 print $strFinalErrorMsg;
538 die $strFinalErrorMsg;
539}