rjw | 6c1fd8f | 2022-11-30 14:33:01 +0800 | [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) 2012
|
| 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 | #* genverno.pl
|
| 40 | #*
|
| 41 | #* Project:
|
| 42 | #* --------
|
| 43 | #*
|
| 44 | #*
|
| 45 | #* Description:
|
| 46 | #* ------------
|
| 47 | #* This script is to generate verno.c/verno.h
|
| 48 | #*
|
| 49 | #* Author:
|
| 50 | #* -------
|
| 51 | #* Ray Lin-Wang (mtk04222)
|
| 52 | #*
|
| 53 | #*============================================================================
|
| 54 | #* HISTORY
|
| 55 | #* Below this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
|
| 56 | #*------------------------------------------------------------------------------
|
| 57 | #* $Revision$
|
| 58 | #* $Modtime$
|
| 59 | #* $Log$
|
| 60 | #*
|
| 61 | #* 07 28 2020 chi-chun.lu
|
| 62 | #* [MOLY00550711] update release_bb_chip()
|
| 63 | #* .
|
| 64 | #*
|
| 65 | #* 10 30 2018 gerry.liao
|
| 66 | #* [MOLY00356929] [Gen95/97][exception] refine DSP assert file name policy to fix findowner problem in co-branch
|
| 67 | #* .
|
| 68 | #*
|
| 69 | #* 10 30 2018 gerry.liao
|
| 70 | #* [MOLY00356929] [Gen95/97][exception] refine DSP assert file name policy to fix findowner problem in co-branch
|
| 71 | #*
|
| 72 | #* .
|
| 73 | #* 10 04 2018 gerry.liao
|
| 74 | #* [MOLY00356929] [Gen95/97][exception] refine DSP assert file name policy to fix findowner problem in co-branch
|
| 75 | #* .
|
| 76 | #*
|
| 77 | #*
|
| 78 | #* 10 04 2018 gerry.liao
|
| 79 | #* [MOLY00356929] [Gen95/97][exception] refine DSP assert file name policy to fix findowner problem in co-branch
|
| 80 | #* .
|
| 81 | #*
|
| 82 | #* 08 02 2018 chi-chun.lu
|
| 83 | #* [MOLY00343751] [MakeFile] [UMOLYE] [Modify Makefile Rules] move cxif checksum flow
|
| 84 | #*
|
| 85 | #* .
|
| 86 | #*
|
| 87 | #* 08 02 2018 chi-chun.lu
|
| 88 | #* [MOLY00343751] [MakeFile] [UMOLYE] [Modify Makefile Rules] move cxif checksum flow
|
| 89 | #*
|
| 90 | #* .
|
| 91 | #*
|
| 92 | #* 03 15 2018 yuri.huang
|
| 93 | #* [MOLY00313719] [MakeFile] [UMOLY] [Modify Makefile Rules] Modify genverno.pl for verno.c info
|
| 94 | #* (Qmei).
|
| 95 | #*
|
| 96 | #* 04 19 2017 gerry.liao
|
| 97 | #* [MOLY00242320] [SM] dsp update label feature
|
| 98 | #*
|
| 99 | #* .
|
| 100 | #*
|
| 101 | #* 03 03 2017 gerry.liao
|
| 102 | #* [MOLY00233116] add cxif checksum scripts
|
| 103 | #* .
|
| 104 | #*
|
| 105 | #* 12 01 2015 chi-chun.lu
|
| 106 | #* [MOLY00141748] [MakeFile][UMOLY] [Modify Makefile Rules] modify genverno scripts
|
| 107 | #*
|
| 108 | #* .
|
| 109 | #*
|
| 110 | #* 07 27 2015 gerry.liao
|
| 111 | #* [MOLY00132584] [SM] add $(DSP_PROJECT) and $(DSP_FLAVOR) get function
|
| 112 | #* .
|
| 113 | #*
|
| 114 | #*
|
| 115 | #*------------------------------------------------------------------------------
|
| 116 | #* Upper this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
|
| 117 | #*============================================================================
|
| 118 | #****************************************************************************/
|
| 119 | #****************************************************************************
|
| 120 | # Included Modules
|
| 121 | #****************************************************************************
|
| 122 | BEGIN { push @INC, './tools/CXIF/' }
|
| 123 | use strict;
|
| 124 | use CUIF_Structure_Check;
|
| 125 | use CMIF_Structure_Check;
|
| 126 |
|
| 127 | #****************************************************************************
|
| 128 | # Input Parameters & Global Variables
|
| 129 | #****************************************************************************
|
| 130 | my $verno_dir = $ARGV[0]; # The output path of verno.c and verno.h
|
| 131 | my $verno = $ARGV[1]; # The version number
|
| 132 | my $build_date_time = $ARGV[2]; # The date of building
|
| 133 | my $branch = $ARGV[3]; # The branch name
|
| 134 | my $hal_verno = $ARGV[4];
|
| 135 | my $hw_verno = $ARGV[5];
|
| 136 | my $build = $ARGV[6];
|
| 137 | my $flavor = $ARGV[7];
|
| 138 | my $platform = $ARGV[8];
|
| 139 | my $dsp_proj = $ARGV[9];
|
| 140 | my $dsp_flavor = $ARGV[10];
|
| 141 | my $project_name = $ARGV[11];
|
| 142 | my $mtk_modem_arch = $ARGV[12];
|
| 143 | my $source_file = "verno.c";
|
| 144 | my $header_file = "verno.h";
|
| 145 |
|
| 146 | #****************************************************************************
|
| 147 | # subroutines
|
| 148 | #****************************************************************************
|
| 149 | #****************************************************************************
|
| 150 | # Execute
|
| 151 | #****************************************************************************
|
| 152 | open (SRCFILE, ">$verno_dir/$source_file") or &error_handler("$verno_dir/$source_file : file error!", __FILE__, __LINE__);
|
| 153 | print SRCFILE &gen_verno_src_declare;
|
| 154 | print SRCFILE &gen_verno_src_rel_verno;
|
| 155 | print SRCFILE &gen_verno_src_hal_verno;
|
| 156 | print SRCFILE &gen_verno_src_hw_ver;
|
| 157 | print SRCFILE &gen_verno_src_proj_name;
|
| 158 | print SRCFILE &gen_verno_src_build_date;
|
| 159 | print SRCFILE &gen_verno_src_rel_build;
|
| 160 | print SRCFILE &gen_verno_src_rel_branch;
|
| 161 | print SRCFILE &gen_verno_src_rel_flavor;
|
| 162 | print SRCFILE &gen_verno_src_rel_platform;
|
| 163 | print SRCFILE &gen_verno_src_rel_dsp_proj;
|
| 164 | print SRCFILE &gen_verno_src_rel_dsp_flavor;
|
| 165 | print SRCFILE &gen_verno_src_rel_dsp_root;
|
| 166 | close SRCFILE;
|
| 167 |
|
| 168 | open (H_FILE, ">$verno_dir/$header_file") or &error_handler("$verno_dir/$header_file : file error!", __FILE__, __LINE__);
|
| 169 | print H_FILE &gen_verno_header_file;
|
| 170 | close H_FILE;
|
| 171 |
|
| 172 | #****************************************************************************
|
| 173 | # subroutine: genverno_verno
|
| 174 | #****************************************************************************
|
| 175 | sub genverno_verno
|
| 176 | {
|
| 177 | return " v0.00 , initial version ";
|
| 178 | }
|
| 179 |
|
| 180 | #****************************************************************************
|
| 181 | # subroutine: gen_verno_header_file
|
| 182 | #****************************************************************************
|
| 183 | sub gen_verno_header_file
|
| 184 | {
|
| 185 | my $template = <<"__TEMPLATE";
|
| 186 | #define VERNO_STR "$verno"
|
| 187 | #define HW_VER_STR "$hw_verno"
|
| 188 | #define PROJECT_NAME_STR "$project_name"
|
| 189 | #define BUILD_DATE_TIME_STR "$build_date_time"
|
| 190 | #define BUILD_STR "$build"
|
| 191 | #define BUILD_BRANCH_STR "$branch"
|
| 192 | #define PLATFORM "$platform"
|
| 193 | __TEMPLATE
|
| 194 | }
|
| 195 |
|
| 196 | #****************************************************************************
|
| 197 | # 1. subroutine: gen_verno_src_declare
|
| 198 | #****************************************************************************
|
| 199 | sub gen_verno_src_declare
|
| 200 | {
|
| 201 | my $template = <<"__TEMPLATE";
|
| 202 | #include "kal_public_api.h"
|
| 203 | #define VERNO_LENGTH 128
|
| 204 | #if defined(__MTK_TARGET__)
|
| 205 | __attribute__ ((section ("RELEASE_VERNO_RW"))) static kal_char verno_str[VERNO_LENGTH] = "$verno";
|
| 206 | __attribute__ ((section ("BUILD_TIME_RW"))) static kal_char build_date_time_str[] = "$build_date_time";
|
| 207 | __attribute__ ((section ("RELEASE_BRANCH_RW"))) static kal_char build_branch_str[] = "$branch";
|
| 208 | kal_char build_flavor_str[] = "$flavor";
|
| 209 | kal_char build_platform_str[] = "$platform";
|
| 210 | kal_char build_dsp_proj_str[] = "$dsp_proj";
|
| 211 |
|
| 212 | extern kal_uint32 RELEASE_VERNO_RW\$\$Base;
|
| 213 | extern kal_uint32 BUILD_TIME_RW\$\$Base;
|
| 214 | extern kal_uint32 RELEASE_BRANCH_RW\$\$Base;
|
| 215 | #endif
|
| 216 |
|
| 217 | __TEMPLATE
|
| 218 | }
|
| 219 |
|
| 220 | #****************************************************************************
|
| 221 | # 2. subroutine: gen_verno_src_rel_verno
|
| 222 | #****************************************************************************
|
| 223 | sub gen_verno_src_rel_verno
|
| 224 | {
|
| 225 | my $template = <<"__TEMPLATE";
|
| 226 | kal_char* release_verno(void)
|
| 227 | {
|
| 228 | #if defined(__MTK_TARGET__)
|
| 229 | #if defined(__GNUC__)
|
| 230 | return verno_str;
|
| 231 | #else
|
| 232 | return (kal_char*)&RELEASE_VERNO_RW\$\$Base;
|
| 233 | #endif
|
| 234 | #else
|
| 235 | static kal_char verno_str[VERNO_LENGTH] = "$verno";
|
| 236 | return verno_str;
|
| 237 | #endif
|
| 238 | }
|
| 239 |
|
| 240 | __TEMPLATE
|
| 241 | }
|
| 242 |
|
| 243 | #****************************************************************************
|
| 244 | # 3. subroutine: gen_verno_src_hal_verno
|
| 245 | #****************************************************************************
|
| 246 | sub gen_verno_src_hal_verno
|
| 247 | {
|
| 248 | my $template = <<"__TEMPLATE";
|
| 249 | kal_char* release_hal_verno(void)
|
| 250 | {
|
| 251 | static kal_char hal_verno_str[] = "$hal_verno";
|
| 252 | return hal_verno_str;
|
| 253 | }
|
| 254 |
|
| 255 | __TEMPLATE
|
| 256 | }
|
| 257 |
|
| 258 | #****************************************************************************
|
| 259 | # 4. subroutine: gen_verno_src_hw_ver
|
| 260 | #****************************************************************************
|
| 261 | sub gen_verno_src_hw_ver
|
| 262 | {
|
| 263 | my $template = <<"__TEMPLATE";
|
| 264 | kal_char* release_hw_ver(void)
|
| 265 | {
|
| 266 | static kal_char hw_ver_str[] = "$hw_verno";
|
| 267 | return hw_ver_str;
|
| 268 | }
|
| 269 |
|
| 270 | __TEMPLATE
|
| 271 | }
|
| 272 |
|
| 273 | #****************************************************************************
|
| 274 | # 5. subroutine: gen_verno_src_build_date
|
| 275 | #****************************************************************************
|
| 276 | sub gen_verno_src_build_date
|
| 277 | {
|
| 278 | my $template = <<"__TEMPLATE";
|
| 279 | kal_char* build_date_time(void)
|
| 280 | {
|
| 281 | #if defined(__MTK_TARGET__)
|
| 282 | #if defined(__GNUC__)
|
| 283 | return build_date_time_str;
|
| 284 | #else
|
| 285 | return (kal_char*)&BUILD_TIME_RW\$\$Base;
|
| 286 | #endif
|
| 287 | #else
|
| 288 | static kal_char build_date_time_str[] = "$build_date_time";
|
| 289 | return build_date_time_str;
|
| 290 | #endif
|
| 291 | }
|
| 292 |
|
| 293 | __TEMPLATE
|
| 294 | }
|
| 295 |
|
| 296 | #****************************************************************************
|
| 297 | # 6. subroutine: gen_verno_src_rel_build
|
| 298 | #****************************************************************************
|
| 299 | sub gen_verno_src_rel_build
|
| 300 | {
|
| 301 | my $template = <<"__TEMPLATE";
|
| 302 | kal_char* release_build(void)
|
| 303 | {
|
| 304 | static kal_char build_str[] = "$build";
|
| 305 | return build_str;
|
| 306 | }
|
| 307 |
|
| 308 | __TEMPLATE
|
| 309 | }
|
| 310 |
|
| 311 | #****************************************************************************
|
| 312 | # 7. subroutine: gen_verno_src_rel_branch
|
| 313 | #****************************************************************************
|
| 314 | sub gen_verno_src_rel_branch
|
| 315 | {
|
| 316 | my $template = <<"__TEMPLATE";
|
| 317 | kal_char* release_branch(void)
|
| 318 | {
|
| 319 | #if defined(__MTK_TARGET__)
|
| 320 | #if defined(__GNUC__)
|
| 321 | return build_branch_str;
|
| 322 | #else
|
| 323 | return (kal_char*)&RELEASE_BRANCH_RW\$\$Base;
|
| 324 | #endif
|
| 325 | #else
|
| 326 | static kal_char build_branch_str[] = "$branch";
|
| 327 | return build_branch_str;
|
| 328 | #endif
|
| 329 | }
|
| 330 |
|
| 331 | __TEMPLATE
|
| 332 | }
|
| 333 |
|
| 334 | #****************************************************************************
|
| 335 | # 8. subroutine: gen_verno_src_rel_flavor
|
| 336 | #****************************************************************************
|
| 337 | sub gen_verno_src_rel_flavor
|
| 338 | {
|
| 339 | my $template = <<"__TEMPLATE";
|
| 340 | kal_char* release_flavor(void)
|
| 341 | {
|
| 342 | #if defined(__MTK_TARGET__)
|
| 343 | return build_flavor_str;
|
| 344 | #else
|
| 345 | static kal_char build_flavor_str[] = "$flavor";
|
| 346 | return build_flavor_str;
|
| 347 | #endif
|
| 348 | }
|
| 349 |
|
| 350 | __TEMPLATE
|
| 351 | }
|
| 352 |
|
| 353 | #****************************************************************************
|
| 354 | # 9. subroutine: gen_verno_src_rel_dsp_proj
|
| 355 | #****************************************************************************
|
| 356 | sub gen_verno_src_rel_dsp_proj
|
| 357 | {
|
| 358 | my $template = <<"__TEMPLATE";
|
| 359 | kal_char* release_dsp_proj(void)
|
| 360 | {
|
| 361 | #if defined(__MTK_TARGET__)
|
| 362 | return build_dsp_proj_str;
|
| 363 | #else
|
| 364 | static kal_char build_dsp_proj_str[] = "$dsp_proj";
|
| 365 | return build_dsp_proj_str;
|
| 366 | #endif
|
| 367 | }
|
| 368 |
|
| 369 | __TEMPLATE
|
| 370 | }
|
| 371 |
|
| 372 | #****************************************************************************
|
| 373 | # 10. subroutine: gen_verno_src_rel_dsp_flavor
|
| 374 | #****************************************************************************
|
| 375 | sub gen_verno_src_rel_dsp_flavor
|
| 376 | {
|
| 377 | my $template = <<"__TEMPLATE";
|
| 378 | kal_char* release_dsp_flavor(void)
|
| 379 | {
|
| 380 | static kal_char build_dsp_flavor_str[] = "$dsp_flavor";
|
| 381 | return build_dsp_flavor_str;
|
| 382 | }
|
| 383 |
|
| 384 | __TEMPLATE
|
| 385 | }
|
| 386 |
|
| 387 | #****************************************************************************
|
| 388 | # 11. subroutine: gen_verno_src_proj_name
|
| 389 | #****************************************************************************
|
| 390 | sub gen_verno_src_proj_name
|
| 391 | {
|
| 392 | my $template = <<"__TEMPLATE";
|
| 393 | kal_char* release_proj_name(void)
|
| 394 | {
|
| 395 | static kal_char proj_name_str[] = "$project_name";
|
| 396 | return proj_name_str;
|
| 397 | }
|
| 398 |
|
| 399 | __TEMPLATE
|
| 400 | }
|
| 401 |
|
| 402 | #****************************************************************************
|
| 403 | # 12. subroutine: gen_verno_dsp_root
|
| 404 | #****************************************************************************
|
| 405 | sub gen_verno_src_rel_dsp_root
|
| 406 | {
|
| 407 | my $dsp_root = "dsp/";
|
| 408 | if ($mtk_modem_arch eq "mt6295")
|
| 409 | {
|
| 410 | $dsp_root = "dsp2/";
|
| 411 | }
|
| 412 | elsif ($mtk_modem_arch eq "mt6297")
|
| 413 | {
|
| 414 | $dsp_root = "dsp3/";
|
| 415 | }
|
| 416 |
|
| 417 | my $template = <<"__TEMPLATE";
|
| 418 | kal_char* release_dsp_root(void)
|
| 419 | {
|
| 420 | static kal_char build_dsp_root_str[] = "$dsp_root";
|
| 421 | return build_dsp_root_str;
|
| 422 | }
|
| 423 |
|
| 424 | __TEMPLATE
|
| 425 | }
|
| 426 |
|
| 427 | #****************************************************************************
|
| 428 | # 13. subroutine: gen_verno_src_rel_platform
|
| 429 | #****************************************************************************
|
| 430 | sub gen_verno_src_rel_platform {
|
| 431 | my $template = <<"__TEMPLATE";
|
| 432 | kal_char* release_mcu_platform(void)
|
| 433 | {
|
| 434 | #if defined(__MTK_TARGET__)
|
| 435 | return build_platform_str;
|
| 436 | #else
|
| 437 | static kal_char build_platform_str[] = "$platform";
|
| 438 | return build_platform_str;
|
| 439 | #endif
|
| 440 | }
|
| 441 |
|
| 442 | __TEMPLATE
|
| 443 | }
|
| 444 |
|
| 445 | #****************************************************************************
|
| 446 | # subroutine: error_handler
|
| 447 | # input: $error_msg: error message
|
| 448 | #****************************************************************************
|
| 449 | sub error_handler
|
| 450 | {
|
| 451 | my ($error_msg, $file, $line_no) = @_;
|
| 452 |
|
| 453 | my $final_error_msg = "GENVERNO ERROR: $error_msg at $file line $line_no\n";
|
| 454 | print $final_error_msg;
|
| 455 | die $final_error_msg;
|
| 456 | }
|
| 457 |
|