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 *
39 * The contents of this file usually don't change, but having it in your
40 * ownership allows you to tweak your compiler options. If you do change
41 * this file, however, on the next upgrade of the product we recommend
42 * that you take "fc.bld" file as supplied by the upgrade and then merge
43 * your changes with it.
44 */
46 /*
47 * ======== fc.bld ========
48 * This script is run prior to all build scripts. It sets host-system-
49 * independent values for targets and platforms, then it attempts to
50 * find the host-system-specific user.bld script that sets rootDirs.
51 *
52 * These settings may be a function of the following global variables:
53 *
54 * environment a hash table of environment strings
55 *
56 * arguments an array of string arguments to the script
57 * initialized as follows:
58 * arguments[0] - the file name of the script
59 * arguments[1] - the first argument specified in XDCARGS
60 * :
61 * arguments[n] - the n'th argument in XDCARGS
62 *
63 * Build an alias for xdc.om.xdc.bld.BuildEnvironment
64 */
66 var Build = xdc.useModule('xdc.bld.BuildEnvironment');
67 var Pkg = xdc.useModule('xdc.bld.PackageContents');
69 /* Common ccopts suffix used for all C6x targets */
70 var c6xOpts = " -mi10 -mo -pdr -pden -pds=238 -pds=880 -pds1110 -g ";
72 /*
73 * -mi10 => maximum cycles that interrupts may be disabled is 10
74 * -mo => place each function in subsection
75 * -pdr => show remarks
76 * -pden => show remark ids
77 * -pds=238 => ignore "controlling expression is constant"
78 * -pds=880 => ignore "unused parameter"
79 */
81 var ccOpts = {
82 "ti.targets.C64P" : c6xOpts,
83 "ti.targets.C674" : c6xOpts,
85 "ti.targets.elf.C64P" : c6xOpts,
86 "ti.targets.elf.C64T" : c6xOpts,
87 "ti.targets.elf.C66" : c6xOpts,
88 "ti.targets.elf.C66_big_endian" : c6xOpts,
90 "ti.targets.elf.C674" : c6xOpts,
91 "ti.targets.arm.elf.M3" : " --embed_inline_assembly -ms -pds=71",
92 "ti.targets.arm.elf.M4" : " -ms -g ",
94 "ti.targets.arp32.elf.ARP32" : " -g ",
95 "ti.targets.arp32.elf.ARP32_far" : " -g ",
96 };
98 var lnkOpts = {
99 };
101 var platform = "";
103 /* initialize local vars with those set in xdcpaths.mak (via XDCARGS) */
104 for (arg = 0; arg < arguments.length; arg++) {
105 /* split each arg into its '+' separated parts */
106 var configParts = arguments[arg].split(";");
107 // print("arg " + arg + " has " + configParts.length + " parts");
109 /* if "known args come in, filter them... else they're targets */
110 if (configParts[0].split("=")[0] == "PLATFORM") {
111 // print("FOUND PLATFORM ARG - " + configParts[0]);
112 platform = configParts[0].split("=")[1];
113 continue;
114 }
116 /*
117 * Get the compiler's installation directory.
118 * For "ti.targets.elf.C674=/vendors/c6x/7.2.0", we get "/vendors/c6x/7.2.0"
119 */
120 var targetName = configParts[0].split("=")[0];
121 var rootDir = configParts[0].split("=")[1];
123 /* only build for the specified compilers */
124 if (rootDir == "" || rootDir == undefined) {
125 continue;
126 }
128 // print("Building '" + targetName + "' using '" + rootDir + "' ...");
130 var target = xdc.useModule(targetName);
131 target.rootDir = rootDir;
133 if (ccOpts[targetName] != undefined) {
134 target.ccOpts.suffix += ccOpts[targetName];
135 }
136 if (lnkOpts[targetName] != undefined) {
137 target.lnkOpts.suffix += lnkOpts[targetName];
138 }
140 /* for all the other parts, assign target.<left> = <right> */
141 for (var i = 1; i < configParts.length; i++) {
142 var modCfgParam = configParts[i].split("=")[0];
143 var modCfgValue = configParts[i].substring(configParts[i].indexOf("=") + 1);
144 var modCfgIndex = modCfgParam.split(".");
145 var element = target;
147 // print("Configuring target." + modCfgParam + " = " + modCfgValue);
149 for (j = 0; j < (modCfgIndex.length -1); j++) {
150 element = element[modCfgIndex[j]];
151 }
152 element[modCfgIndex[j]] = modCfgValue;
153 }
155 /* and finally add this target to the Build.targets array */
156 Build.targets.$add(target);
157 }
159 /* lib/ is a generated directory that 'xdc clean' should remove */
160 Pkg.generatedFiles.$add("lib/");
162 /*
163 * Some packages build for 'all profiles' - but that's too much to ship.
164 * Loop over all profiles in all Build.targets and remove everything
165 * except 'release' and 'debug'.
166 */
167 for (var t = 0; t < Build.targets.length; t++) {
168 for (prof in Build.targets[t].profiles) {
169 if ((prof != 'release') && (prof != 'debug') && (prof != 'smp')) {
170 delete Build.targets[t].profiles[prof];
171 }
172 }
173 }
176 /* add notrace profile to all targets */
177 var notrace_defs = " -Dxdc_runtime_Log_DISABLE_ALL " +
178 "-Dxdc_runtime_Assert_DISABLE_ALL ";
180 /* All libraries add a new notrace profile */
181 for (var t = 0; t < Build.targets.length; t++) {
182 var targ = Build.targets[t];
183 if (Pkg.name.match(/ecpy|acpy3/)) {
184 /* High performance libraries disable trace in their release profile */
185 var defs = targ.profiles["release"].compileOpts.defs;
186 targ.profiles["release"].compileOpts.defs =
187 (defs == undefined ? notrace_defs : defs + notrace_defs);
188 }
189 else {
190 targ.profiles["notrace"] = targ.profiles["release"].$copy();
191 var defs = targ.profiles["notrace"].compileOpts.defs;
192 targ.profiles["notrace"].compileOpts.defs =
193 (defs == undefined ? notrace_defs : defs + notrace_defs);
194 }
195 }
198 /* -----------------------------------------------------------------------*/
199 /* make release files '.tar.gz' files (.tar is default) */
200 Pkg.attrs.compress = true;