]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - processor-sdk/pdk.git/blob - packages/ti/drv/i2c/config.bld
Build Fix
[processor-sdk/pdk.git] / packages / ti / drv / i2c / config.bld
1 /******************************************************************************
2  * FILE PURPOSE: Build configuration Script for the i2c Driver
3  ******************************************************************************
4  * FILE NAME: config.bld
5  *
6  * DESCRIPTION: 
7  *  This file contains the build configuration script for the i2c driver
8  *  and is responsible for configuration of the paths for the various 
9  *  tools required to build the driver.
10  *
11  * Copyright (C) 2014-2016, 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 c674ToolsBaseDir = java.lang.System.getenv("C6X_GEN_INSTALL_PATH");
17 var m4ToolsBaseDir = java.lang.System.getenv("TOOLCHAIN_PATH_M4");
18 var a15ToolsBaseDir = java.lang.System.getenv("TOOLCHAIN_PATH_A15");
19 var a9ToolsBaseDir = java.lang.System.getenv("TOOLCHAIN_PATH_A9");
20 var arm9ToolsBaseDir  = java.lang.System.getenv("TOOLCHAIN_PATH_ARM9");
21 var a8ToolsBaseDir = java.lang.System.getenv("TOOLCHAIN_PATH_A8");
23 /* Get the extended debug flags for C66x, 
24  * did not change the name for backwards compatibilty */
25 var extDbgFlags = java.lang.System.getenv("EXTDBGFLAGS");
27 /* Get the extended debug flags for A15 */
28 var extDbgFlags_a15 = java.lang.System.getenv("EXTDBGFLAGS_A15");
30 /* Get the extended debug flags for A8 */
31 var extDbgFlags_a8 = java.lang.System.getenv("EXTDBGFLAGS_A8");
33 /* Get the extended debug flags for A9 */
34 var extDbgFlags_a9 = java.lang.System.getenv("EXTDBGFLAGS_A9");
36 /* Get the extended debug flags for ARM9 */
37 var extDbgFlags_arm9 = java.lang.System.getenv("EXTDBGFLAGS_ARM9");
39 /* Get the extended debug flags for M4 */
40 var extDbgFlags_m4 = java.lang.System.getenv("EXTDBGFLAGS_M4");
41 /* Get the base directory for the i2c Socket Driver Package */
42 var driverPath = new java.io.File(".//").getPath();
44 /* Include Path */
45 var lldIncludePath = " -I" + driverPath + "/src" + " -I" + driverPath;
47 /* Configure the i2c Socket Release Version Information */
48 /* 3 steps: remove SPACE and TAB, convert to string and split to make array */
49 var driverReleaseVersion = (""+Pkg.version.replace(/\s/g, "")).split(',');
51 /* Print the Compiler Options */
52 var pOpts = 1;
54 /* C66 ELF compiler configuration for Little Endian Mode. */
55 var C66LE           = xdc.useModule('ti.targets.elf.C66');
56 C66LE.rootDir       = c66ToolsBaseDir;
57 C66LE.ccOpts.prefix = "-mo -o3 -q -k -eo.o";
58 if(extDbgFlags)     
59     C66LE.ccOpts.prefix = C66LE.ccOpts.prefix + " " + extDbgFlags; 
61 /* C67 ELF compiler configuration for Little Endian Mode. */
62 var C674LE           = xdc.useModule('ti.targets.elf.C67');
63 C674LE.rootDir       = c66ToolsBaseDir;
64 C674LE.ccOpts.prefix = "-mo -o3 -q -k -eo.o";
65 if(extDbgFlags)     
66     C67LE.ccOpts.prefix = C67LE.ccOpts.prefix + " " + extDbgFlags; 
68 /* C66 ELF compiler configuration for Big Endian Mode. */
69 var C66BE           = xdc.useModule('ti.targets.elf.C66_big_endian');
70 C66BE.rootDir       = c66ToolsBaseDir;
71 C66BE.ccOpts.prefix = "-mo -o3 -q -k -eo.o -DBIGENDIAN";
72 if(extDbgFlags)     
73     C66BE.ccOpts.prefix = C66BE.ccOpts.prefix + " " + extDbgFlags;
75 /* C674 ELF compiler configuration for Little Endian Mode. */
76 var C674LE          = xdc.useModule('ti.targets.elf.C674');
77 C674LE.rootDir       = c674ToolsBaseDir;
78 C674LE.asmOpts.prefix = "--strip_coff_underscore";
79 C674LE.ccOpts.prefix  = "--strip_coff_underscore -mo -o3 -q -k -eo.o " + "-D" + cslPartNumber;
80 if(extDbgFlags)     
81     C674LE.ccOpts.prefix = C674LE.ccOpts.prefix + " " + extDbgFlags
83 /* ARMv7 A15 compiler configuration */
84 var A15LE            = xdc.useModule('gnu.targets.arm.A15F');
85 A15LE.rootDir        = a15ToolsBaseDir;
86 A15LE.ccOpts.prefix  = "-mno-unaligned-access -c -mtune=cortex-a15 -marm -DDRA7xx -gstrict-dwarf -Wall -D__ARMv7 -D_LITTLE_ENDIAN=1";
87 if(extDbgFlags_a15)     
88     A15LE.ccOpts.prefix = A15LE.ccOpts.prefix + " " + extDbgFlags_a15; 
89     
90 /* ARMv7 A9 compiler configuration */
91 var A9LE            = xdc.useModule('gnu.targets.arm.A9F');
92 A9LE.rootDir        = a9ToolsBaseDir;
93 A9LE.ccOpts.prefix  = "-mno-unaligned-access -c -mtune=cortex-a9 -marm -DDRA7xx -gstrict-dwarf -Wall -D__ARMv7 -D_LITTLE_ENDIAN=1";
94 if(extDbgFlags_a9)     
95     A9LE.ccOpts.prefix = A9LE.ccOpts.prefix + " " + extDbgFlags_a9; 
97 /* ARMv5 ARM9 compiler configuration */
98 var ARM9LE            = xdc.useModule('ti.targets.arm.elf.Arm9');
99 ARM9LE.rootDir        = arm9ToolsBaseDir;
100 ARM9LE.ccOpts.prefix  = "-mno-unaligned-access -c -marm -DDRA7xx -Dxdc_target_types__=gnu/targets/arm/std.h -Dxdc_target_name__=Arm9 -gstrict-dwarf -Wall -D__ARMv5 -D_LITTLE_ENDIAN=1";
101 if(extDbgFlags_arm9)     
102     ARM9LE.ccOpts.prefix = ARM9LE.ccOpts.prefix + " " + extDbgFlags_arm9; 
104 /* ARMv7 A8 compiler configuration */
105 var A8LE            = xdc.useModule('gnu.targets.arm.A8F');
106 A8LE.rootDir        = a8ToolsBaseDir;
107 A8LE.ccOpts.prefix  = "-mno-unaligned-access -c -mtune=cortex-a8 -marm -DDRA7xx -gstrict-dwarf -Wall -D__ARMv7 -D_LITTLE_ENDIAN=1";
108 if(extDbgFlags_a8)     
109     A8LE.ccOpts.prefix = A8LE.ccOpts.prefix + " " + extDbgFlags_a8; 
111 /* M4 ELF compiler configuration for Little Endian Mode. */
112 var M4LE            = xdc.useModule('ti.targets.arm.elf.M4');
113 M4LE.rootDir        = m4ToolsBaseDir;
114 M4LE.ccOpts.prefix  = "-o4 -qq -pdsw255 -DMAKEFILE_BUILD";
115 if(extDbgFlags_m4)
116     M4LE.ccOpts.prefix = M4LE.ccOpts.prefix + " " + extDbgFlags_m4; 
118 /* soc name (am?) is inserted between first an second element of this
119    list to construct device file name for each device */
120 var deviceConstruct = [ "soc/", "/I2C_soc.c" ];
122 /* Create the SoC List  */
123 var socs = { 
124     /* device independent libraries */
125     all :
126     {
127         /* Build this library */
128         build: "true",
129         /* SoC lib enabled */
130         socDevLib: "false",
131         /* Library options */
132         copts: "",
133         /* target lists, kept blank now, would be updated based on argument lists */
134         targets: []
135     },
136     am335x :
137     {
138         /* this variable would be reinitialized to true, if XDCARGS contains am335x */
139         build: "false",
140         /* SoC lib enabled */
141         socDevLib: "true",
142         /* Library options */
143         copts: " -DSOC_AM335x",
144         /* target list */
145         targets: [ A8LE ]
146     },
147     am437x :
148     {
149         /* this variable would be reinitialized to true, if XDCARGS contains am437x */
150         build: "false",       
151         /* SoC lib enabled */
152         socDevLib: "true",
153         /* Library options */
154         copts: " -DSOC_AM437x",
155         /* target list */
156         targets: [ A9LE ]
157    },
158    am572x :
159     {
160         /* this variable would be reinitialized to true, if XDCARGS contains am572x */
161         build: "false", 
162        /* SoC lib enabled */
163        socDevLib: "true",
164        /* Library options */
165        copts: " -DSOC_AM572x",
166        /* target list */
167        targets: [ C66LE, M4LE, A15LE]
168     },
169    am574x :
170     {
171        /* this variable would be reinitialized to true, if XDCARGS contains am574x */
172        build: "false",
173        /* SoC lib enabled */
174        socDevLib: "true",
175        /* Library options */
176        copts: " -DSOC_AM574x",
177        /* target list */
178        targets: [ C66LE, M4LE, A15LE]
179     },
180        dra75x :
181     {
182         /* this variable would be reinitialized to true, if XDCARGS contains dra75x */
183         build: "false", 
184        /* SoC lib enabled */
185        socDevLib: "true",
186        /* Library options */
187        copts: " -DSOC_DRA75x",
188        /* target list */
189        targets: [ C66LE, M4LE, A15LE]
190     },
191    am571x :
192     {
193         /* this variable would be reinitialized to true, if XDCARGS contains am571x */
194         build: "false",     
195        /* SoC lib enabled */
196        socDevLib: "true",
197        /* Library options */
198        copts: " -DSOC_AM571x",
199        /* target list */
200        targets: [ C66LE, M4LE, A15LE]
201     },
202    k2h :
203     {
204         /* this variable would be reinitialized to true, if XDCARGS contains k2h */
205         build: "false", 
206        /* SoC lib enabled */
207        socDevLib: "true",
208        /* Library options */
209        copts: " -DSOC_K2H",
210        /* target list */
211        targets: [ C66LE, C66BE, A15LE]
212     },
213    k2k :
214     {
215         /* this variable would be reinitialized to true, if XDCARGS contains k2k */
216         build: "false", 
217        /* SoC lib enabled */
218        socDevLib: "true",
219        /* Library options */
220        copts: " -DSOC_K2H",
221        /* target list */
222        targets: [ C66LE, C66BE, A15LE]
223     },
224    k2e :
225     {
226         /* this variable would be reinitialized to true, if XDCARGS contains k2e */
227         build: "false", 
228        /* SoC lib enabled */
229        socDevLib: "true",
230        /* Library options */
231        copts: " -DSOC_K2E",
232        /* target list */
233        targets: [ C66LE, C66BE, A15LE]
234     },
235    k2l :
236     {
237         /* this variable would be reinitialized to true, if XDCARGS contains k2l */
238         build: "false", 
239        /* SoC lib enabled */
240        socDevLib: "true",
241        /* Library options */
242        copts: " -DSOC_K2L",
243        /* target list */
244        targets: [ C66LE, C66BE, A15LE]
245     },
246    k2g :
247     {
248         /* this variable would be reinitialized to true, if XDCARGS contains k2g */
249         build: "false", 
250        /* SoC lib enabled */
251        socDevLib: "true",
252        /* Library options */
253        copts: " -DSOC_K2G",
254        /* target list */
255        targets: [ C66LE, C66BE, A15LE]
256     },
257    omapl137 :
258     {
259         /* this variable would be reinitialized to true, if XDCARGS contains omapl137 */
260         build: "false", 
261        /* SoC lib enabled */
262        socDevLib: "true",
263        /* Library options */
264        copts: " -DSOC_OMAPL137",
265        /* target list */
266        targets: [ C674LE, ARM9LE]
267     },
268    omapl138 :
269     {
270         /* this variable would be reinitialized to true, if XDCARGS contains omapl138 */
271         build: "false",
272        /* SoC lib enabled */
273        socDevLib: "true",
274        /* Library options */
275        copts: " -DSOC_OMAPL138",
276        /* target list */
277        targets: [ C674LE, ARM9LE]
278     },
279    c6678 :
280     {
281         /* this variable would be reinitialized to true, if XDCARGS contains c6678 */
282         build: "false",     
283        /* SoC lib enabled */
284        socDevLib: "true",
285        /* Library options */
286        copts: " -DSOC_C6678",
287        /* target list */
288        targets: [ C66LE, C66BE]
289     },    
290    c6657 :
291     {
292         /* this variable would be reinitialized to true, if XDCARGS contains c6657 */
293         build: "false",     
294        /* SoC lib enabled */
295        socDevLib: "true",
296        /* Library options */
297        copts: " -DSOC_C6657",
298        /* target list */
299        targets: [ C66LE, C66BE]
300     }  
301 };
303 /**************************************************************************
304  * FUNCTION NAME : merge
305  **************************************************************************
306  * DESCRIPTION   :
307  *  The function is used to merge two arrarys
308  **************************************************************************/
309 function merge() {
310     var args = arguments;
311     var hash = {};
312     var arr = [];
313     for (var i = 0; i < args.length; i++) {
314        for (var j = 0; j < args[i].length; j++) {
315          if (hash[args[i][j]] !== true) {
316            arr[arr.length] = args[i][j];
317            hash[args[i][j]] = true;
318          }
319        }
320      }
321     return arr;
324 /* Grab input from XDCARGS */
325 var buildArguments  = [];
327 /* Construct the build arguments */
328 for (var tmp=0; arguments[tmp] != undefined; tmp++)
331     /* If no arguments are provided, override for building all */
332     if ( ( arguments.length == 1) && (arguments[tmp].equals("./config.bld")) )
333         buildArguments[buildArguments.length++] = "all";
334     else
335         buildArguments[buildArguments.length++] = arguments[tmp];
338 /* Build targets on this build */
339 var build_targets = [];
340 var soc_names = Object.keys(socs);
342 for (var i=0; i < buildArguments.length; i++ ) {
343     /* Build it for all targets */
344     if (buildArguments[i] == "all") {
345         for (var j = 0; j < soc_names.length; j++)  {
346             build_targets = merge (build_targets.slice(0), socs[soc_names[j]].targets.slice(0));
347             /* Set build to "true" for that SoC */
348             socs[soc_names[j]].build = "true";
349         }
350     }
351     else {
352         /* Skip the first argument, which is ./config.bld to get to next SoCs */
353         if (i == 0) continue;          
354         /* Set that build to true if it is found in supported build socs */
355         for (j = 0; j < soc_names.length; j++) {
356             if (buildArguments[i] == soc_names[j]) {
357                 socs[buildArguments[i]].build = "true";
358                 build_targets = merge (build_targets.slice(0), socs[buildArguments[i]].targets.slice(0));
359                 break;
360             }
361         }
362     }   
365 /* Update the Build target generated list */
366 socs["all"].targets = build_targets; 
367 Build.targets   = build_targets;