[processor-sdk/performance-audio-sr.git] / psdk_cust / pdk_k2g_1_0_1_1_eng / packages / ti / csl / config.bld
1 /******************************************************************************
2 * FILE PURPOSE: Build configuration Script for the CSL
3 ******************************************************************************
4 * FILE NAME: config.bld
5 *
6 * DESCRIPTION:
7 * This file contains the build configuration script for CSL
8 * and is responsible for configuration of the paths for the various tools
9 * required to build CSL.
10 *
11 * Copyright (C) 2012-2015, Texas Instruments, Inc.
12 *****************************************************************************/
13 /* Get the Tools Base directory from the Environment Variable. */
14 var c66ToolsBaseDir = java.lang.System.getenv("C6X_GEN_INSTALL_PATH");
15 var m4ToolsBaseDir = java.lang.System.getenv("TOOLCHAIN_PATH_M4");
16 var a15ToolsBaseDir = java.lang.System.getenv("TOOLCHAIN_PATH_A15");
17 var a9ToolsBaseDir = java.lang.System.getenv("TOOLCHAIN_PATH_A9");
18 var a8ToolsBaseDir = java.lang.System.getenv("TOOLCHAIN_PATH_A8");
20 /* Get the extended debug flags for C66x,
21 * did not change the name for backwards compatibilty */
22 var extDbgFlags = java.lang.System.getenv("EXTDBGFLAGS");
24 /* Get the extended debug flags for A15 */
25 var extDbgFlags_a15 = java.lang.System.getenv("EXTDBGFLAGS_A15");
26 /* Get the base directory for the CSL Package */
27 var cslPath = new java.io.File(".//").getPath();
29 /* Get the extended debug flags for A8 */
30 var extDbgFlags_a8 = java.lang.System.getenv("EXTDBGFLAGS_A8");
32 /* Get the extended debug flags for A9 */
33 var extDbgFlags_a9 = java.lang.System.getenv("EXTDBGFLAGS_A9");
35 var cslInstallType;
36 /* Get the extended debug flags for M4 */
37 var extDbgFlags_m4 = java.lang.System.getenv("EXTDBGFLAGS_M4");
39 /* Read the part number from the environment variable. */
40 var cslPartNumber = java.lang.System.getenv("PARTNO");
42 /* Include Path */
43 var cslPathInclude = " -I" + cslPath + "/src/intc" + " -I" + cslPath;
45 /* Configure the CSL Release Version Information */
46 var cslReleaseVersion = (""+Pkg.version.replace(/\s/g, "")).split(',');
48 /* CSL Coverity Analysis: Check the environment variable to determine if Static
49 * Analysis has to be done on the CSL Code base or not? */
50 var cslCoverityAnalysis = java.lang.System.getenv("CSLCOV");
52 /* C66lus ELF compiler configuration for Little Endian Mode. */
53 var C66LE = xdc.useModule('ti.targets.elf.C66');
54 C66LE.rootDir = c66ToolsBaseDir;
55 C66LE.asmOpts.prefix = "--strip_coff_underscore";
56 C66LE.ccOpts.prefix = "--strip_coff_underscore -mo -o3 -q -k -eo.o " + "-D" + cslPartNumber;
57 if(extDbgFlags)
58 C66LE.ccOpts.prefix = C66LE.ccOpts.prefix + " " + extDbgFlags;
60 /* C66lus ELF compiler configuration for Big Endian Mode. */
61 var C66BE = xdc.useModule('ti.targets.elf.C66_big_endian');
62 C66BE.rootDir = c66ToolsBaseDir;
63 C66BE.asmOpts.prefix = "--strip_coff_underscore";
64 C66BE.ccOpts.prefix = "--strip_coff_underscore -mo -o3 -q -k -eo.o -DBIGENDIAN " + "-D" + cslPartNumber;
65 if(extDbgFlags)
66 C66BE.ccOpts.prefix = C66BE.ccOpts.prefix + " " + extDbgFlags;
68 /* ARMv7 A15 compiler configuration */
69 var A15LE = xdc.useModule('gnu.targets.arm.A15F');
70 A15LE.rootDir = a15ToolsBaseDir;
71 A15LE.ccOpts.prefix = "-mno-unaligned-access -c -mtune=cortex-a15 -marm -DDRA7xx -gstrict-dwarf -Wall -D__ARMv7 -D_LITTLE_ENDIAN=1";
72 if(extDbgFlags_a15)
73 A15LE.ccOpts.prefix = A15LE.ccOpts.prefix + " " + extDbgFlags_a15;
75 /* ARMv7 A9 compiler configuration */
76 var A9LE = xdc.useModule('gnu.targets.arm.A9F');
77 A9LE.rootDir = a9ToolsBaseDir;
78 A9LE.ccOpts.prefix = "-mno-unaligned-access -c -mtune=cortex-a9 -marm -DDRA7xx -Dxdc_target_types__=gnu/targets/arm/std.h -Dxdc_target_name__=A9F -gstrict-dwarf -Wall -D__ARMv7 -D_LITTLE_ENDIAN=1";
79 if(extDbgFlags_a9)
80 A9LE.ccOpts.prefix = A9LE.ccOpts.prefix + " " + extDbgFlags_a9;
82 /* ARMv7 A8 compiler configuration */
83 var A8LE = xdc.useModule('gnu.targets.arm.A8F');
84 A8LE.rootDir = a8ToolsBaseDir;
85 A8LE.ccOpts.prefix = "-mno-unaligned-access -c -mtune=cortex-a8 -marm -DDRA7xx -Dxdc_target_types__=gnu/targets/arm/std.h -Dxdc_target_name__=A8F -gstrict-dwarf -Wall -D__ARMv7 -D_LITTLE_ENDIAN=1";
86 if(extDbgFlags_a8)
87 A8LE.ccOpts.prefix = A8LE.ccOpts.prefix + " " + extDbgFlags_a8;
89 /* M4 ELF compiler configuration for Little Endian Mode. */
90 var M4LE = xdc.useModule('ti.targets.arm.elf.M4');
91 M4LE.rootDir = m4ToolsBaseDir;
92 M4LE.ccOpts.prefix = "-o4 -qq -pdsw255 -DMAKEFILE_BUILD";
93 if(extDbgFlags_m4)
94 M4LE.ccOpts.prefix = M4LE.ccOpts.prefix + " " + extDbgFlags_m4;
96 /* Setup the Coverity Filters to perform Static Analysis. */
97 if (cslCoverityAnalysis == "ON") {
98 var coverityInstallPath = java.lang.System.getenv("COVPATH");
99 var cfgBase = xdc.getPackageBase("tisb.coverity.filters") + "cfg";
101 var coverityFilter = [
102 {
103 moduleName: "tisb.coverity.filters.Coverity",
104 params: {
105 cfgDir: cfgBase, // the Coverity configuration file directory
106 rootDir: coverityInstallPath, // install directory of Prevent
107 outDir: xdc.csd() + "cov_out", // the cov-emit and cov-analyze output directory
108 analyzeLibs: true // run cov-analyze on all libraries
109 }
110 },
111 ];
113 /* Coverity Analysis are done only for the C66 Little Endian libraries. */
114 C66LE.profiles["release"].filters = coverityFilter;
115 }
117 /* Check if we need to create the Makefiles? */
118 var miniBuild = java.lang.System.getenv("MINI_PACKAGE");
119 if (miniBuild == "ON")
120 {
121 /* Add the filter for simple Makefile generation. */
122 var makeC66LEFilter = {
123 moduleName: "build.filter.Make",
124 params: {
125 makefileName: "simpleC66LE.mak",
126 }
127 };
128 C66LE.profiles["release"].filters[C66LE.profiles["release"].filters.length++] = makeC66LEFilter;
130 var makeC66BEFilter = {
131 moduleName: "build.filter.Make",
132 params: {
133 makefileName: "simpleC66BE.mak",
134 }
135 };
136 C66BE.profiles["release"].filters[C66BE.profiles["release"].filters.length++] = makeC66BEFilter;
137 }
139 /* List of all devices that combine to make the CSL and intc library.
140 * Note the first entry corresponds to "src/intc" which is
141 * device independent. Refer src/Module.xs to see the order.
142 */
143 var devices = [ "", "k2k", "k2h",
144 "k2e", "k2l",
145 "k2g",
146 "am572x", "am571x",
147 "c6678", "c6657" ];
149 var devicesCCOpt = [ "", " -DSOC_K2K", " -DSOC_K2H",
150 " -DSOC_K2E", " -DSOC_K2L",
151 " -DSOC_K2G",
152 " -DSOC_AM572x", " -DSOC_AM571x",
153 " -DSOC_C6678", " -DSOC_C6657"];
155 var build_devices;
156 for ( i=0; i < arguments.length; i++)
157 {
158 print ("ARG[" + i + "] = " + arguments[i]);
159 }
160 if ( arguments.length <= 1 || arguments[1] == "all" )
161 {
162 build_devices = devices;
163 }
164 else
165 {
166 print("Building for subset of devices");
167 build_devices = arguments;
168 build_devices[0] = "";
169 }
171 /* Create the SoC List */
172 var socs = {
173 /* device independent libraries */
174 all :
175 {
176 /* Build this library */
177 build: "true",
178 /* target lists, kept blank now, would be updated based on argument lists */
179 targets: []
180 },
181 k2e :
182 {
183 /* Build this library */
184 build: "false",
185 /* target list */
186 targets: [ C66LE, C66BE, A15LE ]
187 },
188 k2h :
189 {
190 /* Build this library */
191 build: "false",
192 /* target list */
193 targets: [ C66LE, C66BE, A15LE ]
194 },
195 k2k :
196 {
197 /* Build this library */
198 build: "false",
199 /* target list */
200 targets: [ C66LE, C66BE, A15LE ]
201 },
202 k2l :
203 {
204 /* Build this library */
205 build: "false",
206 /* target list */
207 targets: [ C66LE, C66BE, A15LE ]
208 },
209 k2g :
210 {
211 /* Build this library */
212 build: "false",
213 /* target list */
214 targets: [ C66LE, C66BE, A15LE ]
215 },
216 c6678 :
217 {
218 /* Build this library */
219 build: "false",
220 /* target list */
221 targets: [ C66LE, C66BE ]
222 },
223 c6657 :
224 {
225 /* Build this library */
226 build: "false",
227 /* target list */
228 targets: [ C66LE, C66BE ]
229 },
230 am572x :
231 {
232 /* Build this library */
233 build: "false",
234 /* target list */
235 targets: [ C66LE, M4LE, A15LE ]
236 },
237 am571x :
238 {
239 /* Build this library */
240 build: "false",
241 /* target list */
242 targets: [ C66LE, M4LE, A15LE ]
243 },
244 am335x :
245 {
246 /* Build this library */
247 build: "false",
248 /* target list */
249 targets: [ A8LE ]
250 },
251 am437x :
252 {
253 /* Build this library */
254 build: "false",
255 /* target list */
256 targets: [ A9LE ]
257 }
258 };
260 /**************************************************************************
261 * FUNCTION NAME : merge
262 **************************************************************************
263 * DESCRIPTION :
264 * The function is used to merge two arrarys
265 **************************************************************************/
266 function merge() {
267 var args = arguments;
268 var hash = {};
269 var arr = [];
270 for (var i = 0; i < args.length; i++) {
271 for (var j = 0; j < args[i].length; j++) {
272 if (hash[args[i][j]] !== true) {
273 arr[arr.length] = args[i][j];
274 hash[args[i][j]] = true;
275 }
276 }
277 }
278 return arr;
279 }
281 /* Grab input from XDCARGS */
282 var buildArguments = [];
284 /* Construct the build arguments */
285 for (var tmp=0; arguments[tmp] != undefined; tmp++)
286 {
288 /* If no arguments are provided, override for building all */
289 if ( ( arguments.length == 1) && (arguments[tmp].equals("./config.bld")) )
290 buildArguments[buildArguments.length++] = "all";
291 else
292 buildArguments[buildArguments.length++] = arguments[tmp];
293 }
295 /* Build targets on this build */
296 var build_targets = [];
297 var soc_names = Object.keys(socs);
299 for (var i=0; i < buildArguments.length; i++ ) {
300 /* Build it for all targets */
301 if (buildArguments[i] == "all") {
302 for (var j = 0; j < soc_names.length; j++) {
303 build_targets = merge (build_targets.slice(0), socs[soc_names[j]].targets.slice(0));
304 /* Set build to "true" for that SoC */
305 socs[soc_names[j]].build = "true";
306 }
307 }
308 else {
309 /* Skip the first argument, which is ./config.bld to get to next SoCs */
310 if (i == 0) continue;
311 /* Set that build to true if it is found in supported build socs */
312 for (j = 0; j < soc_names.length; j++) {
313 if (buildArguments[i] == soc_names[j]) {
314 socs[buildArguments[i]].build = "true";
315 build_targets = merge (build_targets.slice(0), socs[buildArguments[i]].targets.slice(0));
316 break;
317 }
318 }
319 }
320 }
322 /* Update the Build target generated list */
323 socs["all"].targets = build_targets;
324 Build.targets = build_targets;