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