]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - ipc/ipcdev.git/blobdiff - ipc-bios.bld
Linux: GateHWSpinlock: Fix Compiler Warnings
[ipc/ipcdev.git] / ipc-bios.bld
index bc942621f646d4fcfc2e4fd92fe587533629ac1b..978571a10f3a7cbb85e49f2b5dc9f72cb4f35656 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011-2013, Texas Instruments Incorporated
+ * Copyright (c) 2011-2015 Texas Instruments Incorporated - http://www.ti.com
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  */
 
 /*
- *  ======== ipc.bld ========
+ *  ======== ipc-bios.bld ========
  *  This script is run prior to all build scripts. It sets host-system-
  *  independent values for targets and platforms, then it attempts to
  *  find the host-system-specific user.bld script that sets rootDirs.
  *
  *  These settings may be a function of the following global variables:
  *
- *     environment a hash table of environment strings
+ *      environment a hash table of environment strings
  *
- *     arguments   an array of string arguments to the _config.bld script
- *                 initialized as follows:
- *                     arguments[0] - the file name of the _config.bld script
- *                     arguments[1] - the first argument specified in XDCARGS
- *                         :
- *                     arguments[n] - the n'th argument in XDCARGS
+ *      arguments   an array of string arguments to the script
+ *                  initialized as follows:
+ *                      arguments[0] - the file name of the script
+ *                      arguments[1] - the first argument specified in XDCARGS
+ *                          :
+ *                      arguments[n] - the n'th argument in XDCARGS
  *
- *     Build       an alias for xdc.om.xdc.bld.BuildEnvironment
+ *      Build       an alias for xdc.om.xdc.bld.BuildEnvironment
  */
 
-/* for M3-devices only (OMAP5), build using the SMP-enabled platform */
-var build_smp = "1";
+var Build = xdc.useModule('xdc.bld.BuildEnvironment');
+var Pkg = xdc.useModule('xdc.bld.PackageContents');
 
 /* Common ccopts suffix used for all C6x targets */
