]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - keystone-rtos/rm-lld.git/blob - package.xs
Fix PRSDK-747
[keystone-rtos/rm-lld.git] / package.xs
1 /*\r
2  *  ======== package.xs ========\r
3  *\r
4  */\r
5 \r
6 \r
7 /*\r
8  *  ======== Package.getLibs ========\r
9  *  This function is called when a program's configuration files are\r
10  *  being generated and it returns the name of a library appropriate\r
11  *  for the program's configuration.\r
12  */\r
13 \r
14 function getLibs(prog)\r
15 {\r
16     var suffix = prog.build.target.suffix;\r
17     var name = this.$name + ".a" + suffix;\r
18     var socType = this.Settings.deviceType;\r
19 \r
20     socType = socType.toLowerCase();\r
21 \r
22     /* Read LIBDIR variable */\r
23     var lib = java.lang.System.getenv("LIBDIR");\r
24 \r
25     /* If NULL, default to "lib" folder */\r
26     if (lib == null)\r
27     {\r
28         lib = "./lib";\r
29     } else {\r
30         print ("\tSystem environment LIBDIR variable defined : " + lib);\r
31     }\r
32 \r
33     /* SoC types supported */\r
34     var socTypes = [\r
35                         'k2k',\r
36                         'k2h',\r
37                         'k2l',\r
38                         'k2e',\r
39                       ];\r
40     \r
41     /* Get the SOC */\r
42     for each (var soc in socTypes)\r
43     {\r
44         if (socType.equals(soc))\r
45         {\r
46             lib = lib + "/" + soc;\r
47             name = this.$name + "." + soc + ".a" + suffix;       \r
48             break;\r
49         }\r
50     }\r
51 \r
52     /* Get target folder, if applicable */\r
53     if ( java.lang.String(suffix).contains('66') )\r
54         lib = lib + "/c66";\r
55     else if ( java.lang.String(suffix).contains('m4') )\r
56         lib = lib + "/m4";\r
57     else\r
58         lib = lib + "/armv7"; \r
59 \r
60     /* Get library name with path */\r
61     lib = lib + "/" + name;\r
62     if (java.io.File(this.packageBase + lib).exists()) {\r
63        print ("\tLinking with library " + this.$name + ":" + lib);\r
64        return lib;\r
65     }\r
66 \r
67     /* Could not find any library, throw exception */\r
68     throw new Error("\tLibrary not found: " + this.packageBase + lib);\r
69 }\r
70 \r
71 /*\r
72  *  ======== package.close ========\r
73  */\r
74 function close()\r
75 {    \r
76     if (xdc.om.$name != 'cfg') {\r
77         return;\r
78     }\r
79 }\r