summaryrefslogtreecommitdiffstats
blob: e4612a92f8dbad0f51ee2e34e0f602b50f6cab51 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
/******************************************************************************
 * FILE PURPOSE: Build configuration Script for the osal Driver
 ******************************************************************************
 * FILE NAME: config.bld
 *
 * DESCRIPTION: 
 *  This file contains the build configuration script for the osal driver
 *  and is responsible for configuration of the paths for the various 
 *  tools required to build the driver.
 *
 * Copyright (C) 2014-2019, Texas Instruments, Inc.
 *****************************************************************************/

/* Get the Tools Base directory from the Environment Variable. */
var c66ToolsBaseDir = java.lang.System.getenv("C6X_GEN_INSTALL_PATH");
var c674ToolsBaseDir = java.lang.System.getenv("C6X_GEN_INSTALL_PATH");
var m4ToolsBaseDir = java.lang.System.getenv("TOOLCHAIN_PATH_M4");
var a15ToolsBaseDir = java.lang.System.getenv("TOOLCHAIN_PATH_A15");
var a9ToolsBaseDir = java.lang.System.getenv("TOOLCHAIN_PATH_A9");
var arm9ToolsBaseDir = java.lang.System.getenv("TOOLCHAIN_PATH_ARM9");
var a8ToolsBaseDir = java.lang.System.getenv("TOOLCHAIN_PATH_A8");

/* Get the extended debug flags for C66x, 
 * did not change the name for backwards compatibilty */
var extDbgFlags = java.lang.System.getenv("EXTDBGFLAGS");

/* Get the extended debug flags for A15 */
var extDbgFlags_a15 = java.lang.System.getenv("EXTDBGFLAGS_A15");

/* Get the extended debug flags for A8 */
var extDbgFlags_a8 = java.lang.System.getenv("EXTDBGFLAGS_A8");

/* Get the extended debug flags for A9 */
var extDbgFlags_a9 = java.lang.System.getenv("EXTDBGFLAGS_A9");

/* Get the extended debug flags for M4 */
var extDbgFlags_m4 = java.lang.System.getenv("EXTDBGFLAGS_M4");

/* Get the base directory for the osal Socket Driver Package */
var osalDriverPath = new java.io.File(".//").getPath();

/* Include Path */
var osalIncludePath = " -I" + osalDriverPath + "/src" + " -I" + osalDriverPath  + " -I" + osalDriverPath + "/test";

/* Configure the osal Socket Release Version Information */
/* 3 steps: remove SPACE and TAB, convert to string and split to make array */
var osalDriverReleaseVersion = (""+Pkg.version.replace(/\s/g, "")).split(',');

/* Print the Compiler Options */
var pOpts = 1;

/* C66 ELF compiler configuration for Little Endian Mode. */
var C66LE           = xdc.useModule('ti.targets.elf.C66');
C66LE.rootDir       = c66ToolsBaseDir;
C66LE.ccOpts.prefix = "-mo -o3 -q -k -eo.o";
if(extDbgFlags)     
    C66LE.ccOpts.prefix = C66LE.ccOpts.prefix + " " + extDbgFlags; 

/* C674 ELF compiler configuration for Little Endian Mode. */
var C674LE          = xdc.useModule('ti.targets.elf.C674');
C674LE.rootDir       = c674ToolsBaseDir;
C674LE.ccOpts.prefix = "-mo -o3 -q -k -eo.o";
if(extDbgFlags)
    C674LE.ccOpts.prefix = C674LE.ccOpts.prefix + " " + extDbgFlags;

/* C66 ELF compiler configuration for Big Endian Mode. */
var C66BE         = xdc.useModule('ti.targets.elf.C66_big_endian');
C66BE.rootDir       = c66ToolsBaseDir;
C66BE.ccOpts.prefix = "-mo -o3 -q -k -eo.o -DBIGENDIAN";
if(extDbgFlags)     
    C66BE.ccOpts.prefix = C66BE.ccOpts.prefix + " " + extDbgFlags;

/* ARMv7 A15 compiler configuration */
var A15LE            = xdc.useModule('gnu.targets.arm.A15F');
A15LE.rootDir        = a15ToolsBaseDir;
A15LE.ccOpts.prefix  = "-mno-unaligned-access -c -mtune=cortex-a15 -marm -DDRA7xx -Dxdc_target_types__=gnu/targets/arm/std.h -Dxdc_target_name__=A15F -gstrict-dwarf -Wall -D__ARMv7 -D_LITTLE_ENDIAN=1";
if(extDbgFlags_a15)     
    A15LE.ccOpts.prefix = A15LE.ccOpts.prefix + " " + extDbgFlags_a15; 

/* ARMv7 A9 compiler configuration */
var A9LE            = xdc.useModule('gnu.targets.arm.A9F');
A9LE.rootDir        = a9ToolsBaseDir;
A9LE.ccOpts.prefix  = "-mno-unaligned-access -c -mtune=cortex-a9 -marm -DDRA7xx -Dxdc_target_types__=gnu/targets/arm/std.h -Dxdc_target_name__=A9F -gstrict-dwarf -Wall -D__ARMv7 -D_LITTLE_ENDIAN=1";
if(extDbgFlags_a9)     
    A9LE.ccOpts.prefix = A9LE.ccOpts.prefix + " " + extDbgFlags_a9; 

