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 'am65xx',
20 'j721e',
21 ];
22 var libNames = [
23 'udma'
24 ];
26 /* Read LIBDIR variable */
27 var lib = java.lang.System.getenv("LIBDIR");
29 /* If NULL, default to "lib" folder */
30 if (lib == null)
31 {
32 lib = "./lib";
33 } else {
34 print ("\tSystem environment LIBDIR variable defined : " + lib);
35 }
37 /* Get the SOC */
38 for each (var soc in socTypes)
39 {
40 if (socType.equals(soc))
41 {
42 lib = lib + "/" + soc;
43 name = this.$name + ".a" + suffix;
44 break;
45 }
46 }
48 /* Get target folder, if applicable */
49 if (java.lang.String(suffix).contains('mcu1_0'))
50 lib = lib + "/mcu1_0";
51 else if (java.lang.String(suffix).contains('mpu1_0'))
52 lib = lib + "/mpu1_0";
53 else if (java.lang.String(suffix).contains('a53'))
54 lib = lib + "/mpu1_0";
55 else if (java.lang.String(suffix).contains('r5f'))
56 lib = lib + "/mcu1_0";
57 else
58 throw new Error("\tUnknown target for: " + this.packageBase + lib);
60 var libProfiles = ["debug", "release"];
61 /* get the configured library profile */
62 for each(var profile in libProfiles)
63 {
64 if (this.Settings.libProfile.equals(profile))
65 {
66 lib = lib + "/" + profile;
67 break;
68 }
69 }
71 /* Update the lib names with the lib extension */
72 lib_dir = lib;
73 lib ="";
74 for each(var libName in libNames)
75 {
76 libName = libName + ".a" + suffix;
77 if ((java.io.File(this.packageBase + lib_dir + "/" + libName).exists()))
78 {
79 /* Get library name with path */
80 lib = lib + lib_dir +"/" + libName;
81 lib = lib + ";";
82 print ("\tLinking with library " + this.packageBase + lib_dir + "/" + libName );
83 }
84 else
85 {
86 /* Could not find any library, throw exception */
87 throw new Error("\tLibrary not found: " + this.packageBase + lib_dir + "/" + libName);
88 break;
89 }
90 }
92 /* Get library name with path */
93 return lib;
94 }
96 /*
97 * ======== package.init ========
98 */
99 function init() {
100 xdc.loadPackage("ti.osal");
101 xdc.loadPackage("ti.csl");
102 }
104 /*
105 * ======== package.close ========
106 */
107 function close()
108 {
109 if (xdc.om.$name != 'cfg') {
110 return;
111 }
112 }