/* * ======== package.xs ======== * */ /* * ======== Package.getLibs ======== * This function is called when a program's configuration files are * being generated and it returns the name of a library appropriate * for the program's configuration. */ function getLibs(prog) { var suffix = prog.build.target.suffix; var name = this.$name + ".a" + suffix; var socType = this.Settings.deviceType; socType = socType.toLowerCase(); /* Read LIBDIR variable */ var lib = java.lang.System.getenv("LIBDIR"); /* If NULL, default to "lib" folder */ if (lib == null) { lib = "./lib"; } else { print ("\tSystem environment LIBDIR variable defined : " + lib); } /* SoC types supported */ var socTypes = [ 'k2k', 'k2h', 'k2l', 'k2e', ]; /* Get the SOC */ for each (var soc in socTypes) { if (socType.equals(soc)) { lib = lib + "/" + soc; name = this.$name + "." + soc + ".a" + suffix; break; } } /* Get target folder, if applicable */ if ( java.lang.String(suffix).contains('66') ) lib = lib + "/c66"; else if ( java.lang.String(suffix).contains('m4') ) lib = lib + "/m4"; else lib = lib + "/armv7"; /* Get library name with path */ lib = lib + "/" + name; if (java.io.File(this.packageBase + lib).exists()) { print ("\tLinking with library " + this.$name + ":" + lib); return lib; } /* Could not find any library, throw exception */ throw new Error("\tLibrary not found: " + this.packageBase + lib); } /* * ======== package.close ======== */ function close() { if (xdc.om.$name != 'cfg') { return; } }