]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - ipc/ipcdev.git/blob - packages/ti/sdo/ipc/Build.xs
Merge remote-tracking branch 'origin/3.23' into ipc-3.30-next
[ipc/ipcdev.git] / packages / ti / sdo / ipc / Build.xs
1 /*
2  * Copyright (c) 2013-2014 Texas Instruments Incorporated - http://www.ti.com
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions
7  * are met:
8  *
9  * *  Redistributions of source code must retain the above copyright
10  *    notice, this list of conditions and the following disclaimer.
11  *
12  * *  Redistributions in binary form must reproduce the above copyright
13  *    notice, this list of conditions and the following disclaimer in the
14  *    documentation and/or other materials provided with the distribution.
15  *
16  * *  Neither the name of Texas Instruments Incorporated nor the names of
17  *    its contributors may be used to endorse or promote products derived
18  *    from this software without specific prior written permission.
19  *
20  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
22  * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23  * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
27  * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
28  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
29  * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
30  * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31  */
33 /*
34  *  ======== Build.xs ========
35  */
37 var BIOS = null;
38 var Build = null;
39 var Ipc = null;
41 var custom28xOpts = " -q -mo ";
42 var custom6xOpts = " -q -mi10 -mo -pdr -pden -pds=238 -pds=880 -pds1110 ";
43 var customARP32xOpts = " -q --gen_func_subsections ";
44 var customArmOpts = " -q -ms --opt_for_speed=2 ";
45 var customGnuArmM3Opts = " ";
46 var customGnuArmM4Opts = " ";
47 var customGnuArmM4FOpts = " ";
48 var customGnuArmA9Opts = " ";
49 var customGnuArmA8Opts = " ";
50 var customGnuArmA15Opts = " ";
52 var ccOptsList = {
53     "ti.targets.C28_large"                      : custom28xOpts,
54     "ti.targets.C28_float"                      : custom28xOpts,
55     "ti.targets.C64P"                           : custom6xOpts,
56     "ti.targets.elf.C64P"                       : custom6xOpts,
57     "ti.targets.C64P_big_endian"                : custom6xOpts,
58     "ti.targets.elf.C64P_big_endian"            : custom6xOpts,
59     "ti.targets.C674"                           : custom6xOpts,
60     "ti.targets.elf.C674"                       : custom6xOpts,
61     "ti.targets.elf.C67P"                       : custom6xOpts,
62     "ti.targets.elf.C64T"                       : custom6xOpts,
63     "ti.targets.elf.C66"                        : custom6xOpts,
64     "ti.targets.elf.C66_big_endian"             : custom6xOpts,
65     "ti.targets.arp32.elf.ARP32"                : customARP32xOpts,
66     "ti.targets.arp32.elf.ARP32_far"            : customARP32xOpts,
67     "ti.targets.arm.elf.Arm9"                   : customArmOpts,
68     "ti.targets.arm.elf.A8F"                    : customArmOpts,
69     "ti.targets.arm.elf.A8Fnv"                  : customArmOpts,
70     "ti.targets.arm.elf.M3"                     : customArmOpts,
71     "ti.targets.arm.elf.M4"                     : customArmOpts,
72     "ti.targets.arm.elf.M4F"                    : customArmOpts,
73     "gnu.targets.arm.M3"                        : customGnuArmM3Opts,
74     "gnu.targets.arm.M4"                        : customGnuArmM4Opts,
75     "gnu.targets.arm.M4F"                       : customGnuArmM4FOpts,
76     "gnu.targets.arm.A8F"                       : customGnuArmA8Opts,
77     "gnu.targets.arm.A9F"                       : customGnuArmA9Opts,
78     "gnu.targets.arm.A15F"                      : customGnuArmA15Opts,
79 };
81 /*
82  *  ======== module$meta$init ========
83  */
84 function module$meta$init()
85 {
86     /* Only process during "cfg" phase */
87     if (xdc.om.$name != "cfg") {
88         return;
89     }
91     Build = this;
93     /*
94      * Set default verbose level for custom build flow
95      * User can override this in their cfg file.
96      */
97     var SourceDir = xdc.module("xdc.cfg.SourceDir");
98     SourceDir.verbose = 2;
100     /* register onSet hooks */
101     var GetSet = xdc.module("xdc.services.getset.GetSet");
102     GetSet.onSet(this, "libType", _setLibType);
104     /* Construct default customCCOpts value.
105      * User can override this in their cfg file.
106      */
107     Build.customCCOpts = Build.getDefaultCustomCCOpts();
110 /*
111  *  ======== module$use ========
112  */
113 function module$use()
115     BIOS = xdc.module("ti.sysbios.BIOS");
116     var profile;
118     /* inform ti.sdo.utils.Build *not* to contribute libraries */
119 //  xdc.module("ti.sdo.utils.Build").doBuild = false;
121     /* if Build.libType is undefined, use BIOS.libType */
122     if (Build.libType == undefined) {
123         switch (BIOS.libType) {
124             case BIOS.LibType_Instrumented:
125                 Build.libType = Build.LibType_Instrumented;
126                 break;
127             case BIOS.LibType_NonInstrumented:
128                 Build.libType = Build.LibType_NonInstrumented;
129                 break;
130             case BIOS.LibType_Custom:
131                 Build.libType = Build.LibType_Custom;
132                 break;
133             case BIOS.LibType_Debug:
134                 Build.libType = Build.LibType_Debug;
135                 break;
136         }
137     }
139     /*  Get the profile associated with the ti.sdo.ipc package. The
140      *  profile may be specified per package with a line like this
141      *  in your .cfg script:
142      *
143      *  xdc.loadPackage('ti.sdo.ipc').profile = "release";
144      */
145     if (this.$package.profile != undefined) {
146         profile = this.$package.profile;
147     }
148     else {
149         profile = Program.build.profile;
150     }
152     /* gracefully handle non-supported whole_program profiles */
153     if (profile.match(/whole_program/) &&
154             (Build.libType != Build.LibType_Debug)) {
156         /* allow build to proceed */
157         Build.libType = Build.LibType_Debug;
158         /* but warning the user */
159         Build.$logWarning(
160             "The '" + profile + "' build profile will not be supported " +
161             "in future releases of IPC. Use 'release' or 'debug' profiles " +
162             "together with the 'Build.libType' configuration parameter to " +
163             "specify your preferred library. See the compatibility section " +
164             "of your IPC release notes for more information.",
165             "Profile Deprecation Warning", Build);
166     }
168     /* inform getLibs() about location of library */
169     switch (Build.libType) {
170         case Build.LibType_Instrumented:
171             this.$private.libraryName = "/ipc.a" + Program.build.target.suffix;
172             this.$private.outputDir = this.$package.packageBase + "lib/" +
173                 (BIOS.smpEnabled ? "smpipc/instrumented/":"ipc/instrumented/");
174             break;
176         case Build.LibType_NonInstrumented:
177             this.$private.libraryName = "/ipc.a" + Program.build.target.suffix;
178             this.$private.outputDir = this.$package.packageBase + "lib/" +
179                 (BIOS.smpEnabled ? "smpipc/nonInstrumented/" :
180                 "ipc/nonInstrumented/");
181             break;
183         case Build.LibType_Debug:
184         case Build.LibType_Custom:
185             this.$private.libraryName = "/ipc.a" + Program.build.target.suffix;
186             var SourceDir = xdc.useModule("xdc.cfg.SourceDir");
187             /* if building a pre-built library */
188             if (BIOS.buildingAppLib == false) {
189                 var appName = Program.name.substring(0,
190                         Program.name.lastIndexOf('.'));
191                 this.$private.libDir = this.$package.packageBase + Build.libDir;
192                 if (!java.io.File(this.$private.libDir).exists()) {
193                     java.io.File(this.$private.libDir).mkdir();
194                 }
195             }
196             /*
197              * If building an application in CCS or package.bld world
198              * and libDir has been specified
199              */
200             if ((BIOS.buildingAppLib == true) && (Build.libDir !== null)) {
201                 SourceDir.outputDir = Build.libDir;
202                 var src = SourceDir.create("ipc");
203                 src.libraryName = this.$private.libraryName.substring(1);
204                 this.$private.outputDir = src.getGenSourceDir();
205             }
206             else {
207                 var curPath = java.io.File(".").getCanonicalPath();
208                 /* If package.bld world AND building an application OR
209                  * pre-built lib... */
210                 if (java.io.File(curPath).getName() != "configPkg") {
211                     var appName = Program.name.substring(0,
212                             Program.name.lastIndexOf('.'));
213                     appName = appName + "_p" + Program.build.target.suffix +
214                             ".src";
215                     SourceDir.outputDir = "package/cfg/" + appName;
216                     SourceDir.toBuildDir = ".";
217                     var src = SourceDir.create("ipc");
218                     src.libraryName = this.$private.libraryName.substring(1);
219                     this.$private.outputDir = src.getGenSourceDir();
220                 }
221                 /* Here ONLY if building an application in CCS world */
222                 else {
223                     /* request output source directory for generated files */
224                     var appName = Program.name.substring(0,
225                             Program.name.lastIndexOf('.'));
226                     appName = appName + "_" + Program.name.substr(
227                             Program.name.lastIndexOf('.')+1);
228                     SourceDir.toBuildDir = "..";
229                     var src = SourceDir.create("ipc/");
230                     src.libraryName = this.$private.libraryName.substring(1);
232                     /*  save this directory in our private state (to be
233                      *  read during generation, see Gen.xdt)
234                      */
235                     this.$private.outputDir = src.getGenSourceDir();
236                 }
237             }
238             break;
239     }
242 /*
243  *  ======== module$validate ========
244  *  Some redundant tests are here to catch changes since
245  *  module$static$init() and instance$static$init().
246  */
247 function module$validate()
249     var Defaults = xdc.module('xdc.runtime.Defaults');
250     var Diags = xdc.module("xdc.runtime.Diags");
251     var libType = getEnumString(Build.libType);
253     switch (Build.libType) {
254         case Build.LibType_Instrumented:
255             if (Build.assertsEnabled == false) {
256                 Build.$logWarning(
257                         "Build.assertsEnabled must be set to true when " +
258                         "Build.libType == Build." + libType + ". " + "Set " +
259                         "Build.libType = Build.LibType_Custom to build a " +
260                         "custom library or update your configuration.",
261                         Build, "assertsEnabled");
262             }
263             if (Build.logsEnabled == false) {
264                 Build.$logWarning(
265                         "Build.logsEnabled must be set to true when " +
266                         "Build.libType == Build." + libType + ". " + "Set " +
267                         "Build.libType = Build.LibType_Custom to build a " +
268                         "custom library or update your configuration.",
269                         Build, "logsEnabled");
270             }
271             break;
273         case Build.LibType_NonInstrumented:
274             if ((Build.assertsEnabled == true) &&
275                     Build.$written("assertsEnabled")){
276                 Build.$logWarning(
277                         "Build.assertsEnabled must be set to false when " +
278                         "Build.libType == Build." + libType + ". " + "Set " +
279                         "Build.libType = Build.LibType_Custom to build a " +
280                         "custom library or update your configuration.",
281                         Build, "assertsEnabled");
282             }
283             if ((Build.logsEnabled == true) && Build.$written("logsEnabled")) {
284                 Build.$logWarning(
285                         "Build.logsEnabled must be set to false when " +
286                         "Build.libType == Build." + libType + ". " + "Set " +
287                         "Build.libType = Build.LibType_Custom to build a " +
288                         "custom library or update your configuration.",
289                         Build, "logsEnabled");
290             }
291             break;
293         case Build.LibType_Custom:
294             if ((Build.assertsEnabled == true)
295                 && (Defaults.common$.diags_ASSERT == Diags.ALWAYS_OFF)
296                 && (Defaults.common$.diags_INTERNAL == Diags.ALWAYS_OFF)) {
297                 Build.$logWarning(
298                         "Build.assertsEnabled should be set to 'false' when " +
299                         "Defaults.common$.diags_ASSERT == Diags.ALWAYS_OFF.",
300                         Build, "assertsEnabled");
301             }
302             break;
303     }
306 /*
307  *  ======== getCCOpts ========
308  */
309 function getCCOpts(target)
311     return(Build.customCCOpts);
314 /*
315  *  ======== getEnumString ========
316  *  Return the enum value as a string.
317  *
318  *  Example usage:
319  *  If obj contains an enumeration type property "Enum enumProp"
320  *
321  *  view.enumString = getEnumString(obj.enumProp);
322  */
323 function getEnumString(enumProperty)
325     /*  Split the string into tokens in order to get rid of the
326      *  huge package path that precedes the enum string name.
327      *  Return the last two tokens concatenated with "_".
328      */
329     var enumStrArray = String(enumProperty).split(".");
330     var len = enumStrArray.length;
331     return (enumStrArray[len - 1]);
334 /*
335  * Add pre-built Instrumented and Non-Intrumented release libs
336  */
337 var ipcSources  =  "ipc/GateMP.c " +
338                    "ipc/ListMP.c " +
339                    "ipc/SharedRegion.c " +
340                    "ipc/MessageQ.c " +
341                    "ipc/Ipc.c " +
342                    "ipc/Notify.c ";
344 var gatesSources = "ipc/gates/GatePeterson.c " +
345                    "ipc/gates/GatePetersonN.c " +
346                    "ipc/gates/GateMPSupportNull.c ";
348 var heapsSources = "ipc/heaps/HeapBufMP.c " +
349                    "ipc/heaps/HeapMemMP.c " +
350                    "ipc/heaps/HeapMultiBufMP.c ";
352 var notifyDriverSources =
353                    "ipc/notifyDrivers/NotifyDriverCirc.c " +
354                    "ipc/notifyDrivers/NotifySetupNull.c " +
355                    "ipc/notifyDrivers/NotifyDriverShm.c ";
357 var nsremoteSources =
358                    "ipc/nsremote/NameServerRemoteNotify.c " +
359                    "ipc/nsremote/NameServerMessageQ.c ";
361 var transportsSources =
362                    "ipc/transports/TransportShm.c " +
363                    "ipc/transports/TransportShmCircSetup.c " +
364                    "ipc/transports/TransportShmNotifySetup.c " +
365                    "ipc/transports/TransportShmCirc.c " +
366                    "ipc/transports/TransportShmNotify.c " +
367                    "ipc/transports/TransportShmSetup.c " +
368                    "ipc/transports/TransportNullSetup.c " ;
370 var utilsSources = "utils/MultiProc.c " +
371                    "utils/List.c " +
372                    "utils/NameServerRemoteNull.c " +
373                    "utils/NameServer.c ";
375 var commonSources = ipcSources +
376                     gatesSources +
377                     heapsSources +
378                     notifyDriverSources +
379                     nsremoteSources +
380                     transportsSources;
381 //                  utilsSources;
383 var C64PSources  = "ipc/gates/GateAAMonitor.c " +
384                    "ipc/gates/GateHWSpinlock.c " +
385                    "ipc/gates/GateHWSem.c " +
386                    "ipc/family/dm6446/NotifySetup.c " +
387                    "ipc/family/dm6446/NotifyCircSetup.c " +
388                    "ipc/family/dm6446/InterruptDsp.c " +
389                    "ipc/family/omap3530/NotifySetup.c " +
390                    "ipc/family/omap3530/NotifyCircSetup.c " +
391                    "ipc/family/omap3530/InterruptDsp.c ";
393 var C66Sources   = "ipc/gates/GateHWSem.c " +
394                    "ipc/gates/GateHWSpinlock.c " +
395                    "ipc/family/tci663x/Interrupt.c " +
396                    "ipc/family/tci663x/MultiProcSetup.c " +
397                    "ipc/family/tci663x/NotifyCircSetup.c " +
398                    "ipc/family/tci663x/NotifySetup.c " +
399                    "ipc/family/vayu/InterruptDsp.c " +
400                    "ipc/family/vayu/NotifyDriverMbx.c " +
401                    "ipc/family/vayu/NotifySetup.c " +
402                    "ipc/family/tda3xx/InterruptDsp.c " +
403                    "ipc/family/tda3xx/NotifyDriverMbx.c " +
404                    "ipc/family/tda3xx/NotifySetup.c ";
406 var C674Sources  = "ipc/gates/GateHWSpinlock.c " +
407                    "ipc/family/da830/NotifySetup.c " +
408                    "ipc/family/da830/NotifyCircSetup.c " +
409                    "ipc/family/da830/InterruptDsp.c " +
410                    "ipc/family/arctic/NotifySetup.c " +
411                    "ipc/family/arctic/NotifyCircSetup.c " +
412                    "ipc/family/arctic/InterruptDsp.c " +
413                    "ipc/family/ti81xx/NotifySetup.c " +
414                    "ipc/family/ti81xx/NotifyCircSetup.c " +
415                    "ipc/family/ti81xx/InterruptDsp.c " +
416                    "ipc/family/ti81xx/NotifyMbxSetup.c " +
417                    "ipc/family/ti81xx/NotifyDriverMbx.c " +
418                    "ipc/family/c6a8149/NotifySetup.c " +
419                    "ipc/family/c6a8149/NotifyCircSetup.c " +
420                    "ipc/family/c6a8149/InterruptDsp.c " +
421                    "ipc/family/c6a8149/NotifyMbxSetup.c " +
422                    "ipc/family/c6a8149/NotifyDriverMbx.c ";
424 var C647xSources = "ipc/family/c647x/Interrupt.c " +
425                    "ipc/family/c647x/NotifyCircSetup.c " +
426                    "ipc/family/c647x/MultiProcSetup.c " +
427                    "ipc/family/c647x/NotifySetup.c ";
429 var C64TSources  = "ipc/gates/GateHWSpinlock.c " +
430                    "ipc/family/omap4430/NotifyCircSetup.c " +
431                    "ipc/family/omap4430/NotifySetup.c " +
432                    "ipc/family/omap4430/InterruptDsp.c ";
434 var C28Sources   = "ipc/family/f28m35x/NotifyDriverCirc.c " +
435                    "ipc/family/f28m35x/IpcMgr.c " +
436                    "ipc/family/f28m35x/TransportCirc.c " +
437                    "ipc/family/f28m35x/NameServerBlock.c " +
438                    "ipc/family/f2837x/NotifyDriverCirc.c " +
439                    "ipc/family/f2837x/IpcMgr.c " +
440                    "ipc/family/f2837x/TransportCirc.c " +
441                    "ipc/family/f2837x/NameServerBlock.c ";
443 var M3Sources    = "ipc/gates/GateHWSpinlock.c " +
444                    "ipc/family/omap4430/NotifySetup.c " +
445                    "ipc/family/omap4430/NotifyCircSetup.c " +
446                    "ipc/family/omap4430/InterruptDucati.c " +
447                    "ipc/family/ti81xx/NotifySetup.c " +
448                    "ipc/family/ti81xx/NotifyCircSetup.c " +
449                    "ipc/family/ti81xx/InterruptDucati.c " +
450                    "ipc/family/ti81xx/NotifyMbxSetup.c " +
451                    "ipc/family/ti81xx/NotifyDriverMbx.c " +
452                    "ipc/family/c6a8149/NotifySetup.c " +
453                    "ipc/family/c6a8149/NotifyCircSetup.c " +
454                    "ipc/family/c6a8149/InterruptDucati.c " +
455                    "ipc/family/c6a8149/NotifyMbxSetup.c " +
456                    "ipc/family/c6a8149/NotifyDriverMbx.c " +
457                    "ipc/family/f28m35x/IpcMgr.c " +
458                    "ipc/family/f28m35x/NotifyDriverCirc.c " +
459                    "ipc/family/f28m35x/TransportCirc.c " +
460                    "ipc/family/f28m35x/NameServerBlock.c " +
461                    "ipc/family/vayu/InterruptIpu.c " +
462                    "ipc/family/vayu/NotifyDriverMbx.c " +
463                    "ipc/family/vayu/NotifySetup.c " +
464                    "ipc/family/tda3xx/InterruptIpu.c " +
465                    "ipc/family/tda3xx/NotifyDriverMbx.c " +
466                    "ipc/family/tda3xx/NotifySetup.c ";
468 var M4Sources    = "ipc/gates/GateHWSpinlock.c " +
469                    "ipc/family/vayu/InterruptIpu.c " +
470                    "ipc/family/vayu/NotifyDriverMbx.c " +
471                    "ipc/family/vayu/NotifySetup.c " +
472                    "ipc/family/tda3xx/InterruptIpu.c " +
473                    "ipc/family/tda3xx/NotifyDriverMbx.c " +
474                    "ipc/family/tda3xx/NotifySetup.c ";
476 var Arm9Sources  = "ipc/family/dm6446/NotifySetup.c " +
477                    "ipc/family/dm6446/NotifyCircSetup.c " +
478                    "ipc/family/dm6446/InterruptArm.c " +
479                    "ipc/family/da830/NotifySetup.c " +
480                    "ipc/family/da830/NotifyCircSetup.c " +
481                    "ipc/family/da830/InterruptArm.c ";
483 var A8FSources   = "ipc/gates/GateHWSpinlock.c " +
484                    "ipc/family/ti81xx/NotifySetup.c " +
485                    "ipc/family/ti81xx/NotifyCircSetup.c " +
486                    "ipc/family/ti81xx/InterruptHost.c " +
487                    "ipc/family/ti81xx/NotifyMbxSetup.c " +
488                    "ipc/family/ti81xx/NotifyDriverMbx.c " +
489                    "ipc/family/c6a8149/NotifySetup.c " +
490                    "ipc/family/c6a8149/NotifyCircSetup.c " +
491                    "ipc/family/c6a8149/InterruptHost.c " +
492                    "ipc/family/c6a8149/NotifyMbxSetup.c " +
493                    "ipc/family/c6a8149/NotifyDriverMbx.c " +
494                    "ipc/family/omap3530/NotifySetup.c " +
495                    "ipc/family/omap3530/NotifyCircSetup.c " +
496                    "ipc/family/omap3530/InterruptHost.c ";
498 var A8gSources  = "ipc/gates/GateHWSpinlock.c " +
499                    "ipc/family/ti81xx/NotifySetup.c " +
500                    "ipc/family/ti81xx/NotifyCircSetup.c " +
501                    "ipc/family/ti81xx/InterruptHost.c " +
502                    "ipc/family/ti81xx/NotifyMbxSetup.c " +
503                    "ipc/family/ti81xx/NotifyDriverMbx.c " +
504                    "ipc/family/c6a8149/NotifySetup.c " +
505                    "ipc/family/c6a8149/NotifyCircSetup.c " +
506                    "ipc/family/c6a8149/InterruptHost.c " +
507                    "ipc/family/c6a8149/NotifyMbxSetup.c " +
508                    "ipc/family/c6a8149/NotifyDriverMbx.c " +
509                    "ipc/family/omap3530/NotifySetup.c " +
510                    "ipc/family/omap3530/NotifyCircSetup.c " +
511                    "ipc/family/omap3530/InterruptHost.c ";
513 var A15gSources  = "ipc/family/vayu/InterruptHost.c " +
514                    "ipc/family/vayu/NotifyDriverMbx.c " +
515                    "ipc/family/vayu/NotifySetup.c " +
516                    "ipc/gates/GateHWSpinlock.c ";
518 var ARP32Sources = "ipc/gates/GateHWSpinlock.c " +
519                    "ipc/family/arctic/NotifySetup.c " +
520                    "ipc/family/arctic/NotifyCircSetup.c " +
521                    "ipc/family/arctic/InterruptArp32.c " +
522                    "ipc/family/c6a8149/NotifySetup.c " +
523                    "ipc/family/c6a8149/NotifyCircSetup.c " +
524                    "ipc/family/c6a8149/InterruptEve.c " +
525                    "ipc/family/vayu/InterruptArp32.c " +
526                    "ipc/family/vayu/NotifyDriverMbx.c " +
527                    "ipc/family/vayu/NotifySetup.c " +
528                    "ipc/family/tda3xx/InterruptArp32.c " +
529                    "ipc/family/tda3xx/NotifyDriverMbx.c " +
530                    "ipc/family/tda3xx/NotifySetup.c ";
532 var cList = {
533     "ti.targets.C28_large"              : commonSources + C28Sources,
534     "ti.targets.C28_float"              : commonSources + C28Sources,
536     "ti.targets.C64P"                   : commonSources + C647xSources +
537                                                 C64PSources,
538     "ti.targets.C64P_big_endian"        : commonSources + C647xSources +
539                                                 C64PSources,
540     "ti.targets.C674"                   : commonSources + C674Sources,
542     "ti.targets.elf.C64P"               : commonSources + C647xSources +
543                                                 C64PSources,
544     "ti.targets.elf.C64P_big_endian"    : commonSources + C647xSources +
545                                                 C64PSources,
546     "ti.targets.elf.C674"               : commonSources + C674Sources,
547     "ti.targets.elf.C64T"               : commonSources + C64TSources,
548     "ti.targets.elf.C66"                : commonSources + C647xSources +
549                                                 C66Sources,
550     "ti.targets.elf.C66_big_endian"     : commonSources + C647xSources +
551                                                 C66Sources,
553     "ti.targets.arp32.elf.ARP32"        : commonSources + ARP32Sources,
554     "ti.targets.arp32.elf.ARP32_far"    : commonSources + ARP32Sources,
556     "ti.targets.arm.elf.Arm9"           : commonSources + Arm9Sources,
557     "ti.targets.arm.elf.A8F"            : commonSources + A8FSources,
558     "ti.targets.arm.elf.A8Fnv"          : commonSources + A8FSources,
559     "ti.targets.arm.elf.M3"             : commonSources + M3Sources,
560     "ti.targets.arm.elf.M4"             : commonSources + M4Sources,
561     "ti.targets.arm.elf.M4F"            : commonSources + M4Sources,
563     "gnu.targets.arm.A15F"              : commonSources + A15gSources,
564     "gnu.targets.arm.A8F"               : commonSources + A8gSources,
565     "gnu.targets.arm.M3"                : commonSources + M3Sources,
566     "gnu.targets.arm.M4"                : commonSources + M4Sources,
567     "gnu.targets.arm.M4F"               : commonSources + M4Sources,
568 };
570 var cFiles = { };
572 var ipcPackages = [
573     "ti.sdo.ipc",
574     "ti.sdo.ipc.family.omap4430",
575     "ti.sdo.ipc.family.omap3530",
576     "ti.sdo.ipc.family.da830",
577     "ti.sdo.ipc.family.dm6446",
578     "ti.sdo.ipc.family.ti81xx",
579     "ti.sdo.ipc.family.arctic",
580     "ti.sdo.ipc.family.f28m35x",
581     "ti.sdo.ipc.family.f2837x",
582     "ti.sdo.ipc.family.c647x",
583     "ti.sdo.ipc.family.c6a8149",
584     "ti.sdo.ipc.family.tci663x",
585     "ti.sdo.ipc.family.tda3xx",
586     "ti.sdo.ipc.family.vayu",
587     "ti.sdo.ipc.gates",
588     "ti.sdo.ipc.heaps",
589     "ti.sdo.ipc.notifyDrivers",
590     "ti.sdo.ipc.nsremote",
591     "ti.sdo.ipc.transports",
592     "ti.sdo.utils",
593 ];
595 var asmListNone = [
596 ];
598 var asmList64P = [
599     "ipc/gates/GateAAMonitor_asm.s64P",
600 ];
602 var asmList = {
603     "ti.targets.C28_large"              : asmListNone,
604     "ti.targets.C28_float"              : asmListNone,
606     "ti.targets.C64P"                   : asmList64P,
607     "ti.targets.C64P_big_endian"        : asmList64P,
608     "ti.targets.C674"                   : asmList64P,
610     "ti.targets.elf.C64P"               : asmList64P,
611     "ti.targets.elf.C64P_big_endian"    : asmList64P,
612     "ti.targets.elf.C674"               : asmList64P,
614     "ti.targets.elf.C64T"               : asmListNone,
615     "ti.targets.elf.C66"                : asmListNone,
616     "ti.targets.elf.C66_big_endian"     : asmListNone,
618     "ti.targets.arp32.elf.ARP32"        : asmListNone,
619     "ti.targets.arp32.elf.ARP32_far"    : asmListNone,
621     "ti.targets.arm.elf.Arm9"           : asmListNone,
622     "ti.targets.arm.elf.A8F"            : asmListNone,
623     "ti.targets.arm.elf.A8Fnv"          : asmListNone,
624     "ti.targets.arm.elf.M3"             : asmListNone,
625     "ti.targets.arm.elf.M4"             : asmListNone,
626     "ti.targets.arm.elf.M4F"            : asmListNone,
628     "gnu.targets.arm.M3"                : asmListNone,
629     "gnu.targets.arm.M4"                : asmListNone,
630     "gnu.targets.arm.M4F"               : asmListNone,
631     "gnu.targets.arm.A8F"               : asmListNone,
632     "gnu.targets.arm.A9F"               : asmListNone,
633     "gnu.targets.arm.A15F"              : asmListNone,
634 };
636 function getDefaultCustomCCOpts()
639     /* start with target.cc.opts */
640     var customCCOpts = Program.build.target.cc.opts;
642     /* add target unique custom ccOpts */
643     if (!(ccOptsList[Program.build.target.$name] === undefined)) {
644         customCCOpts += ccOptsList[Program.build.target.$name];
645     }
647     /* gnu targets need to pick up ccOpts.prefix and suffix */
648     if (Program.build.target.$name.match(/gnu/)) {
649         customCCOpts += " -O3 ";
650         customCCOpts += " " + Program.build.target.ccOpts.prefix + " ";
651         customCCOpts += " " + Program.build.target.ccOpts.suffix + " ";
652     }
653     else if (Program.build.target.$name.match(/iar/)) {
654         throw new Error("IAR not supported by IPC");
655     }
656     else {
657         /* ti targets do program level compile */
658         customCCOpts += " --program_level_compile -o3 -g " +
659                 "--optimize_with_debug ";
660     }
662     /* undo optimizations if this is a debug build */
663     if (Build.libType == Build.LibType_Debug) {
664         if (Program.build.target.$name.match(/gnu/)) {
665             customCCOpts = customCCOpts.replace("-O3","");
666             /* add in stack frames for stack back trace */
667             customCCOpts += " -mapcs ";
668         }
669         else {
670             customCCOpts = customCCOpts.replace(" -o3","");
671             customCCOpts = customCCOpts.replace(" --optimize_with_debug","");
672             if (Program.build.target.$name.match(/arm/)) {
673                 customCCOpts = customCCOpts.replace(" --opt_for_speed=2","");
674             }
675         }
676     }
678     return (customCCOpts);
681 /*
682  *  ======== getDefs ========
683  */
684 function getDefs()
686     var Defaults = xdc.module('xdc.runtime.Defaults');
687     var Diags = xdc.module("xdc.runtime.Diags");
688     var BIOS = xdc.module("ti.sysbios.BIOS");
689     var MessageQ = xdc.module("ti.sdo.ipc.MessageQ");
691     var defs = "";
693     if ((Build.assertsEnabled == false) ||
694         ((Defaults.common$.diags_ASSERT == Diags.ALWAYS_OFF)
695             && (Defaults.common$.diags_INTERNAL == Diags.ALWAYS_OFF))) {
696         defs += " -Dxdc_runtime_Assert_DISABLE_ALL";
697     }
699     if (Build.logsEnabled == false) {
700         defs += " -Dxdc_runtime_Log_DISABLE_ALL";
701     }
703     defs += " -Dti_sdo_ipc_MessageQ_traceFlag__D=" +
704             (MessageQ.traceFlag ? "TRUE" : "FALSE");
706     var InterruptDucati =
707             xdc.module("ti.sdo.ipc.family.ti81xx.InterruptDucati");
709     /* If we truely know which platform we're building against,
710      * add these application specific -D's
711      */
712     if (BIOS.buildingAppLib == true) {
713         defs += " -Dti_sdo_ipc_family_ti81xx_InterruptDucati_videoProcId__D="
714                 + InterruptDucati.videoProcId;
715         defs += " -Dti_sdo_ipc_family_ti81xx_InterruptDucati_hostProcId__D="
716                 + InterruptDucati.hostProcId;
717         defs += " -Dti_sdo_ipc_family_ti81xx_InterruptDucati_vpssProcId__D="
718                 + InterruptDucati.vpssProcId;
719         defs += " -Dti_sdo_ipc_family_ti81xx_InterruptDucati_dspProcId__D="
720                 + InterruptDucati.dspProcId;
721         defs +=
722             " -Dti_sdo_ipc_family_ti81xx_InterruptDucati_ducatiCtrlBaseAddr__D="
723             + InterruptDucati.ducatiCtrlBaseAddr;
724         defs +=
725             " -Dti_sdo_ipc_family_ti81xx_InterruptDucati_mailboxBaseAddr__D="
726             + InterruptDucati.mailboxBaseAddr;
727     }
729     return (defs);
732 /*
733  *  ======== getCFiles ========
734  */
735 function getCFiles(target)
737     var localSources = "";
739     if (BIOS.buildingAppLib == true) {
740         var targetModules = Program.targetModules();
741         for (var m = 0; m < targetModules.length; m++) {
742             var mod = targetModules[m];
743             var mn = mod.$name;
744             var pn = mn.substring(0, mn.lastIndexOf("."));
746             /* sanity check package path */
747             var packageMatch = false;
749             for (var i = 0; i < ipcPackages.length; i++) {
750                 if (pn == ipcPackages[i]) {
751                     packageMatch = true;
752                     break;
753                 }
754             }
756             if (packageMatch && !mn.match(/Proxy/)) {
757                 if (cFiles[mn] === undefined) {
758                     var prefix = mn.substr(mn.indexOf("sdo")+4);
759                     var mod = mn.substr(mn.lastIndexOf(".")+1);
760                     prefix = prefix.substring(0, prefix.lastIndexOf('.')+1);
761                     prefix = prefix.replace(/\./g, "/");
762                     localSources += prefix + mod + ".c ";
763                 }
764                 else {
765                     for (i in cFiles[mn].cSources) {
766                         var prefix = mn.substr(mn.indexOf("sdo")+8);
767                         prefix = prefix.substring(0, prefix.lastIndexOf('.')+1);
768                         prefix = prefix.replace(/\./g, "/");
769                         localSources += prefix + cFiles[mn].cSources[i] + " ";
770                     }
771                 }
772             }
773         }
774     }
775     else {
776         localSources += cList[target];
777     }
779     /* remove trailing " " */
780     localSources = localSources.substring(0, localSources.length-1);
782     return (localSources);
785 /*
786  *  ======== getAsmFiles ========
787  */
788 function getAsmFiles(target)
790     return (asmList[target]);
793 /*
794  *  ======== getLibs ========
795  *  This function called by all IPC packages except ti.sdo.ipc package.
796  */
797 function getLibs(pkg)
799     var libPath = "";
800     var name = "";
801     var suffix;
803     switch (Build.libType) {
804         case Build.LibType_Custom:
805         case Build.LibType_Instrumented:
806         case Build.LibType_NonInstrumented:
807         case Build.LibType_Debug:
808             return null;
810         case Build.LibType_PkgLib:
811             throw new Error("internal error: Build.getLibs() called with " +
812                     "incorret context (libType == PkgLib)");
813             break;
815         default:
816             throw new Error("Build.libType not supported: " + Build.libType);
817             break;
818     }
821 /*
822  *  ======== getProfiles ========
823  *  Determines which profiles to build for.
824  *
825  *  Any argument in XDCARGS which does not contain platform= is treated
826  *  as a profile. This way multiple build profiles can be specified by
827  *  separating them with a space.
828  */
829 function getProfiles(xdcArgs)
831     /*
832      * cmdlProf[1] gets matched to "whole_program,debug" if
833      * ["abc", "profile=whole_program,debug"] is passed in as xdcArgs
834      */
835     var cmdlProf = (" " + xdcArgs.join(" ") + " ").match(/ profile=([^ ]+) /);
837     if (cmdlProf == null) {
838         /* No profile=XYZ found */
839         return [];
840     }
842     /* Split "whole_program,debug" into ["whole_program", "debug"] */
843     var profiles = cmdlProf[1].split(',');
845     return profiles;
848 /*
849  *  ======== buildLibs ========
850  *  This function generates the makefile goals for the libraries
851  *  produced by a package.
852  */
853 function buildLibs(objList, relList, filter, xdcArgs)
855     var Build = xdc.useModule('xdc.bld.BuildEnvironment');
857     for (var i = 0; i < Build.targets.length; i++) {
858         var targ = Build.targets[i];
860         /* skip target if not supported */
861         if (!supportsTarget(targ, filter)) {
862             continue;
863         }
865         var profiles = getProfiles(xdcArgs);
867         /* If no profiles were assigned, use only the default one. */
868         if (profiles.length == 0) {
869             profiles[0] = "debug";
870         }
872         for (var j = 0; j < profiles.length; j++) {
873             var ccopts = "";
874             var asmopts = "";
876             if (profiles[j] == "smp") {
877                 var libPath = "lib/smpipc/debug/";
878                 ccopts += " -Dti_sysbios_BIOS_smpEnabled__D=TRUE";
879                 asmopts += " -Dti_sysbios_BIOS_smpEnabled__D=TRUE";
880             }
881             else {
882                 var libPath = "lib/ipc/debug/";
883                 /* build all package libs using Hwi macros */
884                 ccopts += " -Dti_sysbios_Build_useHwiMacros";
885                 ccopts += " -Dti_sysbios_BIOS_smpEnabled__D=FALSE";
886                 asmopts += " -Dti_sysbios_BIOS_smpEnabled__D=FALSE";
887             }
889             /* confirm that this target supports this profile */
890             if (targ.profiles[profiles[j]] !== undefined) {
891                 var profile = profiles[j];
892                 var lib = Pkg.addLibrary(libPath + Pkg.name,
893                                 targ, {
894                                 profile: profile,
895                                 copts: ccopts,
896                                 aopts: asmopts,
897                                 releases: relList
898                                 });
899                 lib.addObjects(objList);
900             }
901         }
902     }
905 /*
906  *  ======== supportsTarget ========
907  *  Returns true if target is in the filter object. If filter
908  *  is null or empty, that's taken to mean all targets are supported.
909  */
910 function supportsTarget(target, filter)
912     var list, field;
914     if (filter == null) {
915         return true;
916     }
918     /*
919      * For backwards compatibility, we support filter as an array of
920      * target names.  The preferred approach is to specify filter as
921      * an object with 'field' and 'list' elements.
922      *
923      * Old form:
924      *     var trgFilter = [ "Arm9", "Arm9t", "Arm9t_big_endian" ]
925      *
926      * New (preferred) form:
927      *
928      *     var trgFilter = {
929      *         field: "isa",
930      *         list: [ "v5T", "v7R" ]
931      *     };
932      *
933      */
934     if (filter instanceof Array) {
935         list = filter;
936         field = "name";
937     }
938     else {
939         list = filter.list;
940         field = filter.field;
941     }
943     if (list == null || field == null) {
944         throw("invalid filter parameter, must specify list and field!");
945     }
947     if (field == "noIsa") {
948         if (String(','+list.toString()+',').match(','+target["isa"]+',')) {
949             return (false);
950         }
951         return (true);
952     }
954     /*
955      * add ',' at front and and tail of list and field strings to allow
956      * use of simple match API.  For example, the string is updated to:
957      * ',v5T,v7R,' to allow match of ',v5t,'.
958      */
959     if (String(','+list.toString()+',').match(','+target[field]+',')) {
960         return (true);
961     }
963     return (false);
966 /*
967  *  ======== _setLibType ========
968  *  The "real-time" setter setLibType function
969  *  This function is called whenever libType changes.
970  */
971 function _setLibType(field, val)
973     var Build = this;
975     if (val == Build.LibType_Instrumented) {
976         Build.assertsEnabled = true;
977         Build.logsEnabled = true;
978     }
979     else if (val == Build.LibType_NonInstrumented) {
980         Build.assertsEnabled = false;
981         Build.logsEnabled = false;
982     }
983     else if (val == Build.LibType_Custom) {
984         Build.assertsEnabled = true;
985         Build.logsEnabled = true;
986     }
987     else if (val == Build.LibType_Debug) {
988         Build.assertsEnabled = true;
989         Build.logsEnabled = true;
990     }
991     else if (val == Build.LibType_PkgLib) {
992         Build.assertsEnabled = true;
993         Build.logsEnabled = true;
994     }
995     else {
996         print(Build.$name + ": unknown libType setting: " + val);
997     }
999     /* re-construct default Build.customCCOpts */
1000     Build.customCCOpts = Build.getDefaultCustomCCOpts();