]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - mfp/cedev.git/blob - ce-bios.bld
dab234cdbf9a2f47f3927a4ea3edbae0d0c41673
[mfp/cedev.git] / ce-bios.bld
1 /*
2  * Copyright (c) 2011-2013, Texas Instruments Incorporated
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions
7  * are met:
8  *
9  * *  Redistributions of source code must retain the above copyright
10  *    notice, this list of conditions and the following disclaimer.
11  *
12  * *  Redistributions in binary form must reproduce the above copyright
13  *    notice, this list of conditions and the following disclaimer in the
14  *    documentation and/or other materials provided with the distribution.
15  *
16  * *  Neither the name of Texas Instruments Incorporated nor the names of
17  *    its contributors may be used to endorse or promote products derived
18  *    from this software without specific prior written permission.
19  *
20  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
22  * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23  * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
27  * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
28  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
29  * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
30  * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31  */
33 /*
34  * Generally there is no need to edit this file!
35  *
36  * This file controls which libraries are built, as well as compiler options
37  * to use.
38  */
40 /*
41  *  ======== ce.bld ========
42  *  This script is run prior to all build scripts. It sets host-system-
43  *  independent values for targets and platforms, then it attempts to
44  *  find the host-system-specific user.bld script that sets rootDirs.
45  *
46  *  These settings may be a function of the following global variables:
47  *
48  *      environment a hash table of environment strings
49  *
50  *      arguments   an array of string arguments to the script
51  *                  initialized as follows:
52  *                      arguments[0] - the file name of the script
53  *                      arguments[1] - the first argument specified in XDCARGS
54  *                          :
55  *                      arguments[n] - the n'th argument in XDCARGS
56  *
57  *      Build       an alias for xdc.om.xdc.bld.BuildEnvironment
58  */
60 var Build = xdc.useModule('xdc.bld.BuildEnvironment');
61 var Pkg = xdc.useModule('xdc.bld.PackageContents');
63 /* Common ccopts suffix used for all C6x targets */
64 var c6xOpts = " -mi10 -mo -pdr -pden -pds=238 -pds=880 -pds1110 -g ";
66 /*
67  * -mi10 => maximum cycles that interrupts may be disabled is 10
68  * -mo => place each function in subsection
69  * -pdr => show remarks
70  * -pden => show remark ids
71  * -pds=238 => ignore "controlling expression is constant"
72  * -pds=880 => ignore "unused parameter"
73  */
75 var ccOpts = {
76     "ti.targets.C64P"                 : c6xOpts,
77     "ti.targets.C674"                 : c6xOpts,
79     "ti.targets.elf.C64P"             : c6xOpts,
80     "ti.targets.elf.C64T"             : c6xOpts,
81     "ti.targets.elf.C66"              : c6xOpts,
82 //    "ti.targets.elf.C66_big_endian"   : c6xOpts,
83     "ti.targets.elf.C674"             : c6xOpts,
84     "ti.targets.arm.elf.M3"           : " -ms -g ",
85     "ti.targets.arm.elf.M4"           : " -ms -g ",
86 };
88 var lnkOpts = {
89 };
91 var platform = "";
93 /* initialize local vars with those set in products.mak (via XDCARGS) */
94 for (arg = 0; arg < arguments.length; arg++) {
95     /* split each arg into its '+' separated parts */
96     var configParts = arguments[arg].split(";");
97     // print("arg " + arg + " has " + configParts.length + " parts");
99     /* if "known args come in, filter them... else they're targets */
100     if (configParts[0].split("=")[0] == "PLATFORM") {
101         // print("FOUND PLATFORM ARG - " + configParts[0]);
102         platform = configParts[0].split("=")[1];
103         continue;
104     }
106     /*
107      * Get the compiler's installation directory.
108      * For "ti.targets.elf.C674=/vendors/c6x/7.2.0", we get "/vendors/c6x/7.2.0"
109      */
110     var targetName = configParts[0].split("=")[0];
111     var rootDir = configParts[0].split("=")[1];
113     /* only build for the specified compilers */
114     if (rootDir == "" || rootDir == undefined) {
115         continue;
116     }
118 //    print("Building '" + targetName + "' using '" + rootDir + "' ...");
120     var target = xdc.useModule(targetName);
121     target.rootDir = rootDir;
123     if (ccOpts[targetName] != undefined) {
124         target.ccOpts.suffix += ccOpts[targetName];
125     }
126     if (lnkOpts[targetName] != undefined) {
127         target.lnkOpts.suffix += lnkOpts[targetName];
128     }
130     /* for all the other parts, assign target.<left> = <right> */
131     for (var i = 1; i < configParts.length; i++) {
132         var modCfgParam = configParts[i].split("=")[0];
133         var modCfgValue = configParts[i].substring(configParts[i].indexOf("=") + 1);
134         var modCfgIndex = modCfgParam.split(".");
135         var element = target;
137 //        print("Configuring target." + modCfgParam + " = " + modCfgValue);
139         for (j = 0; j < (modCfgIndex.length -1); j++) {
140                 element = element[modCfgIndex[j]];
141         }
142         element[modCfgIndex[j]] = modCfgValue;
143     }
145     /* and finally add this target to the Build.targets array */
146     Build.targets.$add(target);
149 /* lib/ is a generated directory that 'xdc clean' should remove */
150 Pkg.generatedFiles.$add("lib/");
152 /* only build debug and release profiles */
153 for (var t = 0; t < Build.targets.length; t++) {
154     for (prof in Build.targets[t].profiles) {
155         if ((prof != 'release') && (prof != 'debug')) {
156             delete Build.targets[t].profiles[prof];
157         }
158     }
162 /* -----------------------------------------------------------------------*/
163 /* make release files '.tar.gz' files (.tar is default) */
164 Pkg.attrs.compress = true;