/****************************************************************************** * FILE PURPOSE: Build configuration Script for the SRIO Driver ****************************************************************************** * FILE NAME: config.bld * * DESCRIPTION: * This file contains the build configuration script for the SRIO driver * and is responsible for configuration of the paths for the various * tools required to build the driver. * * Copyright (C) 2009-2012, Texas Instruments, Inc. *****************************************************************************/ /* Get the Tools Base directory from the Environment Variable. */ var toolsBaseDir = java.lang.System.getenv("C6X_GEN_INSTALL_PATH"); /* Get the extended debug flags */ var extDbgFlags = java.lang.System.getenv("EXTDBGFLAGS"); /* Get the base directory for the SRIO Socket Driver Package */ var srioDriverPath = new java.io.File(".//").getPath(); /* Read the part number from the environment variable. */ var srioLLDPartNumber = java.lang.System.getenv("PARTNO"); /* Include Path */ var srioIncludePath = " -i" + srioDriverPath + "/src" + " -i" + srioDriverPath + " -i" + srioDriverPath + "/test"; /* Configure the SRIO Socket Release Version Information */ /* 3 steps: remove SPACE and TAB, convert to string and split to make array */ var srioDriverReleaseVersion = (""+Pkg.version.replace(/\s/g, "")).split(','); /* C66 ELF compiler configuration for Little Endian Mode. */ var C66LE = xdc.useModule('ti.targets.elf.C66'); C66LE.rootDir = toolsBaseDir; C66LE.ccOpts.prefix = "-mo -o3 -q -k -eo.o"; if(extDbgFlags) C66LE.ccOpts.prefix = C66LE.ccOpts.prefix + " " + extDbgFlags; /* device name (k2?) is inserted between first an second element of this list to construct device file name for each device */ var deviceConstruct = [ "device/", "/src/device_srio_loopback.c" ]; /* Create the SoC List */ var socs = { /* device independent libraries */ all : { /* Build this library */ build: "true", /* SoC lib disabled as this is device independent lib */ socDevLib: "false", /* Library options */ copts: "", /* target lists, kept blank now, would be updated based on argument lists */ targets: [] }, k2h : { /* this variable would be reinitialized to true, if XDCARGS contains k2h */ build: "false", /* SoC lib enabled */ socDevLib: "true", /* Library options */ copts: " -DDEVICE_K2H -DSOC_K2H", /* target list */ targets: [ C66LE ] }, k2k : { /* this variable would be reinitialized to true, if XDCARGS contains k2k */ build: "false", /* SoC lib enabled */ socDevLib: "true", /* Library options */ copts: " -DDEVICE_K2K -DSOC_K2K", /* target list */ targets: [ C66LE ] }, c6678 : { /* this variable would be reinitialized to true, if XDCARGS contains c6678 */ build: "false", /* SoC lib enabled */ socDevLib: "true", /* Library options */ copts: " -DSOC_C6678", /* target list */ targets: [ C66LE ] }, c6657 : { /* this variable would be reinitialized to true, if XDCARGS contains c6657 */ build: "false", /* SoC lib enabled */ socDevLib: "true", /* Library options */ copts: " -DSOC_C6657", /* target list */ targets: [ C66LE ] }, }; /************************************************************************** * 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); 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 */ socs["all"].targets = build_targets; Build.targets = build_targets;