1 /******************************************************************************
2 * FILE PURPOSE: Build configuration Script for the MCBSP Driver
3 ******************************************************************************
4 * FILE NAME: config.bld
5 *
6 * DESCRIPTION:
7 * This file contains the build configuration script for the MCBSP driver
8 * and is responsible for configuration of the paths for the various
9 * tools required to build the driver.
10 *
11 * Copyright (C) 2012-2013, Texas Instruments, Inc.
12 *****************************************************************************/
14 /* Get the Tools Base directory from the Environment Variable. */
15 var toolsBaseDir = java.lang.System.getenv("XDCCGROOT");
17 /* Get the extended debug flags */
18 var extDbgFlags = java.lang.System.getenv("EXTDBGFLAGS");
19 /* Get the base directory for the MCBSP Driver Package */
20 var mcbspDriverPath = new java.io.File(".//").getPath();
22 /* Read the part number from the environment variable. */
23 var mcbspLLDPartNumber = java.lang.System.getenv("PARTNO");
25 /* Get the base directory for the hyplnk LLD Package */
26 var mcbsplldPath = new java.io.File(".//").getPath();
27 /* Include Path */
28 var mcbsplldIncPath = " -i" + mcbsplldPath;
29 /* Configure the MCBSP Release Version Information */
30 var mcbspDriverReleaseVersion = (""+Pkg.version.replace(/\s/g, "")).split(',');
32 /* C66 ELF compiler configuration for Little Endian Mode. */
33 var C66LE = xdc.useModule('ti.targets.elf.C66');
34 C66LE.rootDir = toolsBaseDir;
35 C66LE.ccOpts.prefix = "-mo -o3 -q -k -eo.o";
36 if(extDbgFlags)
37 C66LE.ccOpts.prefix = C66LE.ccOpts.prefix + " " + extDbgFlags;
39 /* C6740 elf compiler configuration for Little Endian Mode. */
40 var C67LE = xdc.useModule('ti.targets.elf.C674');
41 C67LE.rootDir = toolsBaseDir;
42 C67LE.ccOpts.prefix = "-mo -o3 -q -k -eo.o";
43 if(extDbgFlags)
44 C67LE.ccOpts.prefix = C67LE.ccOpts.prefix + " " + extDbgFlags;
46 /* C66 ELF compiler configuration for Big Endian Mode. */
47 var C66BE = xdc.useModule('ti.targets.elf.C66_big_endian');
48 C66BE.rootDir = toolsBaseDir;
49 C66BE.ccOpts.prefix = "-mo -o3 -q -k -eo.o -DBIGENDIAN";
50 if(extDbgFlags)
51 C66BE.ccOpts.prefix = C66BE.ccOpts.prefix + " " + extDbgFlags;
55 /* device name (k2?) is inserted between first an second element of this
56 list to construct device file name for each device */
57 var deviceConstruct = [ "device/", "/src/device_mcbsp_loopback.c" ];
59 /* Create the SoC List */
60 var socs = {
61 /* device independent libraries */
62 all :
63 {
64 /* Build this library */
65 build: "true",
66 /* SoC lib disabled as this is device independent lib */
67 socDevLib: "false",
68 /* Library options */
69 copts: "",
70 /* target lists, kept blank now, would be updated based on argument lists */
71 targets: []
72 },
73 k2g :
74 {
75 /* this variable would be reinitialized to true, if XDCARGS contains k2g */
76 build: "false",
77 /* SoC lib enabled */
78 socDevLib: "true",
79 /* Library options */
80 copts: " -DDEVICE_K2G -DSOC_K2G",
81 /* target list */
82 targets: [ C66LE, C66BE ]
83 },
84 c674x :
85 {
86 /* this variable would be reinitialized to true, if XDCARGS contains c674x */
87 build: "false",
88 /* SoC lib enabled */
89 socDevLib: "true",
90 /* Library options */
91 copts: " -DSOC_C674X",
92 /* target list */
93 targets: [ C66LE, C66BE ]
94 },
95 c6657 :
96 {
97 /* this variable would be reinitialized to true, if XDCARGS contains c6657 */
98 build: "false",
99 /* SoC lib enabled */
100 socDevLib: "true",
101 /* Library options */
102 copts: " -DSOC_C6657",
103 /* target list */
104 targets: [ C66LE, C66BE ]
105 },
106 };
108 /**************************************************************************
109 * FUNCTION NAME : merge
110 **************************************************************************
111 * DESCRIPTION :
112 * The function is used to merge two arrarys
113 **************************************************************************/
114 function merge() {
115 var args = arguments;
116 var hash = {};
117 var arr = [];
118 for (var i = 0; i < args.length; i++) {
119 for (var j = 0; j < args[i].length; j++) {
120 if (hash[args[i][j]] !== true) {
121 arr[arr.length] = args[i][j];
122 hash[args[i][j]] = true;
123 }
124 }
125 }
126 return arr;
127 }
129 /* Grab input from XDCARGS */
130 var buildArguments = [];
132 /* Construct the build arguments */
133 for (var tmp=0; arguments[tmp] != undefined; tmp++)
134 {
136 /* If no arguments are provided, override for building all */
137 if ( ( arguments.length == 1) && (arguments[tmp].equals("./config.bld")) )
138 buildArguments[buildArguments.length++] = "all";
139 else
140 buildArguments[buildArguments.length++] = arguments[tmp];
141 }
143 /* Build targets on this build */
144 var build_targets = [];
145 var soc_names = Object.keys(socs);
147 for (var i=0; i < buildArguments.length; i++ ) {
148 /* Build it for all targets */
149 if (buildArguments[i] == "all") {
150 for (var j = 0; j < soc_names.length; j++) {
151 build_targets = merge (build_targets.slice(0), socs[soc_names[j]].targets.slice(0));
152 /* Set build to "true" for that SoC */
153 socs[soc_names[j]].build = "true";
154 }
155 }
156 else {
157 /* Skip the first argument, which is ./config.bld to get to next SoCs */
158 if (i == 0) continue;
159 /* Set that build to true if it is found in supported build socs */
160 for (j = 0; j < soc_names.length; j++) {
161 if (buildArguments[i] == soc_names[j]) {
162 socs[buildArguments[i]].build = "true";
163 build_targets = merge (build_targets.slice(0), socs[buildArguments[i]].targets.slice(0));
164 break;
165 }
166 }
167 }
168 }
170 /* Update the Build target generated list */
171 socs["all"].targets = build_targets;
172 Build.targets = build_targets;