1 /******************************************************************************
2 * FILE PURPOSE: Build configuration Script for the Fault Management
3 ******************************************************************************
4 * FILE NAME: config.bld
5 *
6 * DESCRIPTION:
7 * This file contains the build configuration script for Fault Management
8 * and is responsible for configuration of the paths for the various tools
9 * required to build Fault Management.
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");
17 /* Get the extended debug flags for C66x,
18 * did not change the name for backwards compatibilty */
19 var extDbgFlags = java.lang.System.getenv("EXTDBGFLAGS");
21 /* Get the base directory for the FM Package */
22 var lldPath = new java.io.File(".//").getPath();
24 var lldInstallType;
26 /* Read the part number from the environment variable. */
27 var lldPartNumber = java.lang.System.getenv("PARTNO");
29 /* Include Path */
30 var lldIncludePath = " -I" + lldPath + "/src" + " -I" + lldPath + " -I" + lldPath + "/test";
32 /* Configure the Fault Management Release Version Information */
33 /* 3 steps: remove SPACE and TAB, convert to string and split to make array */
34 var lldReleaseVersion = (""+Pkg.version.replace(/\s/g, "")).split(',');
36 /* Fault Management Coverity Analysis: Check the environment variable to determine if Static
37 * Analysis has to be done on the Fault Management Code base or not? */
38 var lldCoverityAnalysis = java.lang.System.getenv("LLDCOV");
40 /* C66 ELF compiler configuration for Little Endian Mode. */
41 var C66LE = xdc.useModule('ti.targets.elf.C66');
42 C66LE.rootDir = c66ToolsBaseDir;
43 C66LE.ccOpts.prefix = "-mo -o3 --gcc -q -k -eo.o";
44 if(extDbgFlags)
45 C66LE.ccOpts.prefix = C66LE.ccOpts.prefix + " " + extDbgFlags;
47 /* C66 ELF compiler configuration for Big Endian Mode. */
48 var C66BE = xdc.useModule('ti.targets.elf.C66_big_endian');
49 C66BE.rootDir = c66ToolsBaseDir;
50 C66BE.ccOpts.prefix = "-mo -o3 --gcc -q -k -eo.o -DBIGENDIAN";
51 if(extDbgFlags)
52 C66BE.ccOpts.prefix = C66BE.ccOpts.prefix + " " + extDbgFlags;
54 /* Check if we need to run the STATIC Analysis or not? */
55 var coverityAnalysis = java.lang.System.getenv("STATIC_ANALYZE");
57 /* Setup the Coverity Filters to perform Static Analysis. */
58 if (coverityAnalysis == "ON") {
59 var coverityInstallPath = java.lang.System.getenv("STATIC_ANALYZE_PATH");
60 var cfgBase = xdc.getPackageBase("tisb.coverity.filters") + "cfg";
62 var coverityFilter = [
63 {
64 moduleName: "tisb.coverity.filters.Coverity",
65 params: {
66 cfgDir: cfgBase, // The Coverity configuration file directory
67 rootDir: coverityInstallPath,
68 outDir: xdc.csd() + "cov_out",
69 analyzeLibs: true
70 }
71 },
72 ];
74 /* Run the coverity filters on the LE Build only. */
75 C66LE.profiles["release"].filters = coverityFilter;
76 }
78 /* Check if we need to create the Makefiles? */
79 var miniBuild = java.lang.System.getenv("MINI_PACKAGE");
81 if (miniBuild == "ON")
82 {
83 /* Add the filter for simple Makefile generation. */
85 var makeC66LEFilter = {
86 moduleName: "build.filter.Make",
87 params: {
88 makefileName: "simpleC66LE.mak",
89 }
90 };
92 C66LE.profiles["release"].filters[C66LE.profiles["release"].filters.length++] = makeC66LEFilter;
94 var makeC66BEFilter = {
95 moduleName: "build.filter.Make",
96 params: {
97 makefileName: "simpleC66BE.mak",
98 }
99 };
101 C66BE.profiles["release"].filters[C66BE.profiles["release"].filters.length++] = makeC66BEFilter;
103 }
105 /* Create the SoC List */
106 var socs = {
107 /* device independent libraries */
108 all :
109 {
110 /* Currently, only device dependent libraries supported */
111 build: "false",
112 /* SoC lib enabled */
113 socDevLib: "false",
114 /* dma lib enabled */
115 dmaDevLib: "false",
116 /* Library options */
117 copts: "",
118 /* target lists, kept blank now, would be updated based on argument lists */
119 targets: []
120 },
121 tci6614 :
122 {
123 /* This variable will be reinitialized to true, if XDCARGS contains tci6614 */
124 build: "false",
125 /* SoC lib enabled */
126 socDevLib: "true",
127 /* dma lib enabled */
128 dmaDevLib: "false",
129 /* Library options */
130 copts: "",
131 /* target list */
132 targets: [ C66LE, C66BE]
133 },
134 k2h :
135 {
136 /* This variable will be reinitialized to true, if XDCARGS contains k2h */
137 build: "false",
138 /* SoC lib enabled */
139 socDevLib: "true",
140 /* dma lib enabled */
141 dmaDevLib: "false",
142 /* Library options */
143 copts: " -DDEVICE_K2H",
144 /* target list */
145 targets: [ C66LE, C66BE]
146 },
147 k2k :
148 {
149 /* This variable will be reinitialized to true, if XDCARGS contains k2k */
150 build: "false",
151 /* SoC lib enabled */
152 socDevLib: "true",
153 /* dma lib enabled */
154 dmaDevLib: "false",
155 /* Library options */
156 copts: " -DDEVICE_K2K",
157 /* target list */
158 targets: [ C66LE, C66BE]
159 },
160 k2e :
161 {
162 /* This variable will be reinitialized to true, if XDCARGS contains k2e */
163 build: "false",
164 /* SoC lib enabled */
165 socDevLib: "true",
166 /* dma lib enabled */
167 dmaDevLib: "false",
168 /* Library options */
169 copts: " -DDEVICE_K2E",
170 /* target list */
171 targets: [ C66LE, C66BE]
172 },
173 k2l :
174 {
175 /* This variable will be reinitialized to true, if XDCARGS contains k2l */
176 build: "false",
177 /* SoC lib enabled */
178 socDevLib: "true",
179 /* dma lib enabled */
180 dmaDevLib: "false",
181 /* Library options */
182 copts: " -DDEVICE_K2L",
183 /* target list */
184 targets: [ C66LE, C66BE]
185 }
186 };
188 /**************************************************************************
189 * FUNCTION NAME : merge
190 **************************************************************************
191 * DESCRIPTION :
192 * The function is used to merge two arrarys
193 **************************************************************************/
194 function merge() {
195 var args = arguments;
196 var hash = {};
197 var arr = [];
198 for (var i = 0; i < args.length; i++) {
199 for (var j = 0; j < args[i].length; j++) {
200 if (hash[args[i][j]] !== true) {
201 arr[arr.length] = args[i][j];
202 hash[args[i][j]] = true;
203 }
204 }
205 }
206 return arr;
207 }
209 /* Grab input from XDCARGS */
210 var buildArguments = [];
212 /* Construct the build arguments */
213 for (var tmp=0; arguments[tmp] != undefined; tmp++)
214 {
216 /* If no arguments are provided, override for building all */
217 if ( ( arguments.length == 1) && (arguments[tmp].equals("./config.bld")) )
218 buildArguments[buildArguments.length++] = "all";
219 else
220 buildArguments[buildArguments.length++] = arguments[tmp];
221 }
223 /* Build targets on this build */
224 var build_targets = [];
225 var soc_names = Object.keys(socs);
227 for (var i=0; i < buildArguments.length; i++ ) {
228 /* Build it for all targets */
229 if (buildArguments[i] == "all") {
230 for (var j = 0; j < soc_names.length; j++) {
231 build_targets = merge (build_targets.slice(0), socs[soc_names[j]].targets.slice(0));
232 /* Set build to "true" for that SoC */
233 socs[soc_names[j]].build = "true";
234 }
235 }
236 else {
237 /* Skip the first argument, which is ./config.bld to get to next SoCs */
238 if (i == 0) continue;
239 /* Set that build to true if it is found in supported build socs */
240 for (j = 0; j < soc_names.length; j++) {
241 if (buildArguments[i] == soc_names[j]) {
242 socs[buildArguments[i]].build = "true";
243 build_targets = merge (build_targets.slice(0), socs[buildArguments[i]].targets.slice(0));
244 break;
245 }
246 }
247 }
248 }
250 /* Update the Build target generated list */
251 socs["all"].targets = build_targets;
252 Build.targets = build_targets;