1 /******************************************************************************
2 * FILE PURPOSE: Build configuration Script for the PCIE LLD
3 ******************************************************************************
4 * FILE NAME: config.bld
5 *
6 * DESCRIPTION:
7 * This file contains the build configuration script for the PCIE LLD
8 * and is responsible for configuration of the paths for the various
9 * tools required to build the driver.
10 *
11 * Copyright (C) 2012-2015, Texas Instruments, Inc.
12 *****************************************************************************/
14 /* Get the Tools Base directory from the Environment Variable. */
15 var c66ToolsBaseDir = java.lang.System.getenv("C6X_GEN_INSTALL_PATH");
16 var m4ToolsBaseDir = java.lang.System.getenv("TOOLCHAIN_PATH_M4");
17 var a15ToolsBaseDir = java.lang.System.getenv("TOOLCHAIN_PATH_A15");
18 var a9ToolsBaseDir = java.lang.System.getenv("TOOLCHAIN_PATH_A9");
19 var a8ToolsBaseDir = java.lang.System.getenv("TOOLCHAIN_PATH_A8");
21 /* Get the extended debug flags for C66x,
22 * did not change the name for backwards compatibilty */
23 var extDbgFlags = java.lang.System.getenv("EXTDBGFLAGS");
25 /* Get the extended debug flags for A15 */
26 var extDbgFlags_a15 = java.lang.System.getenv("EXTDBGFLAGS_A15");
28 /* Get the extended debug flags for A8 */
29 var extDbgFlags_a8 = java.lang.System.getenv("EXTDBGFLAGS_A8");
31 /* Get the extended debug flags for A9 */
32 var extDbgFlags_a9 = java.lang.System.getenv("EXTDBGFLAGS_A9");
34 /* Get the extended debug flags for M4 */
35 var extDbgFlags_m4 = java.lang.System.getenv("EXTDBGFLAGS_M4");
37 /* Get the base directory for the PCIE LLD Package */
38 var driverPath = new java.io.File(".//").getPath();
40 /* Include Path */
41 var lldIncludePath = " -I" + driverPath;
43 /* Configure the PCIE LLD Version Information */
44 /* 3 steps: remove SPACE and TAB, convert to string and split to make array */
45 var driverReleaseVersion = (""+Pkg.version.replace(/\s/g, "")).split(',');
47 /* Print the Compiler Options */
48 var pOpts = 1;
50 /* C66 ELF compiler configuration for Little Endian Mode. */
51 var C66LE = xdc.useModule('ti.targets.elf.C66');
52 C66LE.rootDir = c66ToolsBaseDir;
53 C66LE.ccOpts.prefix = "-mo -o3 -q -k -eo.o";
54 if(extDbgFlags)
55 C66LE.ccOpts.prefix = C66LE.ccOpts.prefix + " " + extDbgFlags;
57 /* C66 ELF compiler configuration for Big Endian Mode. */
58 var C66BE = xdc.useModule('ti.targets.elf.C66_big_endian');
59 C66BE.rootDir = c66ToolsBaseDir;
60 C66BE.ccOpts.prefix = "-mo -o3 -q -k -eo.o -DBIGENDIAN";
61 if(extDbgFlags)
62 C66BE.ccOpts.prefix = C66BE.ccOpts.prefix + " " + extDbgFlags;
64 /* ARMv7 A15 compiler configuration */
65 var A15LE = xdc.useModule('gnu.targets.arm.A15F');
66 A15LE.rootDir = a15ToolsBaseDir;
67 A15LE.ccOpts.prefix = "-mno-unaligned-access -c -mtune=cortex-a15 -marm -DDRA7xx -gstrict-dwarf -Wall -D__ARMv7 -D_LITTLE_ENDIAN=1";
68 if(extDbgFlags_a15)
69 A15LE.ccOpts.prefix = A15LE.ccOpts.prefix + " " + extDbgFlags_a15;
71 /* ARMv7 A9 compiler configuration */
72 var A9LE = xdc.useModule('gnu.targets.arm.A9F');
73 A9LE.rootDir = a9ToolsBaseDir;
74 A9LE.ccOpts.prefix = "-mno-unaligned-access -c -mtune=cortex-a9 -marm -DDRA7xx -gstrict-dwarf -Wall -D__ARMv7 -D_LITTLE_ENDIAN=1";
75 if(extDbgFlags_a9)
76 A9LE.ccOpts.prefix = A9LE.ccOpts.prefix + " " + extDbgFlags_a9;
78 /* ARMv7 A8 compiler configuration */
79 var A8LE = xdc.useModule('gnu.targets.arm.A8F');
80 A8LE.rootDir = a8ToolsBaseDir;
81 A8LE.ccOpts.prefix = "-mno-unaligned-access -c -mtune=cortex-a8 -marm -DDRA7xx -gstrict-dwarf -Wall -D__ARMv7 -D_LITTLE_ENDIAN=1";
82 if(extDbgFlags_a8)
83 A8LE.ccOpts.prefix = A8LE.ccOpts.prefix + " " + extDbgFlags_a8;
85 /* M4 ELF compiler configuration for Little Endian Mode. */
86 var M4LE = xdc.useModule('ti.targets.arm.elf.M4');
87 M4LE.rootDir = m4ToolsBaseDir;
88 M4LE.ccOpts.prefix = "-o4 -qq -pdsw255 -DMAKEFILE_BUILD";
89 if(extDbgFlags_m4)
90 M4LE.ccOpts.prefix = M4LE.ccOpts.prefix + " " + extDbgFlags_m4;
93 /* soc name (am?) is inserted between first an second element of this
94 list to construct device file name for each device */
95 var deviceConstruct = [ "soc/", "/src/pcie_soc.c" ];
97 /* Create the SoC List */
98 var socs = {
99 /* device independent libraries */
100 all :
101 {
102 /* Build this library */
103 build: "true",
104 /* SoC lib enabled */
105 socDevLib: "false",
106 /* Library options */
107 copts: "",
108 /* target lists, kept blank now, would be updated based on argument lists */
109 targets: []
110 },
111 k2k :
112 {
113 /* this variable would be reinitialized to true, if XDCARGS contains am572x */
114 build: "false",
115 /* SoC lib enabled */
116 socDevLib: "true",
117 /* Library options */
118 copts: " -DDEVICE_K2K",
119 /* target list */
120 targets: [ C66LE, C66BE, A15LE ]
121 },
122 k2h :
123 {
124 /* this variable would be reinitialized to true, if XDCARGS contains am572x */
125 build: "false",
126 /* SoC lib enabled */
127 socDevLib: "true",
128 /* Library options */
129 copts: " -DDEVICE_K2H",
130 /* target list */
131 targets: [ C66LE, C66BE, A15LE ]
132 },
133 k2e :
134 {
135 /* this variable would be reinitialized to true, if XDCARGS contains am572x */
136 build: "false",
137 /* SoC lib enabled */
138 socDevLib: "true",
139 /* Library options */
140 copts: " -DDEVICE_K2E",
141 /* target list */
142 targets: [ C66LE, C66BE, A15LE ]
143 },
144 k2l :
145 {
146 /* this variable would be reinitialized to true, if XDCARGS contains am572x */
147 build: "false",
148 /* SoC lib enabled */
149 socDevLib: "true",
150 /* Library options */
151 copts: " -DDEVICE_K2L",
152 /* target list */
153 targets: [ C66LE, C66BE, A15LE ]
154 },
155 k2g :
156 {
157 /* this variable would be reinitialized to true, if XDCARGS contains am572x */
158 build: "false",
159 /* SoC lib enabled */
160 socDevLib: "true",
161 /* Library options */
162 copts: " -DSOC_K2G",
163 /* target list */
164 targets: [ C66LE, C66BE, A15LE ]
165 },
166 c6678 :
167 {
168 /* this variable would be reinitialized to true, if XDCARGS contains c6678 */
169 build: "false",
170 /* SoC lib enabled */
171 socDevLib: "true",
172 /* Library options */
173 copts: " -DSOC_C6678",
174 /* target list */
175 targets: [ C66LE, C66BE ]
176 },
177 c6657 :
178 {
179 /* this variable would be reinitialized to true, if XDCARGS contains c6657 */
180 build: "false",
181 /* SoC lib enabled */
182 socDevLib: "true",
183 /* Library options */
184 copts: " -DSOC_C6657",
185 /* target list */
186 targets: [ C66LE, C66BE ]
187 },
188 am572x :
189 {
190 /* this variable would be reinitialized to true, if XDCARGS contains am572x */
191 build: "false",
192 /* SoC lib enabled */
193 socDevLib: "true",
194 /* Library options */
195 copts: " -DSOC_AM572x",
196 /* target list */
197 targets: [ C66LE, M4LE, A15LE]
198 },
199 am574x :
200 {
201 /* this variable would be reinitialized to true, if XDCARGS contains am574x */
202 build: "false",
203 /* SoC lib enabled */
204 socDevLib: "true",
205 /* Library options */
206 copts: " -DSOC_AM574x",
207 /* target list */
208 targets: [ C66LE, M4LE, A15LE]
209 },
210 am571x :
211 {
212 /* this variable would be reinitialized to true, if XDCARGS contains am571x */
213 build: "false",
214 /* SoC lib enabled */
215 socDevLib: "true",
216 /* Library options */
217 copts: " -DSOC_AM571x",
218 /* target list */
219 targets: [ C66LE, M4LE, A15LE]
220 }
221 };
223 /**************************************************************************
224 * FUNCTION NAME : merge
225 **************************************************************************
226 * DESCRIPTION :
227 * The function is used to merge two arrarys
228 **************************************************************************/
229 function merge() {
230 var args = arguments;
231 var hash = {};
232 var arr = [];
233 for (var i = 0; i < args.length; i++) {
234 for (var j = 0; j < args[i].length; j++) {
235 if (hash[args[i][j]] !== true) {
236 arr[arr.length] = args[i][j];
237 hash[args[i][j]] = true;
238 }
239 }
240 }
241 return arr;
242 }
244 /* Grab input from XDCARGS */
245 var buildArguments = [];
247 /* Construct the build arguments */
248 for (var tmp=0; arguments[tmp] != undefined; tmp++)
249 {
251 /* If no arguments are provided, override for building all */
252 if ( ( arguments.length == 1) && (arguments[tmp].equals("./config.bld")) )
253 buildArguments[buildArguments.length++] = "all";
254 else
255 buildArguments[buildArguments.length++] = arguments[tmp];
256 }
258 /* Build targets on this build */
259 var build_targets = [];
261 for (var i=0; i < buildArguments.length; i++ ) {
262 /* Build it for all targets */
263 var soc_names = Object.keys(socs);
264 if (buildArguments[i] == "all") {
265 for (var j = 0; j < soc_names.length; j++) {
266 build_targets = merge (build_targets.slice(0), socs[soc_names[j]].targets.slice(0));
267 /* Set build to "true" for that SoC */
268 socs[soc_names[j]].build = "true";
269 }
270 }
271 else {
272 /* Skip the first argument, which is ./config.bld to get to next SoCs */
273 if (i == 0) continue;
274 /* Set that build to true if it is found in supported build socs */
275 for (j = 0; j < soc_names.length; j++) {
276 if (buildArguments[i] == soc_names[j]) {
277 socs[buildArguments[i]].build = "true";
278 build_targets = merge (build_targets.slice(0), socs[buildArguments[i]].targets.slice(0));
279 break;
280 }
281 }
282 }
283 }
285 /* Update the Build target generated list */
286 socs["all"].targets = build_targets;
287 Build.targets = build_targets;