]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - processor-sdk/pdk.git/blob - packages/ti/drv/pcie/package.xs
pcie-lld: add to PDK
[processor-sdk/pdk.git] / packages / ti / drv / pcie / 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 = "";\r
18     var socType = this.Settings.socType;\r
19     var devType = this.Settings.deviceType;\r
20     var profilingTag = "";\r
21     if ((! socType) && devType)\r
22     {\r
23         /* Backward compatibilty with keystone .cfg */\r
24         socType = devType;\r
25     }\r
26 \r
27     socType = socType.toLowerCase();\r
28     /* Replace the last charecter in SoC am#### to am###x */\r
29     if (socType.substring(0, 2) == "am")\r
30     {\r
31         socType = socType.substring(0, socType.length - 1);\r
32         socType = socType.concat("x");\r
33     }\r
34 \r
35     if (this.Settings.enableProfiling == true)\r
36     {\r
37         profilingTag = ".profiling"\r
38     }\r
39     name = this.$name + profilingTag + ".a" + suffix;\r
40     \r
41     /* Read LIBDIR variable */\r
42     var lib = java.lang.System.getenv("LIBDIR");\r
43 \r
44     /* If NULL, default to "lib" folder */\r
45     if (lib == null)\r
46     {\r
47         lib = "./lib";\r
48     } else {\r
49         print ("\tSystem environment LIBDIR variable defined : " + lib);\r
50     }\r
51 \r
52     /* Device types supported */\r
53     var socTypes = [\r
54                        'am65xx',\r
55                        'k2k',\r
56                        'k2h',\r
57                        'k2l',\r
58                        'k2e',\r
59                        'k2g',\r
60                        'c6657',\r
61                        'c6678',\r
62                        'am571x',\r
63                        'am574x',\r
64                        'am572x'\r
65                    ];\r
66 \r
67     /* Search for the supported socs (defined in config.bld) */\r
68     for each(var soc in socTypes)\r
69     {\r
70         if (socType.equals(soc))\r
71         {\r
72             lib = lib + "/" + soc;\r
73             name = this.$name + profilingTag + ".a" + suffix;    \r
74             break;\r
75         }\r
76     }\r
77 \r
78     /* Get target folder, if applicable */\r
79     if ( java.lang.String(suffix).contains('66') )\r
80         lib = lib + "/c66";\r
81     else if (java.lang.String(suffix).contains('a15') )\r
82         lib = lib + "/a15";\r
83     else if (java.lang.String(suffix).contains('a53') )\r
84         lib = lib + "/a53";\r
85     else if (java.lang.String(suffix).contains('m4') )\r
86         lib = lib + "/m4";\r
87     else if (java.lang.String(suffix).contains('r5') )\r
88         lib = lib + "/r5f";\r
89     else\r
90         throw new Error("\tUnknown target for: " + this.packageBase + lib);\r
91 \r
92     var libProfiles = ["debug", "release"];\r
93     /* get the configured library profile */\r
94     for each(var profile in libProfiles)\r
95     {\r
96         if (this.Settings.libProfile.equals(profile))\r
97         {\r
98             lib = lib + "/" + profile;\r
99             break;\r
100         }\r
101     }   \r
102 \r
103     /* Get library name with path */\r
104     lib = lib + "/" + name;\r
105     if (java.io.File(this.packageBase + lib).exists()) {\r
106        print ("\tLinking with library " + this.$name + ":" + lib);\r
107        return lib;\r
108     }\r
109 \r
110     /* Could not find any library, throw exception */\r
111     throw new Error("\tLibrary not found: " + this.packageBase + lib);\r
112 }\r
113 \r
114 /*\r
115  *  ======== package.close ========\r
116  */\r
117 function close()\r
118 {    \r
119     if (xdc.om.$name != 'cfg') {\r
120         return;\r
121     }\r
122 }\r