For custom builds, add missing package dependencies
authorRamsey Harris <ramsey@ti.com>
Tue, 8 Sep 2015 22:13:48 +0000 (15:13 -0700)
committerAngela Stegmaier <angelabaker@ti.com>
Fri, 11 Sep 2015 15:30:52 +0000 (10:30 -0500)
When using the custom IPC build option, the link order of
some packages is pseudo-random. This results in linker errors.
In ti.sdo.ipc.close(), add a package dependency to modules
participating in the custom build flow.

packages/ti/sdo/ipc/Build.xs
packages/ti/sdo/ipc/package.xs

index 87c0163b66e14eb17ae14ec1925d82d70afef4c4..7e32769d428ccac186d5566548a0bc029bafe290 100644 (file)
@@ -75,6 +75,47 @@ var ccOptsList = {
     "gnu.targets.arm.A15F"                      : customGnuArmA15Opts,
 };
 
     "gnu.targets.arm.A15F"                      : customGnuArmA15Opts,
 };
 
+var ipcPackages = [
+    "ti.sdo.ipc",
+    "ti.sdo.ipc.family.omap4430",
+    "ti.sdo.ipc.family.omap3530",
+    "ti.sdo.ipc.family.da830",
+    "ti.sdo.ipc.family.dm6446",
+    "ti.sdo.ipc.family.ti81xx",
+    "ti.sdo.ipc.family.arctic",
+    "ti.sdo.ipc.family.f28m35x",
+    "ti.sdo.ipc.family.f2837x",
+    "ti.sdo.ipc.family.c647x",
+    "ti.sdo.ipc.family.c6a8149",
+    "ti.sdo.ipc.family.tci663x",
+    "ti.sdo.ipc.family.tda3xx",
+    "ti.sdo.ipc.family.vayu",
+    "ti.sdo.ipc.gates",
+    "ti.sdo.ipc.heaps",
+    "ti.sdo.ipc.notifyDrivers",
+    "ti.sdo.ipc.nsremote",
+    "ti.sdo.ipc.transports",
+    "ti.sdo.utils",
+    "ti.ipc.family.tci6614",
+    "ti.ipc.family.tci6638",
+    "ti.ipc.family.vayu",
+    "ti.ipc.namesrv",
+    "ti.ipc.remoteproc",
+    "ti.ipc.transports"
+];
+
+var cFiles = {
+    "ti.ipc.ipcmgr" : {
+        cSources: [ "IpcMgr.c" ]
+    },
+    "ti.ipc.family.vayu" : {
+        cSources: [ "VirtQueue.c" ]
+    },
+    "ti.ipc.rpmsg" : {
+        cSources: [ "NameMap.c", "RPMessage.c" ]
+    }
+};
+
 /*
  *  ======== module$meta$init ========
  */
 /*
  *  ======== module$meta$init ========
  */
@@ -102,6 +143,10 @@ function module$meta$init()
      * User can override this in their cfg file.
      */
     Build.customCCOpts = Build.getDefaultCustomCCOpts();
      * User can override this in their cfg file.
      */
     Build.customCCOpts = Build.getDefaultCustomCCOpts();
+
+    /* needed by IPackage.close() method */
+    Build.$private.ipcPkgs = ipcPackages;
+    Build.$private.cFiles = cFiles;
 }
 
 /*
 }
 
 /*
@@ -570,47 +615,6 @@ var cList = {
     "gnu.targets.arm.M4F"               : commonSources + M4Sources,
 };
 
     "gnu.targets.arm.M4F"               : commonSources + M4Sources,
 };
 
-var cFiles = {
-    "ti.ipc.ipcmgr" : {
-        cSources: [ "IpcMgr.c" ]
-    },
-    "ti.ipc.family.vayu" : {
-        cSources: [ "VirtQueue.c" ]
-    },
-    "ti.ipc.rpmsg" : {
-        cSources: [ "NameMap.c", "RPMessage.c" ]
-    }
-};
-
-var ipcPackages = [
-    "ti.sdo.ipc",
-    "ti.sdo.ipc.family.omap4430",
-    "ti.sdo.ipc.family.omap3530",
-    "ti.sdo.ipc.family.da830",
-    "ti.sdo.ipc.family.dm6446",
-    "ti.sdo.ipc.family.ti81xx",
-    "ti.sdo.ipc.family.arctic",
-    "ti.sdo.ipc.family.f28m35x",
-    "ti.sdo.ipc.family.f2837x",
-    "ti.sdo.ipc.family.c647x",
-    "ti.sdo.ipc.family.c6a8149",
-    "ti.sdo.ipc.family.tci663x",
-    "ti.sdo.ipc.family.tda3xx",
-    "ti.sdo.ipc.family.vayu",
-    "ti.sdo.ipc.gates",
-    "ti.sdo.ipc.heaps",
-    "ti.sdo.ipc.notifyDrivers",
-    "ti.sdo.ipc.nsremote",
-    "ti.sdo.ipc.transports",
-    "ti.sdo.utils",
-    "ti.ipc.family.tci6614",
-    "ti.ipc.family.tci6638",
-    "ti.ipc.family.vayu",
-    "ti.ipc.namesrv",
-    "ti.ipc.remoteproc",
-    "ti.ipc.transports"
-];
-
 var asmListNone = [
 ];
 
 var asmListNone = [
 ];
 
index 8dd787bd2f0181174496fe3eabeea401c416b9c0..f5801f2094b766a10da1af573705e773a6ec0419 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * Copyright (c) 2012-2015 Texas Instruments Incorporated - http://www.ti.com
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -33,6 +33,7 @@
 /*
  *  ======== package.xs ========
  */
 /*
  *  ======== package.xs ========
  */
+var Build = null;
 
 /*
  *  ======== package.close ========
 
 /*
  *  ======== package.close ========
@@ -48,10 +49,54 @@ function close()
      */
     for (var mod in this.$modules) {
         if (this.$modules[mod].$used == true) {
      */
     for (var mod in this.$modules) {
         if (this.$modules[mod].$used == true) {
-            xdc.useModule('ti.sdo.ipc.Build');
+            Build = xdc.useModule('ti.sdo.ipc.Build');
             break;
         }
     }
             break;
         }
     }
+
+    /* if custom build, add package dependencies to participating modules */
+    if ((Build != null) && ((Build.libType == Build.LibType_Custom)
+            || (Build.libType == Build.LibType_Debug))) {
+
+        for (var m = 0; m < xdc.om.$modules.length; m++) {
+            var mod = xdc.om.$modules[m];
+
+            /* exclude modules which have not been used */
+            if (!mod.$used) {
+                continue;
+            }
+
+            /* exclude modules from this package */
+            if (this == mod.$package) {
+                continue;
+            }
+
+            /* determine if module belongs to an ipc package */
+            var ipcPkg = false;
+            var pn = mod.$package.$name;
+
+            for (var i = 0; i < Build.$private.ipcPkgs.length; i++) {
+                if (pn == Build.$private.ipcPkgs[i]) {
+                    ipcPkg = true;
+                    break;
+                }
+            }
+
+            /* if not a proxy module, add dependency from this package */
+            if (ipcPkg && !mod.$name.match(/Proxy/)) {
+                xdc.useModule(mod.$name);
+                continue;
+            }
+
+            /* special handling for non-target modules */
+            for (var p in Build.$private.cFiles) {
+                if (pn == p) {
+                    xdc.useModule(mod.$name);
+                    continue;
+                }
+            }
+        }
+    }
 }
 
 /*
 }
 
 /*