-var c6xOpts = " -mi10 -mo -pdr -pden -pds=238 -pds=880 -pds1110 -g ";
+var c6xOpts = " -mi10 -mo -pdr -pden -pds=238 -pds=880 -pds1110 -g --mem_model:const=data --mem_model:data=far ";
 
 /*
  * -mi10 => maximum cycles that interrupts may be disabled is 10
@@ -76,19 +76,19 @@ var c6xOpts = " -mi10 -mo -pdr -pden -pds=238 -pds=880 -pds1110 -g ";
  * -pden => show remark ids
  * -pds=238 => ignore "controlling expression is constant"
  * -pds=880 => ignore "unused parameter"
+ * --mem_model:const=data => Const objects are placed according to the
+ * --mem_model:data option
+ * --mem_model:data=far => Data accesses default to far
  */
 
 var ccOpts = {
-    "ti.targets.C28_large"            : " -mo -g ",
-    "ti.targets.C28_float"            : " -mo -g ",
-
     "ti.targets.C64P"                 : c6xOpts,
     "ti.targets.C64P_big_endian"      : c6xOpts,
     "ti.targets.C674"                 : c6xOpts,
 
     "ti.targets.elf.C64P"             : c6xOpts,
     "ti.targets.elf.C64P_big_endian"  : c6xOpts,
-    "ti.targets.elf.C64T"             : " -mi10 -mo -pds=71",
+    "ti.targets.elf.C64T"             : c6xOpts,
     "ti.targets.elf.C66"              : c6xOpts,
     "ti.targets.elf.C66_big_endian"   : c6xOpts,
     "ti.targets.elf.C674"             : c6xOpts,
@@ -107,80 +107,179 @@ var ccOpts = {
     "gnu.targets.arm.A15F"            : " -g "
 };
 
-/* Enable building SMP-BIOS enabled libraries for targets that support it */
-xdc.module("ti.targets.arm.elf.M3").profiles["smp"] =
-        xdc.module("ti.targets.arm.elf.M3").profiles["debug"];
-xdc.module("ti.targets.arm.elf.M4").profiles["smp"] =
-        xdc.module("ti.targets.arm.elf.M4").profiles["debug"];
+var lnkOpts = {
+    "ti.targets.elf.C66"              : " --cinit_compression=off",
+    "ti.targets.arm.elf.M4"           : " --retain=.resource_table" +
+                                        " --cinit_compression=off"
+};
+
+var platform = "";
+var smpEnabled = true;
+var Bld_goal = "";
 
 /* initialize local vars with those set in xdcpaths.mak (via XDCARGS) */
 for (arg = 0; arg < arguments.length; arg++) {
+    /* split each arg into its '+' separated parts */
+    var configParts = arguments[arg].split(";");
+    // print("arg " + arg + " has " + configParts.length + " parts");
+
+    /* if "known args come in, filter them... else they're targets */
+    if (configParts[0].split("=")[0] == "PLATFORM") {
+        // print("FOUND PLATFORM ARG - " + configParts[0]);
+        platform = configParts[0].split("=")[1];
+        continue;
+    }
+    else if (configParts[0].split("=")[0] == "BIOS_SMPENABLED") {
+        // print("FOUND SMP_ENABLED ARG - " + configParts[0]);
+        smpEnabled = configParts[0].split("=")[1].match(/^1$/);
+        continue;
+    }
+    else if (configParts[0].split("=")[0] == "GOAL") {
+        Bld_goal = configParts[0].split("=")[1];
+        continue;
+    }
+
+    if (platform == "") {
+        platform = "NONE";
+    }
+
     /*
      * Get the compiler's installation directory.
      * For "ti.targets.elf.C674=/vendors/c6x/7.2.0", we get "/vendors/c6x/7.2.0"
      */
-    var targetName = arguments[arg].split("=")[0];
-    var rootDir = arguments[arg].split("=")[1];
+    var targetName = configParts[0].split("=")[0];
+    var rootDir = configParts[0].split("=")[1];
 
     /* only build for the specified compilers */
     if (rootDir == "" || rootDir == undefined) {
         continue;
     }
 
+//    print("Building '" + targetName + "' using '" + rootDir + "' ...");
+
     var target = xdc.useModule(targetName);
     target.rootDir = rootDir;
-    target.ccOpts.suffix += ccOpts[targetName];
+    if (ccOpts[targetName] != undefined) {
+        target.ccOpts.suffix += ccOpts[targetName];
+    }
+    if (lnkOpts[targetName] != undefined) {
+        target.lnkOpts.suffix += lnkOpts[targetName];
+    }
+
+    /* for all the other parts, assign target.<left> = <right> */
+    for (var i = 1; i < configParts.length; i++) {
+        var modCfgParam = configParts[i].split("=")[0];
+        var modCfgValue = configParts[i].split("=")[1];
+        var modCfgIndex = modCfgParam.split(".");
+        var element = target;
+
+//        print("Configuring target." + modCfgParam + " = " + modCfgValue);
+
+        for (j = 0; j < (modCfgIndex.length -1); j++) {
+                element = element[modCfgIndex[j]];
+        }
+        element[modCfgIndex[j]] = modCfgValue;
+    }
 
     /* Add appropriate platforms to build for based on target name */
     if (targetName.match(/elf\.C674/)) {
-        target.platforms = [ "ti.platforms.evmOMAPL138:DSP" ];
+        if (platform == 'OMAPL138') {
+            target.platforms.$add("ti.platforms.evmOMAPL138:DSP");
+        }
     }
 
-    if (targetName.match(/elf\.C66/)) {
-        target.lnkOpts.suffix += " -cr";
-        target.platforms = [
-            "ti.platforms.simKepler"
-            //"ti.platforms.evm6614:DSP"
-//            "ti.platforms.evmTCI6638K2K"
-        ];
+    if (targetName.match(/elf\.C66$/)) {
+        switch (platform) {
+            case '66AK2G':
+                target.platforms.$add("ti.platforms.evmTCI66AK2G02:core0");
+                break;
+
+            case '66AK2E':
+                target.platforms.$add("ti.platforms.evmC66AK2E:core0");
+                break;
+
+            case 'TCI6630':
+                target.platforms.$add("ti.platforms.evmTCI6630K2L:core0");
+                break;
+
+            case 'TCI6636':
+                target.platforms.$add("ti.platforms.evmTCI6636K2H:core0");
+                break;
+
+            case 'TCI6638':
+                target.platforms.$add("ti.platforms.evmTCI6638K2K:core0");
+                break;
+
+            case 'C6678':
+                target.platforms.$add("ti.platforms.evm6678");
+                break;
+
+            case 'DRA7XX':
+                target.platforms.$add("ti.platforms.evmDRA7XX:dsp1");
+                target.platforms.$add("ti.platforms.evmDRA7XX:dsp2");
+                break;
+
+            case 'TDA3XX':
+                target.platforms.$add("ti.platforms.evmTDA3XX");
+                break;
+
+            case 'NONE':
+                /* okay, no platform specified */
+                break;
+
+            default:
+                print("Unknown C66x platform, skipping " + platform);
+                break;
+        }
     }
 
     if (targetName.match(/elf\.C64T/)) {
-        target.lnkOpts.prefix += " -e=ti_sysbios_family_c64p_Hwi0";
-        /* NOTE: These platforms (from omapzoom) are local, custom: */
-        target.platforms = [
-                    //"ti.platform.omap4430.dsp",
-                    "ti.platform.omap54xx.dsp",
-                ];
+        if (platform == 'OMAP54XX') {
+            target.platforms.$add("ti.platforms.sdp5430:DSP");
+        }
     }
 
-    if (targetName.match(/elf\.M3/)) {
-        target.lnkOpts.prefix += " --retain=.resource_table";
-        target.lnkOpts.prefix += " --cinit_compression=off";
-        /* NOTE: These platforms (from omapzoom) are local, custom: */
-        /* Set default platform and list of all interested platforms for M3 */
-        if (build_smp == null || build_smp == "0") {
-            /* Helps boot times, plus unmasks issues w/ uninit'd vars */
-            target.lnkOpts.prefix +=  " --zero_init=off";
-            target.platforms = [
-                        //"ti.platform.omap4430.core0",
-                        "ti.platform.omap54xx.core0",
-                   ];
-        }
-        else {
-            target.platforms =  [
-                        //"ti.platform.omap4430.ipu",
-                        "ti.platform.omap54xx.ipu",
-                   ];
+    if (targetName.match(/elf\.M4$/)) {
+        switch (platform) {
+            case 'OMAP54XX':
+                target.platforms.$add("ti.platforms.sdp5430:IPU");
+                break;
+
+            case 'DRA7XX':
+                target.platforms.$add("ti.platforms.evmDRA7XX:ipu2");
+                target.platforms.$add("ti.platforms.evmDRA7XX:ipu1");
+                break;
+
+            case 'TDA3XX':
+                target.platforms.$add("ti.platforms.evmTDA3XX");
+                break;
+
+            case 'NONE':
+                /* okay, no platform specified */
+                break;
+
+            default:
+                print("Unknown M4 platform, skipping " + platform);
+                break;
         }
     }
 
     Build.targets.$add(target);
 }
 
+if (smpEnabled) {
+    /* Enable building SMP-BIOS enabled libraries for targets that support it */
+    if (Pkg.name.match(/^ti\.sdo\.(ipc|utils)/)) {
+        xdc.module("ti.targets.arm.elf.M3").profiles["smp"] =
+                xdc.module("ti.targets.arm.elf.M3").profiles["debug"];
+        xdc.module("ti.targets.arm.elf.M4").profiles["smp"] =
+                xdc.module("ti.targets.arm.elf.M4").profiles["debug"];
+        xdc.module("gnu.targets.arm.A15F").profiles["smp"] =
+                xdc.module("gnu.targets.arm.A15F").profiles["debug"];
+    }
+}
 
 /* lib/ is a generated directory that 'xdc clean' should remove */
-var Pkg = xdc.useModule('xdc.bld.PackageContents');
 Pkg.generatedFiles.$add("lib/");
 
 /*
@@ -199,3 +298,6 @@ for (var t = 0; t < Build.targets.length; t++) {
 /* -----------------------------------------------------------------------*/
 /* make release files '.tar.gz' files (.tar is default) */
 Pkg.attrs.compress = true;
+
+/* catch inadvertant use of unsupported data types */
+Pkg.attrs.defs = "-Dxdc__strict";