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