/* ARMv7 A8 compiler configuration */
var A8LE            = xdc.useModule('gnu.targets.arm.A8F');
A8LE.rootDir        = a8ToolsBaseDir;
A8LE.ccOpts.prefix  = "-mno-unaligned-access -c -mtune=cortex-a8 -marm -DDRA7xx -Dxdc_target_types__=gnu/targets/arm/std.h -Dxdc_target_name__=A8F -gstrict-dwarf -Wall -D__ARMv7 -D_LITTLE_ENDIAN=1";
if(extDbgFlags_a8)     
    A8LE.ccOpts.prefix = A8LE.ccOpts.prefix + " " + extDbgFlags_a8; 

/* M4 ELF compiler configuration for Little Endian Mode. */
var M4LE            = xdc.useModule('ti.targets.arm.elf.M4');
M4LE.rootDir        = m4ToolsBaseDir;
M4LE.ccOpts.prefix  = "-o4 -qq -pdsw255 -DMAKEFILE_BUILD";
if(extDbgFlags_m4)
    M4LE.ccOpts.prefix = M4LE.ccOpts.prefix + " " + extDbgFlags_m4; 

/* Create the Operating System Support List  */
var osTypes = { 
    /* TI RTOS */
    tirtos :
    {
        /* Library options */
        copts: "-DTIRTOS",
        /* Souce File List */
        srcFile: [
		  "src/tirtos/SemaphoreP_tirtos.c",
                  "src/tirtos/HwiP_tirtos.c",
                  "src/tirtos/SwiP_tirtos.c",
                  "src/tirtos/CacheP_tirtos.c",
                  "src/tirtos/Utils_tirtos.c"
		 ],        
    },
    /* Bare metal */
    nonos :
    {
        /* Library options */
        copts: "-DNONOS",
        /* Souce File List */
        srcFile: [
              	  "src/nonos/HwiP_nonos.c",
              	  "src/nonos/SwiP_nonos.c",
                  "src/nonos/Utils_nonos.c",
                  "src/nonos/SemaphoreP_nonos.c",
                  "src/nonos/CacheP_nonos.c"
                 ],        
    }
};

var keyStoneFamilySrcFiles = {
    /* TI RTOS */
    tirtos :
    {
        /* Souce File List */
        srcFile: [
		            "src/v0/MuxIntcP_tirtos.c",
                 ]
    },
    /* Bare metal */
    nonos :
    {
        /* Souce File List */
        srcFile: [
		          "src/v0/MuxIntcP_nonos.c"
                 ]       
    }
};

var amFamilySrcFiles = {
    /* TI RTOS */
    tirtos :
    {
        /* Souce File List */
        srcFile: [
		            "src/v1/MuxIntcP_tirtos.c"
                 ]      
    },
    /* Bare metal */
    nonos :
    {
        /* Souce File List */
        srcFile: [
                  "src/v1/MuxIntcP_nonos.c",
                 ]
    }
};

