1 /*
2 * ======== package.xs ========
3 *
4 */
7 /*
8 * ======== Package.getLibs ========
9 * This function is called when a program's configuration files are
10 * being generated and it returns the name of a library appropriate
11 * for the program's configuration.
12 */
14 function getLibs(prog)
15 {
16 var suffix = prog.build.target.suffix;
17 var socType = this.Settings.socType;
18 var socTypes = [
19 'am65x',
20 ];
21 var libNames = [
22 'fvid2'
23 ];
25 /* Read LIBDIR variable */
26 var lib = java.lang.System.getenv("LIBDIR");
28 /* If NULL, default to "lib" folder */
29 if (lib == null)
30 {
31 lib = "./lib";
32 } else {
33 print ("\tSystem environment LIBDIR variable defined : " + lib);
34 }
36 /* Get the SOC */
37 for each (var soc in socTypes)
38 {
39 if (socType.equals(soc))
40 {
41 lib = lib + "/" + soc;
42 name = this.$name + ".a" + suffix;
43 break;
44 }
45 }
47 /* Get target folder, if applicable */
48 if (java.lang.String(suffix).contains('mcu1_0'))
49 lib = lib + "/mcu1_0";
50 else if (java.lang.String(suffix).contains('mpu1_1'))
51 lib = lib + "/mpu1_1";
52 else if (java.lang.String(suffix).contains('mpu1_0'))
53 lib = lib + "/mpu1_0";
54 else if (java.lang.String(suffix).contains('mpu1_1'))
55 lib = lib + "/mpu1_1";
56 else
57 throw new Error("\tUnknown target for: " + this.packageBase + lib);
59 var libProfiles = ["debug", "release"];
60 /* get the configured library profile */
61 for each(var profile in libProfiles)
62 {
63 if (this.Settings.libProfile.equals(profile))
64 {
65 lib = lib + "/" + profile;
66 break;
67 }
68 }
70 /* Update the lib names with the lib extension */
71 lib_dir = lib;
72 lib ="";
73 for each(var libName in libNames)
74 {
75 libName = libName + ".a" + suffix;
76 if ((java.io.File(this.packageBase + lib_dir + "/" + libName).exists()))
77 {
78 /* Get library name with path */
79 lib = lib + lib_dir +"/" + libName;
80 lib = lib + ";";
81 print ("\tLinking with library " + this.packageBase + lib_dir + "/" + libName );
82 }
83 else
84 {
85 /* Could not find any library, throw exception */
86 throw new Error("\tLibrary not found: " + this.packageBase + lib_dir + "/" + libName);
87 break;
88 }
89 }
91 /* Get library name with path */
92 return lib;
93 }
95 function init() {
96 xdc.loadPackage("ti.osal");
97 xdc.loadPackage("ti.csl");
98 }
100 /*
101 * ======== package.close ========
102 */
103 function close()
104 {
105 if (xdc.om.$name != 'cfg') {
106 return;
107 }
108 }