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 name = this.$name + ".a" + suffix;
18 var socType = this.Settings.deviceType;
20 socType = socType.toLowerCase();
22 /* Read LIBDIR variable */
23 var lib = java.lang.System.getenv("LIBDIR");
25 /* If NULL, default to "lib" folder */
26 if (lib == null)
27 {
28 lib = "./lib";
29 } else {
30 print ("\tSystem environment LIBDIR variable defined : " + lib);
31 }
33 /* SoC types supported */
34 var socTypes = [
35 'k2k',
36 'k2h',
37 'k2l',
38 'k2e',
39 ];
41 /* Get the SOC */
42 for each (var soc in socTypes)
43 {
44 if (socType.equals(soc))
45 {
46 lib = lib + "/" + soc;
47 name = this.$name + "." + soc + ".a" + suffix;
48 break;
49 }
50 }
52 /* Get target folder, if applicable */
53 if ( java.lang.String(suffix).contains('66') )
54 lib = lib + "/c66";
55 else if (java.lang.String(suffix).contains('a15') )
56 lib = lib + "/armv7";
57 else if (java.lang.String(suffix).contains('m4') )
58 lib = lib + "/m4";
59 else if (java.lang.String(suffix).contains('a9') )
60 lib = lib + "/armv7";
61 else if (java.lang.String(suffix).contains('a8') )
62 lib = lib + "/armv7";
63 else
64 throw new Error("\tUnknown target for: " + this.packageBase + lib);
66 /* Get library name with path */
67 lib = lib + "/" + name;
68 if (java.io.File(this.packageBase + lib).exists()) {
69 print ("\tLinking with library " + this.$name + ":" + lib);
70 return lib;
71 }
73 /* Could not find any library, throw exception */
74 throw new Error("\tLibrary not found: " + this.packageBase + lib);
75 }
77 /*
78 * ======== package.close ========
79 */
80 function close()
81 {
82 if (xdc.om.$name != 'cfg') {
83 return;
84 }
85 }