/* Create the SoC List  */
var socs = { 
    am335x :
    {
        /* this variable would be reinitialized to true, if XDCARGS contains am335x */
        build: "false",
		/* Device Family Type */
		familyType: "am",
        /* SoC specific defines go here */
        copts: "-DSOC_AM335x",        
        /* target list */
        targets: [ A8LE ]
    },
    am437x :
    {
        /* this variable would be reinitialized to true, if XDCARGS contains am437x */
        build: "false", 
		/* Device Family Type */
		familyType: "am",			
        /* SoC specific defines go here */
        copts: "-DSOC_AM437x",           
        /* target list */
        targets: [ A9LE ]
   },
   am572x :
    {
        /* this variable would be reinitialized to true, if XDCARGS contains am572x */
        build: "false", 
		/* Device Family Type */
		familyType: "am",		
        /* SoC specific defines go here */
        copts: "-DSOC_AM572x",           
       /* target list */
       targets: [ C66LE, A15LE, M4LE]
    },
   am574x :
    {
        /* this variable would be reinitialized to true, if XDCARGS contains am574x */
        build: "false", 
		/* Device Family Type */
		familyType: "am",		
        /* SoC specific defines go here */
        copts: "-DSOC_AM574x",           
       /* target list */
       targets: [ C66LE, A15LE, M4LE]
    },
   am571x :
    {
        /* this variable would be reinitialized to true, if XDCARGS contains am571x */
        build: "false",  
		/* Device Family Type */
		familyType: "am",	
        /* SoC specific defines go here */
        copts: "-DSOC_AM571x",           
       /* target list */
       targets: [ C66LE, A15LE, M4LE]
    },    
   k2h :
    {
        /* this variable would be reinitialized to true, if XDCARGS contains k2h */
        build: "false", 
		/* Device Family Type */
		familyType: "keystone",		
        /* SoC specific defines go here */
        copts: "-DSOC_K2H",           
       /* target list */
       targets: [ C66LE, C66BE, A15LE]
    },    
   k2k :
    {
        /* this variable would be reinitialized to true, if XDCARGS contains k2k */
        build: "false",  
		/* Device Family Type */
		familyType: "keystone",			
        /* SoC specific defines go here */
        copts: "-DSOC_K2H",           
       /* target list */
       targets: [ C66LE, C66BE, A15LE]
    },    
   k2e :
    {
        /* this variable would be reinitialized to true, if XDCARGS contains k2e */
        build: "false",     
		/* Device Family Type */
		familyType: "keystone",			
        /* SoC specific defines go here */
        copts: "-DSOC_K2E",           
       /* target list */
       targets: [ C66LE, C66BE, A15LE]
    },    
   k2l :
    {
        /* this variable would be reinitialized to true, if XDCARGS contains k2l */
        build: "false",     
		/* Device Family Type */
		familyType: "keystone",			
        /* SoC specific defines go here */
        copts: "-DSOC_K2L",           
       /* target list */
       targets: [ C66LE, C66BE, A15LE]
    },    
   k2g :
    {
        /* this variable would be reinitialized to true, if XDCARGS contains k2g */
        build: "false",     
		/* Device Family Type */
		familyType: "keystone",			
        /* SoC specific defines go here */
        copts: "-DSOC_K2G",           
       /* target list */
       targets: [ C66LE, C66BE, A15LE]
    },
	omapl137 :
    {
        /* this variable would be reinitialized to true, if XDCARGS contains omapl137 */
        build: "false",
		/* Device Family Type */
		familyType: "omap",
        /* SoC specific defines go here */
        copts: "-DSOC_OMAPL137",
       /* target list */
       targets: [ C674LE, A9LE]
    },
    omapl138 :
    {
        /* this variable would be reinitialized to true, if XDCARGS contains omapl138 */
        build: "false",
        /* Device Family Type */
        familyType: "omap",
        /* SoC specific defines go here */
        copts: "-DSOC_OMAPL138",
        /* target list */
        targets: [ C674LE, A9LE]
    },
   c6678 :
    {
        /* this variable would be reinitialized to true, if XDCARGS contains k2l */
        build: "false",     
		/* Device Family Type */
		familyType: "keystone",			
        /* SoC specific defines go here */
        copts: "-DSOC_C6678",           
       /* target list */
       targets: [ C66LE, C66BE]
    },    
   c6657 :
    {
        /* this variable would be reinitialized to true, if XDCARGS contains k2l */
        build: "false",     
		/* Device Family Type */
		familyType: "keystone",			
        /* SoC specific defines go here */
        copts: "-DSOC_C6657",           
       /* target list */
       targets: [ C66LE, C66BE]
    },
	c6747 :
	{
		/* Build this library */
        build: "false",
		/* Device Family Type */
		familyType: "omap",
		/* SoC specific defines go here */
        copts: "-DSOC_C6747",
        /* target list */
        targets: [ C674LE]
	}
};
    
/**************************************************************************
 * FUNCTION NAME : merge
 **************************************************************************
 * DESCRIPTION   :
 *  The function is used to merge two arrarys
 **************************************************************************/
function merge() {
    var args = arguments;
    var hash = {};
    var arr = [];
    for (var i = 0; i < args.length; i++) {
       for (var j = 0; j < args[i].length; j++) {
         if (hash[args[i][j]] !== true) {
           arr[arr.length] = args[i][j];
           hash[args[i][j]] = true;
         }
       }
     }
    return arr;
}

/* Grab input from XDCARGS */
var buildArguments  = [];

/* Construct the build arguments */
for (var tmp=0; arguments[tmp] != undefined; tmp++)
{

    /* If no arguments are provided, override for building all */
    if ( ( arguments.length == 1) && (arguments[tmp].equals("./config.bld")) )
        buildArguments[buildArguments.length++] = "all";
    else
        buildArguments[buildArguments.length++] = arguments[tmp];
}

/* Build targets on this build */
var build_targets = [];
var soc_names = Object.keys(socs);
var os_names  = Object.keys(osTypes);

for (var i=0; i < buildArguments.length; i++ ) {
    /* Build it for all targets */
    if (buildArguments[i] == "all") {
        for (var j = 0; j < soc_names.length; j++)  {
            build_targets = merge (build_targets.slice(0), socs[soc_names[j]].targets.slice(0));
            /* Set build to "true" for that SoC */
            socs[soc_names[j]].build = "true";
        }
    }
    else {
        /* Skip the first argument, which is ./config.bld to get to next SoCs */
        if (i == 0) continue;          
        /* Set that build to true if it is found in supported build socs */
        for (j = 0; j < soc_names.length; j++) {
            if (buildArguments[i] == soc_names[j]) {
                socs[buildArguments[i]].build = "true";
                build_targets = merge (build_targets.slice(0), socs[buildArguments[i]].targets.slice(0));
                break;
            }
        }
    }   
}

/* Update the Build target generated list */
Build.targets   = build_targets;