1 /******************************************************************************
2 * FILE PURPOSE: Build configuration Script for the SA LLD
3 ******************************************************************************
4 * FILE NAME: config.bld
5 *
6 * DESCRIPTION:
7 * This file contains the build configuration script for the SA LLD
8 * and is responsible for configuration of the paths for the various
9 * tools required to build the driver.
10 *
11 * Copyright (C) 2011-2017, 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 a15ToolsBaseDir = java.lang.System.getenv("TOOLCHAIN_PATH_A15");
18 /* Get the extended debug flags for C66x,
19 * did not change the name for backwards compatibilty */
20 var extDbgFlags = java.lang.System.getenv("EXTDBGFLAGS");
22 /* Get the extended debug flags for A15 */
23 var extDbgFlags_a15 = java.lang.System.getenv("EXTDBGFLAGS_A15");
26 /* Get the base directory for the SA LLD Package */
27 var lldPath = new java.io.File(".//").getPath();
29 var lldInstallType;
31 /* Read the part number from the environment variable. */
32 var lldPartNumber = java.lang.System.getenv("PARTNO");
34 /* print compiler options */
35 var pOpts = 1;
37 /* should library be explicity be specified for package.bld
38 * for XDC based builds that use this config.bld,
39 * lib folder is packaged automatically, do not need to
40 * provide the lib folder for explicit package.bld list
41 */
42 var pkgLibExplicitly = 0;
44 /* Include Path */
45 var salldIncPath = " -I" + lldPath + "/src" + " -I" + lldPath + " -I" + lldPath + "/test";
47 /* Configure the SA LLD Release Version Information */
48 /* 3 steps: remove SPACE and TAB, convert to string and split to make array */
49 var lldReleaseVersion = (""+Pkg.version.replace(/\s/g, "")).split(',');
51 /* SA LLD Coverity Analysis: Check the environment variable to determine if Static
52 * Analysis has to be done on the CPPI LLD Code base or not? */
53 var lldCoverityAnalysis = java.lang.System.getenv("LLDCOV");
55 /* C66 ELF compiler configuration for Little Endian Mode. */
56 var C66LE = xdc.useModule('ti.targets.elf.C66');
57 C66LE.rootDir = c66ToolsBaseDir;
58 C66LE.ccOpts.prefix = "-mo -o3 -q -k -eo.o";
59 if(extDbgFlags)
60 C66LE.ccOpts.prefix = C66LE.ccOpts.prefix + " " + extDbgFlags;
62 /* ARMv7 A15 compiler configuration */
63 var A15LE = xdc.useModule('gnu.targets.arm.A15F');
64 A15LE.rootDir = a15ToolsBaseDir;
65 A15LE.ccOpts.prefix = "-mno-unaligned-access -c -mtune=cortex-a15 -marm -DDRA7xx -gstrict-dwarf -Wall -D__ARMv7 -D_LITTLE_ENDIAN=1";
66 if(extDbgFlags_a15)
67 A15LE.ccOpts.prefix = A15LE.ccOpts.prefix + " " + extDbgFlags_a15;
69 /* Check if we need to run the STATIC Analysis or not? */
70 var coverityAnalysis = java.lang.System.getenv("STATIC_ANALYZE");
72 /* Setup the Coverity Filters to perform Static Analysis. */
73 if (coverityAnalysis == "ON") {
74 var coverityInstallPath = java.lang.System.getenv("STATIC_ANALYZE_PATH");
75 var cfgBase = xdc.getPackageBase("tisb.coverity.filters") + "cfg";
77 var coverityFilter = [
78 {
79 moduleName: "tisb.coverity.filters.Coverity",
80 params: {
81 cfgDir: cfgBase, // The Coverity configuration file directory
82 rootDir: coverityInstallPath,
83 outDir: xdc.csd() + "cov_out",
84 analyzeLibs: true
85 }
86 },
87 ];
89 /* Run the coverity filters on the LE Build only. */
90 C66LE.profiles["release"].filters = coverityFilter;
91 }
93 /* Check if we need to create the Makefiles? */
94 var miniBuild = java.lang.System.getenv("MINI_PACKAGE");
96 if (miniBuild == "ON")
97 {
98 /* Add the filter for simple Makefile generation. */
100 var makeC66LEFilter = {
101 moduleName: "build.filter.Make",
102 params: {
103 makefileName: "simpleC66LE.mak",
104 }
105 };
107 C66LE.profiles["release"].filters[C66LE.profiles["release"].filters.length++] = makeC66LEFilter;
109 }
111 for ( i=0; i < arguments.length; i++)
112 {
113 print ("ARG[" + i + "] = " + arguments[i]);
114 }
116 /* Create the SoC List */
117 var socs = {
118 /* device independent libraries */
119 all :
120 {
121 /* Build this library */
122 build: "true",
123 /* target lists, kept blank now, would be updated based on argument lists */
124 targets: []
125 },
126 k2h :
127 {
128 /* Build this library */
129 build: "false",
130 /* target list */
131 targets: [ C66LE, A15LE ]
132 },
133 k2k :
134 {
135 /* Build this library */
136 build: "false",
137 /* target list */
138 targets: [ C66LE, A15LE ]
139 },
140 k2e :
141 {
142 /* Build this library */
143 build: "false",
144 /* target list */
145 targets: [ C66LE, A15LE ]
146 },
147 k2l :
148 {
149 /* Build this library */
150 build: "false",
151 /* target list */
152 targets: [ C66LE, A15LE ]
153 },
154 k2g :
155 {
156 /* Build this library */
157 build: "false",
158 /* target list */
159 targets: [ C66LE, A15LE ]
160 },
161 c6678 :
162 {
163 /* Build this library */
164 build: "false",
165 /* target list */
166 targets: [ C66LE]
167 }
168 };
170 /**************************************************************************
171 * FUNCTION NAME : merge
172 **************************************************************************
173 * DESCRIPTION :
174 * The function is used to merge two arrarys
175 **************************************************************************/
176 function merge() {
177 var args = arguments;
178 var hash = {};
179 var arr = [];
180 for (var i = 0; i < args.length; i++) {
181 for (var j = 0; j < args[i].length; j++) {
182 if (hash[args[i][j]] !== true) {
183 arr[arr.length] = args[i][j];
184 hash[args[i][j]] = true;
185 }
186 }
187 }
188 return arr;
189 }
191 /* Grab input from XDCARGS */
192 var buildArguments = [];
194 /* Construct the build arguments */
195 for (var tmp=0; arguments[tmp] != undefined; tmp++)
196 {
198 /* If no arguments are provided, override for building all */
199 if ( ( arguments.length == 1) && (arguments[tmp].equals("./config.bld")) )
200 buildArguments[buildArguments.length++] = "all";
201 else
202 buildArguments[buildArguments.length++] = arguments[tmp];
203 }
205 /* Build targets on this build */
206 var build_targets = [];
207 var soc_names = Object.keys(socs);
209 for (var i=0; i < buildArguments.length; i++ ) {
210 /* Build it for all targets */
211 if (buildArguments[i] == "all") {
212 for (var j = 0; j < soc_names.length; j++) {
213 build_targets = merge (build_targets.slice(0), socs[soc_names[j]].targets.slice(0));
214 /* Set build to "true" for that SoC */
215 socs[soc_names[j]].build = "true";
216 }
217 }
218 else {
219 /* Skip the first argument, which is ./config.bld to get to next SoCs */
220 if (i == 0) continue;
221 /* Set that build to true if it is found in supported build socs */
222 for (j = 0; j < soc_names.length; j++) {
223 if (buildArguments[i] == soc_names[j]) {
224 socs[buildArguments[i]].build = "true";
225 build_targets = merge (build_targets.slice(0), socs[buildArguments[i]].targets.slice(0));
226 break;
227 }
228 }
229 }
230 }
232 /* Update the Build target generated list */
233 socs["all"].targets = build_targets;
234 Build.targets = build_targets;