1 /*
2 * Copyright (c) 2013, Texas Instruments Incorporated
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 *
32 */
34 /*
35 * ======== Package.close ========
36 * Close this package; optionally (re)set other config parameters in the
37 * model
38 */
39 function close()
40 {
41 xdc.useModule('xdc.runtime.Log');
42 xdc.useModule('xdc.runtime.Assert');
43 xdc.useModule('xdc.runtime.Diags');
44 xdc.useModule('xdc.runtime.Registry');
46 /* if undefined, take profile from the Settings module */
47 if (this.profile == undefined) {
48 this.profile = xdc.useModule('ti.sdo.ce.global.Settings').profile;
49 }
51 /* sanity check that we're in the config model - else we crash! */
52 if (xdc.om.$name == "cfg") {
53 var os = Program.build.target.os;
55 if (os == "Linux") {
56 xdc.useModule('ti.sdo.xdcruntime.linux.Settings');
57 xdc.useModule('xdc.runtime.knl.SemProcess');
58 }
60 var Algorithm = this.Algorithm;
62 if (Algorithm.useIdma3) {
63 $trace ("Algorithm: Using deprecated option useIdma3.");
64 }
66 /* establish dependency on OSAL */
67 xdc.useModule('ti.sdo.ce.osal.Global');
69 /* target.os is undefined for BIOS - DSKT2 is used on BIOS systems */
70 if (os == undefined) {
71 /* establish dependency on DSKT2 */
72 xdc.useModule('ti.sdo.fc.dskt2.DSKT2');
73 }
75 if (os == undefined)
76 if (Algorithm.useIres) {
77 /* establish dependency on RMAN */
78 xdc.useModule('ti.sdo.fc.rman.RMAN');
79 }
80 }
81 }
84 /*
85 * ======== getLibs ========
86 */
87 function getLibs(prog)
88 {
89 var suffix = prog.build.target.findSuffix(this);
90 if (suffix == null) {
91 /* no matching lib found in this package, return "" */
92 $trace("Unable to locate a compatible library, returning none.",
93 1, ['getLibs']);
94 return ("");
95 }
97 var lib;
99 /* BIOS systems have targ.os == undefined) */
100 if (prog.build.target.os == undefined) {
101 lib = "lib/" + this.profile + "/Algorithm_BIOS.a" + suffix;
103 if (!java.io.File(this.packageBase + lib).exists()) {
104 /* the suggested profile doesn't exist, try "release" */
105 $trace("Unable to locate lib for requested '" + this.profile +
106 "' profile. Using 'release' profile.", 1, ['getLibs']);
107 lib = "lib/release/Algorithm_BIOS.a" + suffix;
108 }
109 }
110 else {
111 lib1 = "lib/" + this.profile + "/Algorithm_noOS.a" + suffix;
112 lib2 = "lib/" + this.profile + "/alg.a" + suffix;
114 /* Just test for lib 1 rather than both */
115 if (!java.io.File(this.packageBase + lib1).exists()) {
116 /* the suggested profile doesn't exist, try "release" */
117 $trace("Unable to locate lib for requested '" + this.profile +
118 "' profile. Using 'release' profile.", 1, ['getLibs']);
120 lib1 = "lib/release/Algorithm_noOS.a" + suffix;
121 lib2 = "lib/release/alg.a" + suffix;
122 }
124 /* return both libs */
125 lib = lib1 + ";" + lib2;
126 }
128 return (lib);
129 }