]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - ipc/ipcdev.git/blob - packages/ti/sdo/ipc/Build.xs
nsremote: Add additional check to handle assert disabled
[ipc/ipcdev.git] / packages / ti / sdo / ipc / Build.xs
1 /*
2  * Copyright (c) 2013-2018 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 custom6xOpts = " -q --opt_for_speed=2 -mi10 -mo -pdr -pden -pds=238 -pds=880 -pds1110 --mem_model:const=data --mem_model:data=far ";
42 var customARP32xOpts = " -q --gen_func_subsections ";
43 var customArmOpts = " -q -ms --opt_for_speed=2 ";
44 var customGnuArmM3Opts = " ";
45 var customGnuArmM4Opts = " ";
46 var customGnuArmM4FOpts = " ";
47 var customGnuArmA9Opts = " ";
48 var customGnuArmA8Opts = " ";
49 var customGnuArmA15Opts = " ";
50 var customGnuArmA53Opts = " ";
52 var ccOptsList = {
53     "ti.targets.C64P"                           : custom6xOpts,
54     "ti.targets.elf.C64P"                       : custom6xOpts,
55     "ti.targets.C674"                           : custom6xOpts,
56     "ti.targets.elf.C674"                       : custom6xOpts,
57     "ti.targets.elf.C67P"                       : custom6xOpts,
58     "ti.targets.elf.C64T"                       : custom6xOpts,
59     "ti.targets.elf.C66"                        : custom6xOpts,
60     "ti.targets.arp32.elf.ARP32"                : customARP32xOpts,
61     "ti.targets.arp32.elf.ARP32_far"            : customARP32xOpts,
62     "ti.targets.arm.elf.Arm9"                   : customArmOpts,
63     "ti.targets.arm.elf.A8F"                    : customArmOpts,
64     "ti.targets.arm.elf.A8Fnv"                  : customArmOpts,
65     "ti.targets.arm.elf.M3"                     : customArmOpts,
66     "ti.targets.arm.elf.M4"                     : customArmOpts,
67     "ti.targets.arm.elf.M4F"                    : customArmOpts,
68     "ti.targets.arm.elf.R5F"                    : customArmOpts,
69     "gnu.targets.arm.M3"                        : customGnuArmM3Opts,
70     "gnu.targets.arm.M4"                        : customGnuArmM4Opts,
71     "gnu.targets.arm.M4F"                       : customGnuArmM4FOpts,
72     "gnu.targets.arm.A8F"                       : customGnuArmA8Opts,
73     "gnu.targets.arm.A9F"                       : customGnuArmA9Opts,
74     "gnu.targets.arm.A15F"                      : customGnuArmA15Opts,
75     "gnu.targets.arm.A53F"                      : customGnuArmA53Opts,
76 };
78 var ipcPackages = [
79     "ti.sdo.ipc",
80     "ti.sdo.ipc.family.omap4430",
81     "ti.sdo.ipc.family.omap3530",
82     "ti.sdo.ipc.family.da830",
83     "ti.sdo.ipc.family.dm6446",
84     "ti.sdo.ipc.family.ti81xx",
85     "ti.sdo.ipc.family.arctic",
86     "ti.sdo.ipc.family.c647x",
87     "ti.sdo.ipc.family.c6a8149",
88     "ti.sdo.ipc.family.tci663x",
89     "ti.sdo.ipc.family.tda3xx",
90     "ti.sdo.ipc.family.vayu",
91     "ti.sdo.ipc.family.am65xx",
92     "ti.sdo.ipc.gates",
93     "ti.sdo.ipc.heaps",
94     "ti.sdo.ipc.notifyDrivers",
95     "ti.sdo.ipc.nsremote",
96     "ti.sdo.ipc.transports",
97     "ti.sdo.utils",
98     "ti.ipc.family.tci6614",
99     "ti.ipc.family.tci6638",
100     "ti.ipc.family.vayu",
101     "ti.ipc.family.am65xx",
102     "ti.ipc.namesrv",
103     "ti.ipc.remoteproc",
104     "ti.ipc.transports"
105 ];
107 var cFiles = {
108     "ti.ipc.ipcmgr" : {
109         cSources: [ "IpcMgr.c" ]
110     },
111     "ti.ipc.family.vayu" : {
112         cSources: [ "VirtQueue.c" ]
113     },
114     "ti.ipc.family.am65xx" : {
115         cSources: [ "VirtQueue.c" ]
116     },
117     "ti.ipc.rpmsg" : {
118         cSources: [ "NameMap.c", "RPMessage.c" ]
119     }
120 };
122 /*
123  *  ======== module$meta$init ========
124  */
125 function module$meta$init()
127     /* Only process during "cfg" phase */
128     if (xdc.om.$name != "cfg") {
129         return;
130     }
132     Build = this;
134     /*
135      * Set default verbose level for custom build flow
136      * User can override this in their cfg file.
137      */
138     var SourceDir = xdc.module("xdc.cfg.SourceDir");
139     SourceDir.verbose = 2;
141     /* register onSet hooks */
142     var GetSet = xdc.module("xdc.services.getset.GetSet");
143     GetSet.onSet(this, "libType", _setLibType);
145     /* Construct default customCCOpts value.
146      * User can override this in their cfg file.
147      */
148     Build.customCCOpts = Build.getDefaultCustomCCOpts();
150     /* needed by IPackage.close() method */
151     Build.$private.ipcPkgs = ipcPackages;
152     Build.$private.cFiles = cFiles;
155 /*
156  *  ======== module$use ========
157  */
158 function module$use()
160     BIOS = xdc.module("ti.sysbios.BIOS");
161     var profile;
163     /* inform ti.sdo.utils.Build *not* to contribute libraries */
164 //  xdc.module("ti.sdo.utils.Build").doBuild = false;
166     /* if Build.libType is undefined, use BIOS.libType */
167     if (Build.libType == undefined) {
168         switch (BIOS.libType) {
169             case BIOS.LibType_Instrumented:
170                 Build.libType = Build.LibType_Instrumented;
171                 break;
172             case BIOS.LibType_NonInstrumented:
173                 Build.libType = Build.LibType_NonInstrumented;
174                 break;
175             case BIOS.LibType_Custom:
176                 Build.libType = Build.LibType_Custom;
177                 break;
178             case BIOS.LibType_Debug:
179                 Build.libType = Build.LibType_Debug;
180                 break;
181         }
182     }
184     /*  Get the profile associated with the ti.sdo.ipc package. The
185      *  profile may be specified per package with a line like this
186      *  in your .cfg script:
187      *
188      *  xdc.loadPackage('ti.sdo.ipc').profile = "release";
189      */
190     if (this.$package.profile != undefined) {
191         profile = this.$package.profile;
192     }
193     else {
194         profile = Program.build.profile;
195     }
197     /* gracefully handle non-supported whole_program profiles */
198     if (profile.match(/whole_program/) &&
199             (Build.libType != Build.LibType_Debug)) {
201         /* allow build to proceed */
202         Build.libType = Build.LibType_Debug;
203         /* but warning the user */
204         Build.$logWarning(
205             "The '" + profile + "' build profile will not be supported " +
206             "in future releases of IPC. Use 'release' or 'debug' profiles " +
207             "together with the 'Build.libType' configuration parameter to " +
208             "specify your preferred library. See the compatibility section " +
209             "of your IPC release notes for more information.",
210             "Profile Deprecation Warning", Build);
211     }
213     /* inform getLibs() about location of library */
214     switch (Build.libType) {
215         case Build.LibType_Instrumented:
216             this.$private.libraryName = "/ipc.a" + Program.build.target.suffix;
217             this.$private.outputDir = this.$package.packageBase + "lib/" +
218                 (BIOS.smpEnabled ? "smpipc/instrumented/":"ipc/instrumented/");
219             break;
221         case Build.LibType_NonInstrumented:
222             this.$private.libraryName = "/ipc.a" + Program.build.target.suffix;
223             this.$private.outputDir = this.$package.packageBase + "lib/" +
224                 (BIOS.smpEnabled ? "smpipc/nonInstrumented/" :
225                 "ipc/nonInstrumented/");
226             break;
228         case Build.LibType_Debug:
229         case Build.LibType_Custom:
230             this.$private.libraryName = "/ipc.a" + Program.build.target.suffix;
231             var SourceDir = xdc.useModule("xdc.cfg.SourceDir");
232             /* if building a pre-built library */
233             if (BIOS.buildingAppLib == false) {
234                 var appName = Program.name.substring(0,
235                         Program.name.lastIndexOf('.'));
236                 this.$private.libDir = this.$package.packageBase + Build.libDir;
237                 if (!java.io.File(this.$private.libDir).exists()) {
238                     java.io.File(this.$private.libDir).mkdir();
239                 }
240             }
241             /*
242              * If building an application in CCS or package.bld world
243              * and libDir has been specified
244              */
245             if ((BIOS.buildingAppLib == true) && (Build.libDir !== null)) {
246                 SourceDir.outputDir = Build.libDir;
247                 var src = SourceDir.create("ipc");
248                 src.libraryName = this.$private.libraryName.substring(1);
249                 this.$private.outputDir = src.getGenSourceDir();
250             }
251             else {
252                 var curPath = java.io.File(".").getCanonicalPath();
253                 /* If package.bld world AND building an application OR
254                  * pre-built lib... */
255                 if (java.io.File(curPath).getName() != "configPkg") {
256                     var appName = Program.name.substring(0,
257                             Program.name.lastIndexOf('.'));
258                     appName = appName + "_p" + Program.build.target.suffix +
259                             ".src";
260                     SourceDir.outputDir = "package/cfg/" + appName;
261                     SourceDir.toBuildDir = ".";
262                     var src = SourceDir.create("ipc");
263                     src.libraryName = this.$private.libraryName.substring(1);
264                     this.$private.outputDir = src.getGenSourceDir();
265                 }
266                 /* Here ONLY if building an application in CCS world */
267                 else {
268                     /* request output source directory for generated files */
269                     var appName = Program.name.substring(0,
270                             Program.name.lastIndexOf('.'));
271                     appName = appName + "_" + Program.name.substr(
272                             Program.name.lastIndexOf('.')+1);
273                     SourceDir.toBuildDir = "..";
274                     var src = SourceDir.create("ipc/");
275                     src.libraryName = this.$private.libraryName.substring(1);
277                     /*  save this directory in our private state (to be
278                      *  read during generation, see Gen.xdt)
279                      */
280                     this.$private.outputDir = src.getGenSourceDir();
281                 }
282             }
283             break;
284     }
287 /*
288  *  ======== module$validate ========
289  *  Some redundant tests are here to catch changes since
290  *  module$static$init() and instance$static$init().
291  */
292 function module$validate()
294     var Defaults = xdc.module('xdc.runtime.Defaults');
295     var Diags = xdc.module("xdc.runtime.Diags");
296     var libType = getEnumString(Build.libType);
298     switch (Build.libType) {
299         case Build.LibType_Instrumented:
300             if (Build.assertsEnabled == false) {
301                 Build.$logWarning(
302                         "Build.assertsEnabled must be set to true when " +
303                         "Build.libType == Build." + libType + ". " + "Set " +
304                         "Build.libType = Build.LibType_Custom to build a " +
305                         "custom library or update your configuration.",
306                         Build, "assertsEnabled");
307             }
308             if (Build.logsEnabled == false) {
309                 Build.$logWarning(
310                         "Build.logsEnabled must be set to true when " +
311                         "Build.libType == Build." + libType + ". " + "Set " +
312                         "Build.libType = Build.LibType_Custom to build a " +
313                         "custom library or update your configuration.",
314                         Build, "logsEnabled");
315             }
316             break;
318         case Build.LibType_NonInstrumented:
319             if ((Build.assertsEnabled == true) &&
320                     Build.$written("assertsEnabled")){
321                 Build.$logWarning(
322                         "Build.assertsEnabled must be set to false when " +
323                         "Build.libType == Build." + libType + ". " + "Set " +
324                         "Build.libType = Build.LibType_Custom to build a " +
325                         "custom library or update your configuration.",
326                         Build, "assertsEnabled");
327             }
328             if ((Build.logsEnabled == true) && Build.$written("logsEnabled")) {
329                 Build.$logWarning(
330                         "Build.logsEnabled must be set to false when " +
331                         "Build.libType == Build." + libType + ". " + "Set " +
332                         "Build.libType = Build.LibType_Custom to build a " +
333                         "custom library or update your configuration.",
334                         Build, "logsEnabled");
335             }
336             break;
338         case Build.LibType_Custom:
339             if ((Build.assertsEnabled == true)
340                 && (Defaults.common$.diags_ASSERT == Diags.ALWAYS_OFF)
341                 && (Defaults.common$.diags_INTERNAL == Diags.ALWAYS_OFF)) {
342                 Build.$logWarning(
343                         "Build.assertsEnabled should be set to 'false' when " +
344                         "Defaults.common$.diags_ASSERT == Diags.ALWAYS_OFF.",
345                         Build, "assertsEnabled");
346             }
347             break;
348     }
351 /*
352  *  ======== getCCOpts ========
353  */
354 function getCCOpts(target)
357     return (Build.customCCOpts);
360 /*
361  *  ======== getEnumString ========
362  *  Return the enum value as a string.
363  *
364  *  Example usage:
365  *  If obj contains an enumeration type property "Enum enumProp"
366  *
367  *  view.enumString = getEnumString(obj.enumProp);
368  */
369 function getEnumString(enumProperty)
371     /*  Split the string into tokens in order to get rid of the
372      *  huge package path that precedes the enum string name.
373      *  Return the last two tokens concatenated with "_".
374      */
375     var enumStrArray = String(enumProperty).split(".");
376     var len = enumStrArray.length;
377     return (enumStrArray[len - 1]);
380 /*
381  * Add pre-built Instrumented and Non-Intrumented release libs
382  */
383 var ipcSources  =  "ti/sdo/ipc/GateMP.c " +
384                    "ti/sdo/ipc/ListMP.c " +
385                    "ti/sdo/ipc/SharedRegion.c " +
386                    "ti/sdo/ipc/MessageQ.c " +
387                    "ti/sdo/ipc/Ipc.c " +
388                    "ti/sdo/ipc/Notify.c " +
389                    "ti/ipc/namesrv/NameServerRemoteRpmsg.c " +
390                    "ti/ipc/remoteproc/Resource.c ";
392 var gatesSources = "ti/sdo/ipc/gates/GatePeterson.c " +
393                    "ti/sdo/ipc/gates/GatePetersonN.c " +
394                    "ti/sdo/ipc/gates/GateMPSupportNull.c ";
396 var heapsSources = "ti/sdo/ipc/heaps/HeapBufMP.c " +
397                    "ti/sdo/ipc/heaps/HeapMemMP.c " +
398                    "ti/sdo/ipc/heaps/HeapMultiBufMP.c ";
400 var notifyDriverSources =
401                    "ti/sdo/ipc/notifyDrivers/NotifyDriverCirc.c " +
402                    "ti/sdo/ipc/notifyDrivers/NotifySetupNull.c " +
403                    "ti/sdo/ipc/notifyDrivers/NotifyDriverShm.c ";
405 var nsremoteSources =
406                    "ti/sdo/ipc/nsremote/NameServerRemoteNotify.c " +
407                    "ti/sdo/ipc/nsremote/NameServerMessageQ.c ";
409 var transportsSources =
410                    "ti/sdo/ipc/transports/TransportShm.c " +
411                    "ti/sdo/ipc/transports/TransportShmCircSetup.c " +
412                    "ti/sdo/ipc/transports/TransportShmNotifySetup.c " +
413                    "ti/sdo/ipc/transports/TransportShmCirc.c " +
414                    "ti/sdo/ipc/transports/TransportShmNotify.c " +
415                    "ti/sdo/ipc/transports/TransportShmSetup.c " +
416                    "ti/sdo/ipc/transports/TransportNullSetup.c " ;
418 var commonSources = ipcSources +
419                     gatesSources +
420                     heapsSources +
421                     notifyDriverSources +
422                     nsremoteSources +
423                     transportsSources;
425 var C64PSources  = "ti/sdo/ipc/gates/GateAAMonitor.c " +
426                    "ti/sdo/ipc/gates/GateHWSpinlock.c " +
427                    "ti/sdo/ipc/gates/GateHWSem.c " +
428                    "ti/sdo/ipc/family/dm6446/NotifySetup.c " +
429                    "ti/sdo/ipc/family/dm6446/NotifyCircSetup.c " +
430                    "ti/sdo/ipc/family/dm6446/InterruptDsp.c " +
431                    "ti/sdo/ipc/family/omap3530/NotifySetup.c " +
432                    "ti/sdo/ipc/family/omap3530/NotifyCircSetup.c " +
433                    "ti/sdo/ipc/family/omap3530/InterruptDsp.c ";
435 var C66Sources   = "ti/sdo/ipc/gates/GateHWSem.c " +
436                    "ti/sdo/ipc/gates/GateHWSpinlock.c " +
437                    "ti/sdo/ipc/family/tci663x/Interrupt.c " +
438                    "ti/sdo/ipc/family/tci663x/MultiProcSetup.c " +
439                    "ti/sdo/ipc/family/tci663x/NotifyCircSetup.c " +
440                    "ti/sdo/ipc/family/tci663x/NotifySetup.c " +
441                    "ti/sdo/ipc/family/vayu/InterruptDsp.c " +
442                    "ti/sdo/ipc/family/vayu/NotifyDriverMbx.c " +
443                    "ti/sdo/ipc/family/vayu/NotifySetup.c " +
444                    "ti/sdo/ipc/family/tda3xx/InterruptDsp.c " +
445                    "ti/sdo/ipc/family/tda3xx/NotifyDriverMbx.c " +
446                    "ti/sdo/ipc/family/tda3xx/NotifySetup.c " +
447                    "ti/ipc/family/tci6614/Interrupt.c " +
448                    "ti/ipc/family/tci6614/VirtQueue.c " +
449                    "ti/ipc/family/tci6614/NotifySetup.c " +
450                    "ti/ipc/family/tci6638/VirtQueue.c " +
451                    "ti/ipc/family/vayu/VirtQueue.c ";
453 var C674Sources  = "ti/sdo/ipc/gates/GateHWSpinlock.c " +
454                    "ti/sdo/ipc/family/da830/NotifySetup.c " +
455                    "ti/sdo/ipc/family/da830/NotifyCircSetup.c " +
456                    "ti/sdo/ipc/family/da830/InterruptDsp.c " +
457                    "ti/sdo/ipc/family/arctic/NotifySetup.c " +
458                    "ti/sdo/ipc/family/arctic/NotifyCircSetup.c " +
459                    "ti/sdo/ipc/family/arctic/InterruptDsp.c " +
460                    "ti/sdo/ipc/family/ti81xx/NotifySetup.c " +
461                    "ti/sdo/ipc/family/ti81xx/NotifyCircSetup.c " +
462                    "ti/sdo/ipc/family/ti81xx/InterruptDsp.c " +
463                    "ti/sdo/ipc/family/ti81xx/NotifyMbxSetup.c " +
464                    "ti/sdo/ipc/family/ti81xx/NotifyDriverMbx.c " +
465                    "ti/sdo/ipc/family/c6a8149/NotifySetup.c " +
466                    "ti/sdo/ipc/family/c6a8149/NotifyCircSetup.c " +
467                    "ti/sdo/ipc/family/c6a8149/InterruptDsp.c " +
468                    "ti/sdo/ipc/family/c6a8149/NotifyMbxSetup.c " +
469                    "ti/sdo/ipc/family/c6a8149/NotifyDriverMbx.c ";
471 var C647xSources = "ti/sdo/ipc/family/c647x/Interrupt.c " +
472                    "ti/sdo/ipc/family/c647x/NotifyCircSetup.c " +
473                    "ti/sdo/ipc/family/c647x/MultiProcSetup.c " +
474                    "ti/sdo/ipc/family/c647x/NotifySetup.c ";
476 var C64TSources  = "ti/sdo/ipc/gates/GateHWSpinlock.c " +
477                    "ti/sdo/ipc/family/omap4430/NotifyCircSetup.c " +
478                    "ti/sdo/ipc/family/omap4430/NotifySetup.c " +
479                    "ti/sdo/ipc/family/omap4430/InterruptDsp.c ";
481 var M3Sources    = "ti/sdo/ipc/gates/GateHWSpinlock.c " +
482                    "ti/sdo/ipc/family/omap4430/NotifySetup.c " +
483                    "ti/sdo/ipc/family/omap4430/NotifyCircSetup.c " +
484                    "ti/sdo/ipc/family/omap4430/InterruptDucati.c " +
485                    "ti/sdo/ipc/family/ti81xx/NotifySetup.c " +
486                    "ti/sdo/ipc/family/ti81xx/NotifyCircSetup.c " +
487                    "ti/sdo/ipc/family/ti81xx/InterruptDucati.c " +
488                    "ti/sdo/ipc/family/ti81xx/NotifyMbxSetup.c " +
489                    "ti/sdo/ipc/family/ti81xx/NotifyDriverMbx.c " +
490                    "ti/sdo/ipc/family/c6a8149/NotifySetup.c " +
491                    "ti/sdo/ipc/family/c6a8149/NotifyCircSetup.c " +
492                    "ti/sdo/ipc/family/c6a8149/InterruptDucati.c " +
493                    "ti/sdo/ipc/family/c6a8149/NotifyMbxSetup.c " +
494                    "ti/sdo/ipc/family/c6a8149/NotifyDriverMbx.c " +
495                    "ti/sdo/ipc/family/vayu/InterruptIpu.c " +
496                    "ti/sdo/ipc/family/vayu/NotifyDriverMbx.c " +
497                    "ti/sdo/ipc/family/vayu/NotifySetup.c " +
498                    "ti/sdo/ipc/family/tda3xx/InterruptIpu.c " +
499                    "ti/sdo/ipc/family/tda3xx/NotifyDriverMbx.c " +
500                    "ti/sdo/ipc/family/tda3xx/NotifySetup.c " +
501                    "ti/ipc/family/vayu/VirtQueue.c ";
503 var M4Sources    = "ti/sdo/ipc/gates/GateHWSpinlock.c " +
504                    "ti/sdo/ipc/family/vayu/InterruptIpu.c " +
505                    "ti/sdo/ipc/family/vayu/NotifyDriverMbx.c " +
506                    "ti/sdo/ipc/family/vayu/NotifySetup.c " +
507                    "ti/sdo/ipc/family/tda3xx/InterruptIpu.c " +
508                    "ti/sdo/ipc/family/tda3xx/NotifyDriverMbx.c " +
509                    "ti/sdo/ipc/family/tda3xx/NotifySetup.c " +
510                    "ti/ipc/family/vayu/VirtQueue.c ";
512 var Arm9Sources  = "ti/sdo/ipc/family/dm6446/NotifySetup.c " +
513                    "ti/sdo/ipc/family/dm6446/NotifyCircSetup.c " +
514                    "ti/sdo/ipc/family/dm6446/InterruptArm.c " +
515                    "ti/sdo/ipc/family/da830/NotifySetup.c " +
516                    "ti/sdo/ipc/family/da830/NotifyCircSetup.c " +
517                    "ti/sdo/ipc/family/da830/InterruptArm.c ";
519 var A8FSources   = "ti/sdo/ipc/gates/GateHWSpinlock.c " +
520                    "ti/sdo/ipc/family/ti81xx/NotifySetup.c " +
521                    "ti/sdo/ipc/family/ti81xx/NotifyCircSetup.c " +
522                    "ti/sdo/ipc/family/ti81xx/InterruptHost.c " +
523                    "ti/sdo/ipc/family/ti81xx/NotifyMbxSetup.c " +
524                    "ti/sdo/ipc/family/ti81xx/NotifyDriverMbx.c " +
525                    "ti/sdo/ipc/family/c6a8149/NotifySetup.c " +
526                    "ti/sdo/ipc/family/c6a8149/NotifyCircSetup.c " +
527                    "ti/sdo/ipc/family/c6a8149/InterruptHost.c " +
528                    "ti/sdo/ipc/family/c6a8149/NotifyMbxSetup.c " +
529                    "ti/sdo/ipc/family/c6a8149/NotifyDriverMbx.c " +
530                    "ti/sdo/ipc/family/omap3530/NotifySetup.c " +
531                    "ti/sdo/ipc/family/omap3530/NotifyCircSetup.c " +
532                    "ti/sdo/ipc/family/omap3530/InterruptHost.c ";
534 var A8gSources  =  "ti/sdo/ipc/gates/GateHWSpinlock.c " +
535                    "ti/sdo/ipc/family/ti81xx/NotifySetup.c " +
536                    "ti/sdo/ipc/family/ti81xx/NotifyCircSetup.c " +
537                    "ti/sdo/ipc/family/ti81xx/InterruptHost.c " +
538                    "ti/sdo/ipc/family/ti81xx/NotifyMbxSetup.c " +
539                    "ti/sdo/ipc/family/ti81xx/NotifyDriverMbx.c " +
540                    "ti/sdo/ipc/family/c6a8149/NotifySetup.c " +
541                    "ti/sdo/ipc/family/c6a8149/NotifyCircSetup.c " +
542                    "ti/sdo/ipc/family/c6a8149/InterruptHost.c " +
543                    "ti/sdo/ipc/family/c6a8149/NotifyMbxSetup.c " +
544                    "ti/sdo/ipc/family/c6a8149/NotifyDriverMbx.c " +
545                    "ti/sdo/ipc/family/omap3530/NotifySetup.c " +
546                    "ti/sdo/ipc/family/omap3530/NotifyCircSetup.c " +
547                    "ti/sdo/ipc/family/omap3530/InterruptHost.c ";
549 var A15gSources  = "ti/sdo/ipc/family/vayu/InterruptHost.c " +
550                    "ti/sdo/ipc/family/vayu/NotifyDriverMbx.c " +
551                    "ti/sdo/ipc/family/vayu/NotifySetup.c " +
552                    "ti/sdo/ipc/gates/GateHWSpinlock.c " +
553                    "ti/sdo/ipc/gates/GateHWSem.c " +
554                    "ti/sdo/ipc/family/tci663x/Interrupt.c " +
555                    "ti/sdo/ipc/family/tci663x/MultiProcSetup.c " +
556                    "ti/sdo/ipc/family/tci663x/NotifyCircSetup.c " +
557                    "ti/sdo/ipc/family/tci663x/NotifySetup.c ";
559 var ARP32Sources = "ti/sdo/ipc/gates/GateHWSpinlock.c " +
560                    "ti/sdo/ipc/family/arctic/NotifySetup.c " +
561                    "ti/sdo/ipc/family/arctic/NotifyCircSetup.c " +
562                    "ti/sdo/ipc/family/arctic/InterruptArp32.c " +
563                    "ti/sdo/ipc/family/c6a8149/NotifySetup.c " +
564                    "ti/sdo/ipc/family/c6a8149/NotifyCircSetup.c " +
565                    "ti/sdo/ipc/family/c6a8149/InterruptEve.c " +
566                    "ti/sdo/ipc/family/vayu/InterruptArp32.c " +
567                    "ti/sdo/ipc/family/vayu/NotifyDriverMbx.c " +
568                    "ti/sdo/ipc/family/vayu/NotifySetup.c " +
569                    "ti/sdo/ipc/family/tda3xx/InterruptArp32.c " +
570                    "ti/sdo/ipc/family/tda3xx/NotifyDriverMbx.c " +
571                    "ti/sdo/ipc/family/tda3xx/NotifySetup.c ";
573 var A53FSources  = "ti/sdo/ipc/family/am65xx/InterruptHost.c " +
574                    "ti/sdo/ipc/family/am65xx/NotifyDriverMbx.c " +
575                    "ti/sdo/ipc/family/am65xx/NotifySciClient.c " +
576                    "ti/sdo/ipc/family/am65xx/NotifySetup.c " +
577                    "ti/sdo/ipc/gates/GateHWSpinlock.c " +
578                    "ti/sdo/ipc/gates/GateHWSem.c ";
580 var R5FSources    = "ti/sdo/ipc/gates/GateHWSpinlock.c " +
581                    "ti/sdo/ipc/family/am65xx/InterruptR5f.c " +
582                    "ti/sdo/ipc/family/am65xx/NotifyDriverMbx.c " +
583                    "ti/sdo/ipc/family/am65xx/NotifySciClient.c " +
584                    "ti/sdo/ipc/family/am65xx/NotifySetup.c " +
585                    "ti/sdo/ipc/family/am65xx/Power.c " +
586                    "ti/ipc/family/am65xx/VirtQueue.c ";
588 var cList = {
589     "ti.targets.C64P"                   : commonSources + C647xSources +
590                                                 C64PSources,
591     "ti.targets.C674"                   : commonSources + C674Sources,
593     "ti.targets.elf.C64P"               : commonSources + C647xSources +
594                                                 C64PSources,
595     "ti.targets.elf.C674"               : commonSources + C674Sources,
596     "ti.targets.elf.C64T"               : commonSources + C64TSources,
597     "ti.targets.elf.C66"                : commonSources + C647xSources +
598                                                 C66Sources,
599     "ti.targets.arp32.elf.ARP32"        : commonSources + ARP32Sources,
600     "ti.targets.arp32.elf.ARP32_far"    : commonSources + ARP32Sources,
602     "ti.targets.arm.elf.Arm9"           : commonSources + Arm9Sources,
603     "ti.targets.arm.elf.A8F"            : commonSources + A8FSources,
604     "ti.targets.arm.elf.A8Fnv"          : commonSources + A8FSources,
605     "ti.targets.arm.elf.M3"             : commonSources + M3Sources,
606     "ti.targets.arm.elf.M4"             : commonSources + M4Sources,
607     "ti.targets.arm.elf.M4F"            : commonSources + M4Sources,
608     "ti.targets.arm.elf.R5F"            : commonSources + R5FSources,
610     "gnu.targets.arm.A15F"              : commonSources + A15gSources,
611     "gnu.targets.arm.A8F"               : commonSources + A8gSources,
612     "gnu.targets.arm.M3"                : commonSources + M3Sources,
613     "gnu.targets.arm.M4"                : commonSources + M4Sources,
614     "gnu.targets.arm.M4F"               : commonSources + M4Sources,
615     "gnu.targets.arm.A53F"              : commonSources + A53FSources,
616 };
618 var asmListNone = [
619 ];
621 var asmList64P = [
622     "ti/sdo/ipc/gates/GateAAMonitor_asm.s64P",
623 ];
625 var asmList = {
626     "ti.targets.C64P"                   : asmList64P,
627     "ti.targets.C674"                   : asmList64P,
629     "ti.targets.elf.C64P"               : asmList64P,
630     "ti.targets.elf.C674"               : asmList64P,
632     "ti.targets.elf.C64T"               : asmListNone,
633     "ti.targets.elf.C66"                : asmListNone,
635     "ti.targets.arp32.elf.ARP32"        : asmListNone,
636     "ti.targets.arp32.elf.ARP32_far"    : asmListNone,
638     "ti.targets.arm.elf.Arm9"           : asmListNone,
639     "ti.targets.arm.elf.A8F"            : asmListNone,
640     "ti.targets.arm.elf.A8Fnv"          : asmListNone,
641     "ti.targets.arm.elf.M3"             : asmListNone,
642     "ti.targets.arm.elf.M4"             : asmListNone,
643     "ti.targets.arm.elf.M4F"            : asmListNone,
644     "ti.targets.arm.elf.R5F"            : asmListNone,
646     "gnu.targets.arm.M3"                : asmListNone,
647     "gnu.targets.arm.M4"                : asmListNone,
648     "gnu.targets.arm.M4F"               : asmListNone,
649     "gnu.targets.arm.A8F"               : asmListNone,
650     "gnu.targets.arm.A9F"               : asmListNone,
651     "gnu.targets.arm.A15F"              : asmListNone,
652     "gnu.targets.arm.A53F"              : asmListNone,
653 };
655 function getDefaultCustomCCOpts()
658     /* start with target.cc.opts */
659     var customCCOpts = Program.build.target.cc.opts;
661     /* add target unique custom ccOpts */
662     if (!(ccOptsList[Program.build.target.$name] === undefined)) {
663         customCCOpts += ccOptsList[Program.build.target.$name];
664     }
666     /* gnu targets need to pick up ccOpts.prefix and suffix */
667     if (Program.build.target.$name.match(/gnu/)) {
668         customCCOpts += " -O3 ";
669         customCCOpts += " " + Program.build.target.ccOpts.prefix + " ";
670         customCCOpts += " " + Program.build.target.ccOpts.suffix + " ";
671     }
672     else if (Program.build.target.$name.match(/iar/)) {
673         throw new Error("IAR not supported by IPC");
674     }
675     else {
676         /* ti targets do program level compile */
677         customCCOpts += " --program_level_compile -o3 -g " +
678                 "--optimize_with_debug ";
679     }
681     /* undo optimizations if this is a debug build */
682     if (Build.libType == Build.LibType_Debug) {
683         if (Program.build.target.$name.match(/gnu/)) {
684             customCCOpts = customCCOpts.replace("-O3","");
685             if (!Program.build.target.$name.match(/A53F/)) {
686                 /* add in stack frames for stack back trace */
687                 customCCOpts += " -mapcs-frame ";
688             }
689         }
690         else {
691             customCCOpts = customCCOpts.replace(" -o3","");
692             customCCOpts = customCCOpts.replace(" --optimize_with_debug","");
693             if (Program.build.target.$name.match(/arm/)) {
694                 customCCOpts = customCCOpts.replace(" --opt_for_speed=2","");
695             }
696         }
697     }
699     return (customCCOpts);
702 /*
703  *  ======== getDefs ========
704  */
705 function getDefs()
707     var Defaults = xdc.module('xdc.runtime.Defaults');
708     var Diags = xdc.module("xdc.runtime.Diags");
709     var BIOS = xdc.module("ti.sysbios.BIOS");
710     var MessageQ = xdc.module("ti.sdo.ipc.MessageQ");
712     var defs = "";
714     if ((Build.assertsEnabled == false) ||
715         ((Defaults.common$.diags_ASSERT == Diags.ALWAYS_OFF)
716             && (Defaults.common$.diags_INTERNAL == Diags.ALWAYS_OFF))) {
717         defs += " -Dxdc_runtime_Assert_DISABLE_ALL";
718     }
720     if (Build.logsEnabled == false) {
721         defs += " -Dxdc_runtime_Log_DISABLE_ALL";
722     }
724     defs += " -Dti_sdo_ipc_MessageQ_traceFlag__D=" +
725             (MessageQ.traceFlag ? "TRUE" : "FALSE");
727     if ("ti.ipc.ipcmgr.IpcMgr" in xdc.om) {
728         defs += xdc.module("ti.ipc.ipcmgr.IpcMgr").getDefs();
729     }
731     if ("ti.ipc.rpmsg" in xdc.om) {
732         defs += xdc.module('ti.ipc.rpmsg.Build').getDefs();
733     }
735     var InterruptDucati =
736             xdc.module("ti.sdo.ipc.family.ti81xx.InterruptDucati");
738     /* If we truely know which platform we're building against,
739      * add these application specific -D's
740      */
741     if (BIOS.buildingAppLib == true) {
742         defs += " -Dti_sdo_ipc_family_ti81xx_InterruptDucati_videoProcId__D="
743                 + InterruptDucati.videoProcId;
744         defs += " -Dti_sdo_ipc_family_ti81xx_InterruptDucati_hostProcId__D="
745                 + InterruptDucati.hostProcId;
746         defs += " -Dti_sdo_ipc_family_ti81xx_InterruptDucati_vpssProcId__D="
747                 + InterruptDucati.vpssProcId;
748         defs += " -Dti_sdo_ipc_family_ti81xx_InterruptDucati_dspProcId__D="
749                 + InterruptDucati.dspProcId;
750         defs +=
751             " -Dti_sdo_ipc_family_ti81xx_InterruptDucati_ducatiCtrlBaseAddr__D="
752             + InterruptDucati.ducatiCtrlBaseAddr;
753         defs +=
754             " -Dti_sdo_ipc_family_ti81xx_InterruptDucati_mailboxBaseAddr__D="
755             + InterruptDucati.mailboxBaseAddr;
756     }
758     return (defs);
761 /*
762  *  ======== getCFiles ========
763  */
764 function getCFiles(target)
766     var localSources = "";
768     if (BIOS.buildingAppLib == true) {
769         var targetModules = Program.targetModules();
771         for (var m = 0; m < targetModules.length; m++) {
772             var mod = targetModules[m];
773             var mn = mod.$name;
774             var pn = mod.$package.$name;
776             /* determine if this is an ipc package */
777             var packageMatch = false;
779             for (var i = 0; i < ipcPackages.length; i++) {
780                 if (pn == ipcPackages[i]) {
781                     packageMatch = true;
782                     break;
783                 }
784             }
786             if (packageMatch && !mn.match(/Proxy/)) {
787                 localSources += mn.replace(/\./g, "/") + ".c" + " ";
788             }
789         }
791         /* special handling for non-target modules */
792         for (var p in cFiles) {
793             if (p in xdc.om) {
794                 for (var f in cFiles[p].cSources) {
795                     localSources += p.replace(/\./g, "/")
796                             + "/" + cFiles[p].cSources[f] + " ";
797                 }
798             }
799         }
800     }
801     else {
802         localSources += cList[target];
803     }
805     /* remove trailing " " */
806     localSources = localSources.substring(0, localSources.length-1);
808     return (localSources);
811 /*
812  *  ======== getAsmFiles ========
813  */
814 function getAsmFiles(target)
816     return (asmList[target]);
819 /*
820  *  ======== getLibs ========
821  *  This function called by all IPC packages except ti.sdo.ipc package.
822  */
823 function getLibs(pkg)
825     var libPath = "";
826     var name = "";
827     var suffix;
829     switch (Build.libType) {
830         case Build.LibType_Custom:
831         case Build.LibType_Instrumented:
832         case Build.LibType_NonInstrumented:
833         case Build.LibType_Debug:
834             return null;
836         case Build.LibType_PkgLib:
837             throw new Error("internal error: Build.getLibs() called with " +
838                     "incorret context (libType == PkgLib)");
839             break;
841         default:
842             throw new Error("Build.libType not supported: " + Build.libType);
843             break;
844     }
847 /*
848  *  ======== getProfiles ========
849  *  Determines which profiles to build for.
850  *
851  *  Any argument in XDCARGS which does not contain platform= is treated
852  *  as a profile. This way multiple build profiles can be specified by
853  *  separating them with a space.
854  */
855 function getProfiles(xdcArgs)
857     /*
858      * cmdlProf[1] gets matched to "whole_program,debug" if
859      * ["abc", "profile=whole_program,debug"] is passed in as xdcArgs
860      */
861     var cmdlProf = (" " + xdcArgs.join(" ") + " ").match(/ profile=([^ ]+) /);
863     if (cmdlProf == null) {
864         /* No profile=XYZ found */
865         return [];
866     }
868     /* Split "whole_program,debug" into ["whole_program", "debug"] */
869     var profiles = cmdlProf[1].split(',');
871     return profiles;
874 /*
875  *  ======== buildLibs ========
876  *  This function generates the makefile goals for the libraries
877  *  produced by a package.
878  */
879 function buildLibs(objList, relList, filter, xdcArgs)
881     var Build = xdc.useModule('xdc.bld.BuildEnvironment');
883     for (var i = 0; i < Build.targets.length; i++) {
884         var targ = Build.targets[i];
886         /* skip target if not supported */
887         if (!supportsTarget(targ, filter)) {
888             continue;
889         }
891         var profiles = getProfiles(xdcArgs);
893         /* If no profiles were assigned, use only the default one. */
894         if (profiles.length == 0) {
895             profiles[0] = "debug";
896         }
898         for (var j = 0; j < profiles.length; j++) {
899             var ccopts = "";
900             var asmopts = "";
902             if (profiles[j] == "smp") {
903                 var libPath = "lib/smpipc/debug/";
904                 ccopts += " -Dti_sysbios_BIOS_smpEnabled__D=TRUE";
905                 asmopts += " -Dti_sysbios_BIOS_smpEnabled__D=TRUE";
906             }
907             else {
908                 var libPath = "lib/ipc/debug/";
909                 /* build all package libs using Hwi macros */
910                 ccopts += " -Dti_sysbios_Build_useHwiMacros";
911                 ccopts += " -Dti_sysbios_BIOS_smpEnabled__D=FALSE";
912                 asmopts += " -Dti_sysbios_BIOS_smpEnabled__D=FALSE";
913             }
915             /* confirm that this target supports this profile */
916             if (targ.profiles[profiles[j]] !== undefined) {
917                 var profile = profiles[j];
918                 var lib = Pkg.addLibrary(libPath + Pkg.name,
919                                 targ, {
920                                 profile: profile,
921                                 copts: ccopts,
922                                 aopts: asmopts,
923                                 releases: relList
924                                 });
925                 lib.addObjects(objList);
926             }
927         }
928     }
931 /*
932  *  ======== supportsTarget ========
933  *  Returns true if target is in the filter object. If filter
934  *  is null or empty, that's taken to mean all targets are supported.
935  */
936 function supportsTarget(target, filter)
938     var list, field;
940     if (filter == null) {
941         return true;
942     }
944     /*
945      * For backwards compatibility, we support filter as an array of
946      * target names.  The preferred approach is to specify filter as
947      * an object with 'field' and 'list' elements.
948      *
949      * Old form:
950      *     var trgFilter = [ "Arm9", "Arm9t", "Arm9t_big_endian" ]
951      *
952      * New (preferred) form:
953      *
954      *     var trgFilter = {
955      *         field: "isa",
956      *         list: [ "v5T", "v7R" ]
957      *     };
958      *
959      */
960     if (filter instanceof Array) {
961         list = filter;
962         field = "name";
963     }
964     else {
965         list = filter.list;
966         field = filter.field;
967     }
969     if (list == null || field == null) {
970         throw("invalid filter parameter, must specify list and field!");
971     }
973     if (field == "noIsa") {
974         if (String(','+list.toString()+',').match(','+target["isa"]+',')) {
975             return (false);
976         }
977         return (true);
978     }
980     /*
981      * add ',' at front and and tail of list and field strings to allow
982      * use of simple match API.  For example, the string is updated to:
983      * ',v5T,v7R,' to allow match of ',v5t,'.
984      */
985     if (String(','+list.toString()+',').match(','+target[field]+',')) {
986         return (true);
987     }
989     return (false);
992 /*
993  *  ======== _setLibType ========
994  *  The "real-time" setter setLibType function
995  *  This function is called whenever libType changes.
996  */
997 function _setLibType(field, val)
999     var Build = this;
1001     if (val == Build.LibType_Instrumented) {
1002         Build.assertsEnabled = true;
1003         Build.logsEnabled = true;
1004     }
1005     else if (val == Build.LibType_NonInstrumented) {
1006         Build.assertsEnabled = false;
1007         Build.logsEnabled = false;
1008     }
1009     else if (val == Build.LibType_Custom) {
1010         Build.assertsEnabled = true;
1011         Build.logsEnabled = true;
1012     }
1013     else if (val == Build.LibType_Debug) {
1014         Build.assertsEnabled = true;
1015         Build.logsEnabled = true;
1016     }
1017     else if (val == Build.LibType_PkgLib) {
1018         Build.assertsEnabled = true;
1019         Build.logsEnabled = true;
1020     }
1021     else {
1022         print(Build.$name + ": unknown libType setting: " + val);
1023     }
1025     /* re-construct default Build.customCCOpts */
1026     Build.customCCOpts = Build.getDefaultCustomCCOpts();