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