[Feature][Modem]Update MTK MODEM V1.6 baseline version: MOLY.NR15.R3.MD700.IVT.MP1MR3.MP.V1.6
MTK modem version: MT2735_IVT_MOLY.NR15.R3.MD700.IVT.MP1MR3.MP.V1.6.tar.gz
RF modem version: NA
Change-Id: I45a4c2752fa9d1a618beacd5d40737fb39ab64fb
diff --git a/mcu/tools/chk_env_linux.pl b/mcu/tools/chk_env_linux.pl
new file mode 100644
index 0000000..d0d71ba
--- /dev/null
+++ b/mcu/tools/chk_env_linux.pl
@@ -0,0 +1,370 @@
+use strict;
+use warnings;
+
+my $debug = 0;
+
+my $chk_flag = $ARGV[0];
+my $compiler = $ARGV[1];
+my $compiler_arch = $ARGV[2];
+my $compiler_isa = $ARGV[3];
+
+my $wrong_ver_flag = 0;
+my $wrong_gcc_toolchain_ver = 0;
+my $host_gcc_wrong_ver_flag = 0;
+
+my $compiler_ver_setting = "v4.9.2(2016.05-08)";
+my $grep_string = "mips-mti-elf-gcc";
+if ($compiler_arch eq "MIPS_GCCV4") {
+ $compiler_ver_setting = "MIPS v4.9.2(2016.05-08)";
+} elsif ($compiler_arch eq "MIPS_GCCV6") {
+ if ($compiler_isa ne "NANOMIPS"){
+ $compiler_ver_setting = "MIPS v6.3.0";
+ } else {
+ $compiler_ver_setting = "NANOMIPS v6.3.0";
+ $grep_string = "nanomips-elf-gcc";
+ }
+}
+
+if ($debug eq 1) {
+ print "chk_flag = $chk_flag\n";
+ print "compiler = $compiler\n";
+ print "comiler_arch = $compiler_arch\n";
+ print "comiler_isa = $compiler_isa\n";
+}
+
+print <<"__EOFUSAGE";
+*******************************************************************
+ Recommended Build Environment
+*******************************************************************
+* [OS] : Ubuntu 18.04 | Ubuntu 14.04 *
+* [PERL] : v5.26.1 | v5.18.4 *
+* [PYTHON] : 2.7.17 | 2.7.6 *
+* [MAKE] : GNU Make v4.1 | GNU Make v3.81 *
+* [SHELL] : GNU v4.4.19 | GNU v4.3.11 *
+* [HOST GCC] : gcc version 7.5.0 | gcc version 4.8.4 *
+* [COMPILER] : $compiler_ver_setting *
+* [PERL MODULE]: Switch.pm, File/Copy/Recursive.pm, XML/Simple.pm *
+
+__EOFUSAGE
+
+print "*******************************************************************\n";
+print " Start checking current Build Environment \n";
+print "*******************************************************************\n";
+
+#********************************************************************
+# checking perl version
+#********************************************************************
+my $perl_version = `perl --version | grep "This is perl" 2>&1`;
+
+if($perl_version =~ /\bv5.18.4/i)
+{
+ print "* [PERL] : v5.18.4 [OK] !!!\n";
+}
+elsif($perl_version =~ /\bv5.26.1/i)
+{
+ print "* [PERL] : v5.26.1 [OK] !!!\n";
+}
+else
+{
+ if($perl_version =~ /.*?(v[\d\.]+)\s*/i)
+ {
+ print "* [PERL] : $1 [NOT RECOMMENDED] !!!\n";
+ }
+ else
+ {
+ print "* [PERL] : [UNKNOWN VERSION] !!!\n";
+ $wrong_ver_flag = 1;
+ }
+}
+
+#********************************************************************
+# checking perl module
+#********************************************************************
+my $perl_module = 0;
+my $perl_switch = `perl -e "use Switch" 2>&1`;
+my $perl_recursive = `perl -e "use File::Copy::Recursive" 2>&1`;
+my $perl_simple = `perl -e "use XML::Simple" 2>&1`;
+
+if (($perl_switch ne "") || ($perl_recursive ne "") || ($perl_simple ne "")) {
+ $perl_module = 1;
+ if ($perl_switch ne "") {
+ print "* [Perl Module]: Switch.pm [NOT DETECTED] !!!\n";
+ }
+ if ($perl_recursive ne "") {
+ print "* [Perl Module]: File/Copy/Recursive.pm [NOT DETECTED] !!!\n";
+ }
+ if ($perl_simple ne "") {
+ print "* [Perl Module]: XML/Simple.pm [NOT DETECTED] !!!\n";
+ }
+} else {
+ print "* [Perl Module]: All Perl Module [OK] !!!\n";
+}
+
+#********************************************************************
+# checking python version
+#********************************************************************
+my $python_version = `python --version 2>&1`;
+
+if($python_version =~ /2.7.6/i)
+{
+ print "* [PYTHON] : v2.7.6 [OK] !!!\n";
+}
+elsif($python_version =~ /\b2.7.17/i)
+{
+ print "* [PYTHON] : v2.7.17 [OK] !!!\n";
+}
+else
+{
+ if($python_version =~ /Python\s*([\d\.]+)\s*/i)
+ {
+ print "* [PYTHON] : v$1 [NOT RECOMMENDED] !!!\n";
+ $wrong_ver_flag = 1;
+ }
+ else
+ {
+ print "* [PYTHON] : [UNKNOWN VERSION] !!!\n";
+ $wrong_ver_flag = 1;
+ }
+}
+
+#********************************************************************
+# checking GNU make version
+#********************************************************************
+my $make_version = `make --version | grep "GNU Make" 2>&1`;
+
+if($make_version =~ /\b3.81/i)
+{
+ print "* [MAKE] : GNU Make v3.81 [OK] !!!\n";
+}
+elsif($make_version =~ /\b4.1/i)
+{
+ print "* [MAKE] : GNU Make v4.1 [OK] !!!\n";
+}
+else
+{
+ if($make_version =~ /GNU\s*Make\s*([\d\.]+)\s*/i)
+ {
+ print "* [MAKE] : GUN Make v$1 [NOT RECOMMENDED] !!!\n";
+ $wrong_ver_flag = 1;
+ }
+ else
+ {
+ print "* [MAKE] : [UNKNOWN VERSION] !!!\n";
+ $wrong_ver_flag = 1;
+ }
+}
+
+#********************************************************************
+# checking shell version
+#********************************************************************
+my $shell_version = `bash --version | grep "GNU bash" 2>&1`;
+my $shell_is_gnu = "false";
+my $shell_is_recommend = "false";
+my $shell_number = "UNKNOWN";
+my @recommend_number = ('4.3.11', '4.4.19');
+
+if ($shell_version =~ /\bGNU bash/i) {
+ $shell_is_gnu = "true";
+}
+
+foreach my $num (@recommend_number)
+{
+ if ($shell_version =~ /\b$num/i) {
+ $shell_number = $num;
+ $shell_is_recommend = "true";
+ }
+
+}
+
+if ($shell_is_recommend eq "false" and $shell_version =~ /.*?([\d\.]+)\s*/i) {
+ $shell_number = $1;
+}
+
+if ($shell_is_gnu eq "true" and $shell_is_recommend eq "true"){
+ print "* [SHELL] : GNU bash v$shell_number [OK] !!!\n";
+}
+else
+{
+ if ($shell_is_gnu eq "true") {
+ if ($shell_number eq "UNKNOWN") {
+ print "* [SHELL] : GNU bash [UNKNOWN VERSION NUMBER] !!!\n";
+ }
+ else
+ {
+ print "* [SHELL] : GNU bash v$shell_number [NOT RECOMMENDED]\n";
+ }
+ }
+ else
+ {
+ print "* [SHELL] : [UNKNOWN VERSION] !!!\n";
+ $wrong_ver_flag = 1;
+ }
+}
+
+#********************************************************************
+# checking Host GCC version
+#********************************************************************
+my $host_gcc_ver = `gcc --version | grep "gcc" 2>&1`;
+my @host_gcc_rec_num = ('4.8.4', '7.5.0');
+my $host_gcc_num;
+my $host_gcc_is_rec = "false";
+
+foreach my $num (@host_gcc_rec_num) {
+ if ($host_gcc_ver =~ /\b$num/i) {
+ $host_gcc_num = $num;
+ $host_gcc_is_rec = "true";
+ }
+}
+
+if ($host_gcc_is_rec eq "false" and $host_gcc_ver =~ /.*?([\d\.]+)\s*/i) {
+ $host_gcc_num = $1;
+}
+
+if($host_gcc_is_rec eq "true") {
+ print "* [Host GCC] : gcc version $host_gcc_num [OK] !!!\n";
+} else {
+ my @tmp_host_gcc_ver = split /\./,$host_gcc_num;
+ if (($tmp_host_gcc_ver[0]<4) || ($tmp_host_gcc_ver[0] == 4 && $tmp_host_gcc_ver[1] <= 6) || ($tmp_host_gcc_ver[0] == 4 && $tmp_host_gcc_ver[1] == 6 && $tmp_host_gcc_ver[2] <= 3)) #can not support 4.6.3
+ {
+ print "* [Host GCC] : gcc version $host_gcc_num [NOT RECOMMENDED] !!!\n";
+ $host_gcc_wrong_ver_flag = 1;
+ }
+}
+
+#********************************************************************
+# checking compiler version
+#********************************************************************
+# common/tools/GCC/MIPS/4.9.2/linux/bin/mips-mti-elf-gcc -mthumb --version
+# common/tools/GCC/MIPS/6.3.0/linux/bin/mips-mti-elf-gcc -mthumb --version
+# common/tools/GCC/NANOMIPS/6.3.0/linux/bin/mips-mti-elf-gcc -mthumb --version
+my @tmp = split (' ',$compiler);
+my $compiler_location = $tmp[0];
+my $compiler_is_existing = "true";
+
+print "$compiler_location\n" if($debug eq 1);
+print "$grep_string\n" if($debug eq 1);
+
+if (!-e $compiler_location) {
+ print "* [COMPILER] : $compiler_location [CANNOT FOUND] !!!\n";
+ $wrong_ver_flag = 1;
+ $compiler_is_existing = "false";
+} else {
+ my $compiler_version = `$compiler --version | grep "$grep_string" 2>&1`;
+ print "$compiler_version\n" if ($debug eq 1);
+ if ($compiler_arch eq "MIPS_GCCV4") {
+ if ($compiler_version =~ /\b4.9.2/i) {
+ if ($compiler_version =~ /\b2016.05-08/i){
+ print "* [COMPILER] : v4.9.2(2016.05-08) [OK] !!!\n";
+ } elsif ($compiler_version =~ /\b2016.05-06/i) {
+ print "* [COMPILER] : v4.9.2(2016.05-06) [LOWER THAN RECOMMENDED] !!!\n";
+ $wrong_gcc_toolchain_ver = 1;
+ } elsif ($compiler_version =~ /\b2016.05-03/i) {
+ print "* [COMPILER] : v4.9.2(2016.05-03) [LOWER THAN RECOMMENDED] !!!\n";
+ $wrong_gcc_toolchain_ver = 2;
+ }
+ else {
+ print "* [COMPILER] : [UNKNOWN VERSION] !!!\n";
+ $wrong_gcc_toolchain_ver = 3;
+ }
+ } else {
+ if($compiler_version =~ /.*?\(.*\)\s*([\d\.]+)/i) {
+ my @tmp_ver = split /\./,$1;
+ if (($tmp_ver[0] < 4 ) || ($tmp_ver[0] == 4 && $tmp_ver[1] < 9) || ($tmp_ver[0] == 4 && $tmp_ver[1] == 9 && $tmp_ver[2] < 2)) {
+ print "* [COMPILER] : v$1 [LOWER THAN RECOMMENDED] !!!\n";
+ $wrong_gcc_toolchain_ver = 3;
+ }else {
+ print "* [COMPILER] : v$1 [HIGHER THAN RECOMMENDED] !!!\n";
+ $wrong_gcc_toolchain_ver = 3;
+ }
+ }
+ }
+ } elsif ($compiler_arch eq "MIPS_GCCV6") {
+ if ($compiler_version =~ /\b6.3.0/i) {
+ my $version_str = "MIPS v6.3.0 [OK] !!!";
+ if ($compiler_isa eq "NANOMIPS") {
+ $version_str = "NANOMIPS v6.3.0 [OK] !!!";
+ }
+ print "* [COMPILER] : $version_str\n";
+ } elsif ($compiler_version =~ /.*?\(.*\)\s*([\d\.]+)/i){
+ my @tmp_ver = split /\./,$1;
+ if (($tmp_ver[0] < 6 ) || ($tmp_ver[0] == 6 && $tmp_ver[1] < 3)) {
+ print "* [COMPILER] : v$1 [LOWER THAN RECOMMENDED] !!!\n";
+ $wrong_gcc_toolchain_ver = 3;
+ } else {
+ print "* [COMPILER] : v$1 [HIGHER THAN RECOMMENDED] !!!\n";
+ $wrong_gcc_toolchain_ver = 3;
+ }
+ } else {
+ print "* [COMPILER] : [UNKNOWN VERSION] !!!\n";
+ $wrong_gcc_toolchain_ver = 3;
+ }
+ } else {
+ print "* [COMPILER] : [UNKNOWN VERSION] !!!\n";
+ $wrong_gcc_toolchain_ver = 3;
+ }
+}
+
+#********************************************************************
+# un-expected version handle
+#********************************************************************
+if ($chk_flag eq "-chkenv" and $compiler_is_existing eq "false") {
+ print "\nPlease install the GCC Cross-Compiler on correct path:\n";
+ print "$compiler_location\n\n";
+ exit(1);
+}
+if ($wrong_ver_flag == 1){
+ print "\ncurrent Build Env. is not recommendation \nTo avoid unexpected errors , please install the recommended Tool Chain.\n";
+ print "*******************************************************************\n";
+ print " Build Environment is NOT RECOMMENDED!\n";
+ print "*******************************************************************\n\n";
+
+} elsif ($wrong_gcc_toolchain_ver == 1)
+{
+ print "\nCurrent Build Env. of GCC MIPS Tool Chain v4.9.2(2016.05-06) is not recommendation.\n";
+ print "To avoid unexpected errors , please install the recommended GCC MIPS Tool Chain $compiler_ver_setting.\n";
+ print "*******************************************************************\n";
+ print " Build Environment is NOT RECOMMENDED!\n";
+ print "*******************************************************************\n\n";
+ exit(1);
+}
+elsif ($wrong_gcc_toolchain_ver == 2)
+{
+ print "\nCurrent Build Env. of GCC MIPS Tool Chain v4.9.2(2016.05-03) is not recommendation.\n";
+ print "To avoid unexpected errors , please install the recommended GCC MIPS Tool Chain $compiler_ver_setting.\n";
+ print "*******************************************************************\n";
+ print " Build Environment is NOT RECOMMENDED!\n";
+ print "*******************************************************************\n\n";
+ exit(1);
+}
+elsif ($wrong_gcc_toolchain_ver == 3)
+{
+ print "\nCurrent Build Env. of GCC MIPS Tool Chain is not recommendation.\n";
+ print "To avoid unexpected errors , please install the recommended GCC MIPS Tool Chain $compiler_ver_setting.\n";
+ print "*******************************************************************\n";
+ print " Build Environment is NOT RECOMMENDED!\n";
+ print "*******************************************************************\n\n";
+ exit(1);
+}
+elsif ($host_gcc_wrong_ver_flag == 1)
+{
+ print "\nCurrent Build Env. of Host GCC is not recommendation.\n";
+ print "To avoid unexpected errors , please install the recommended(or higher) version of Host GCC @host_gcc_rec_num.\n";
+ print "*******************************************************************\n";
+ print " Build Environment is NOT RECOMMENDED!\n";
+ print "*******************************************************************\n\n";
+ exit(1);
+}
+elsif ($perl_module == 1) {
+ print "\nCurrent Build Env. of Perl Module is not recommendation.\n";
+ print "To avoid unexpected errors, please install the recommended Perl Module: Switch.pm, File/Copy/Recursive.pm, XML/Simple.pm.\n";
+ print "*******************************************************************\n";
+ print " Build Environment is NOT RECOMMENDED!\n";
+ print "*******************************************************************\n\n";
+ exit(1);
+}
+else
+{
+ print "*******************************************************************\n";
+ print " Build Environment is ready!\n";
+ print "*******************************************************************\n\n";
+}