1 /*
2 * Copyright (c) 2011-2018 Texas Instruments Incorporated - http://www.ti.com
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 "ipc.bld" file as supplied by the upgrade and then merge
43 * your changes with it.
44 */
46 /*
47 * ======== ipc-bios.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 --mem_model:const=data --mem_model:data=far ";
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 * --mem_model:const=data => Const objects are placed according to the
80 * --mem_model:data option
81 * --mem_model:data=far => Data accesses default to far
82 */
84 var ccOpts = {
85 "ti.targets.C64P" : c6xOpts,
86 "ti.targets.C674" : c6xOpts,
88 "ti.targets.elf.C64P" : c6xOpts,
89 "ti.targets.elf.C64T" : c6xOpts,
90 "ti.targets.elf.C66" : c6xOpts,
91 "ti.targets.elf.C674" : c6xOpts,
93 "ti.targets.arm.elf.Arm9" : " -ms -g ",
94 "ti.targets.arm.elf.A8F" : " -ms -g ",
95 "ti.targets.arm.elf.A8Fnv" : " -ms -g ",
96 "ti.targets.arm.elf.M3" : " --embed_inline_assembly -ms -pds=71",
97 "ti.targets.arm.elf.M4" : " -ms -g ",
98 "ti.targets.arm.elf.M4F" : " -ms -g ",
99 "ti.targets.arm.elf.R5F" : " -ms -g ",
101 "ti.targets.arp32.elf.ARP32" : " -g ",
102 "ti.targets.arp32.elf.ARP32_far" : " -g ",
104 "gnu.targets.arm.A8F" : " -g ",
105 "gnu.targets.arm.A15F" : " -g ",
106 "gnu.targets.arm.A53F" : " -g "
107 };
109 var lnkOpts = {
110 "ti.targets.elf.C66" : " --cinit_compression=off",
111 "ti.targets.arm.elf.M4" : " --retain=.resource_table" +
112 " --cinit_compression=off",
113 "ti.targets.arm.elf.R5F" : " --retain=.resource_table" +
114 " --cinit_compression=off"
115 };
117 var platform = "";
118 var smpEnabled = true;
119 var Bld_goal = "";
121 /* initialize local vars with those set in xdcpaths.mak (via XDCARGS) */
122 for (arg = 0; arg < arguments.length; arg++) {
123 /* split each arg into its '+' separated parts */
124 var configParts = arguments[arg].split(";");
125 // print("arg " + arg + " has " + configParts.length + " parts");
127 /* if "known args come in, filter them... else they're targets */
128 if (configParts[0].split("=")[0] == "PLATFORM") {
129 // print("FOUND PLATFORM ARG - " + configParts[0]);
130 platform = configParts[0].split("=")[1];
131 continue;
132 }
133 else if (configParts[0].split("=")[0] == "BIOS_SMPENABLED") {
134 // print("FOUND SMP_ENABLED ARG - " + configParts[0]);
135 smpEnabled = configParts[0].split("=")[1].match(/^1$/);
136 continue;
137 }
138 else if (configParts[0].split("=")[0] == "GOAL") {
139 Bld_goal = configParts[0].split("=")[1];
140 continue;
141 }
143 if (platform == "") {
144 platform = "NONE";
145 }
147 /*
148 * Get the compiler's installation directory.
149 * For "ti.targets.elf.C674=/vendors/c6x/7.2.0", we get "/vendors/c6x/7.2.0"
150 */
151 var targetName = configParts[0].split("=")[0];
152 var rootDir = configParts[0].split("=")[1];
154 /* only build for the specified compilers */
155 if (rootDir == "" || rootDir == undefined) {
156 continue;
157 }
159 // print("Building for platform:" + platform + " targetName:" + targetName
160 // + " rootDir: " + rootDir + " smpEnabled:" + smpEnabled + "...");
162 var target = xdc.useModule(targetName);
163 target.rootDir = rootDir;
164 if (ccOpts[targetName] != undefined) {
165 target.ccOpts.suffix += ccOpts[targetName];
166 }
167 if (lnkOpts[targetName] != undefined) {
168 target.lnkOpts.suffix += lnkOpts[targetName];
169 }
171 /* for all the other parts, assign target.<left> = <right> */
172 for (var i = 1; i < configParts.length; i++) {
173 var modCfgParam = configParts[i].split("=")[0];
174 var modCfgValue = configParts[i].split("=")[1];
175 var modCfgIndex = modCfgParam.split(".");
176 var element = target;
178 // print("Configuring target." + modCfgParam + " = " + modCfgValue);
180 for (j = 0; j < (modCfgIndex.length -1); j++) {
181 element = element[modCfgIndex[j]];
182 }
183 element[modCfgIndex[j]] = modCfgValue;
184 }
186 /* Add appropriate platforms to build for based on target name */
187 if (targetName.match(/elf\.C674/)) {
188 if (platform == 'OMAPL138') {
189 target.platforms.$add("ti.platforms.evmOMAPL138:DSP");
190 }
191 }
193 if (targetName.match(/elf\.C66$/)) {
194 switch (platform) {
195 case '66AK2G':
196 target.platforms.$add("ti.platforms.evmTCI66AK2G02:core0");
197 break;
199 case '66AK2E':
200 target.platforms.$add("ti.platforms.evmC66AK2E:core0");
201 break;
203 case 'TCI6630':
204 target.platforms.$add("ti.platforms.evmTCI6630K2L:core0");
205 break;
207 case 'TCI6636':
208 target.platforms.$add("ti.platforms.evmTCI6636K2H:core0");
209 break;
211 case 'TCI6638':
212 target.platforms.$add("ti.platforms.evmTCI6638K2K:core0");
213 break;
215 case 'C6678':
216 target.platforms.$add("ti.platforms.evm6678");
217 break;
219 case 'DRA7XX':
220 target.platforms.$add("ti.platforms.evmDRA7XX:dsp1");
221 target.platforms.$add("ti.platforms.evmDRA7XX:dsp2");
222 break;
224 case 'TDA3XX':
225 target.platforms.$add("ti.platforms.evmTDA3XX");
226 break;
228 case 'NONE':
229 /* okay, no platform specified */
230 break;
232 default:
233 print("Unknown C66x platform, skipping " + platform);
234 break;
235 }
236 }
238 if (targetName.match(/elf\.C64T/)) {
239 if (platform == 'OMAP54XX') {
240 target.platforms.$add("ti.platforms.sdp5430:DSP");
241 }
242 }
244 if (targetName.match(/elf\.M4$/)) {
245 switch (platform) {
246 case 'OMAP54XX':
247 target.platforms.$add("ti.platforms.sdp5430:IPU");
248 break;
250 case 'DRA7XX':
251 target.platforms.$add("ti.platforms.evmDRA7XX:ipu2");
252 target.platforms.$add("ti.platforms.evmDRA7XX:ipu1");
253 break;
255 case 'TDA3XX':
256 target.platforms.$add("ti.platforms.evmTDA3XX");
257 break;
259 case 'NONE':
260 /* okay, no platform specified */
261 break;
263 default:
264 print("Unknown M4 platform, skipping " + platform);
265 break;
266 }
267 }
269 if (targetName.match(/elf\.R5F$/)) {
270 switch (platform) {
271 case 'AM65XX':
272 target.platforms.$add("ti.platforms.cortexR:AM65X:false:R5F0");
273 target.platforms.$add("ti.platforms.cortexR:AM65X:false:R5F1");
274 break;
276 default:
277 print("Unknown R5F platform, skipping " + platform);
278 break;
279 }
280 }
282 Build.targets.$add(target);
283 }
285 if (smpEnabled) {
286 /* Enable building SMP-BIOS enabled libraries for targets that support it */
287 if (Pkg.name.match(/^ti\.sdo\.(ipc|utils)/)) {
288 xdc.module("ti.targets.arm.elf.M3").profiles["smp"] =
289 xdc.module("ti.targets.arm.elf.M3").profiles["debug"];
290 xdc.module("ti.targets.arm.elf.M4").profiles["smp"] =
291 xdc.module("ti.targets.arm.elf.M4").profiles["debug"];
292 xdc.module("gnu.targets.arm.A15F").profiles["smp"] =
293 xdc.module("gnu.targets.arm.A15F").profiles["debug"];
294 xdc.module("gnu.targets.arm.A53F").profiles["smp"] =
295 xdc.module("gnu.targets.arm.A53F").profiles["debug"];
296 }
297 }
299 /* lib/ is a generated directory that 'xdc clean' should remove */
300 Pkg.generatedFiles.$add("lib/");
302 /*
303 * Some packages build for 'all profiles' - but that's too much to ship.
304 * Loop over all profiles in all Build.targets and remove everything
305 * except 'release' and 'debug'.
306 */
307 for (var t = 0; t < Build.targets.length; t++) {
308 for (prof in Build.targets[t].profiles) {
309 if ((prof != 'release') && (prof != 'debug') && (prof != 'smp')) {
310 delete Build.targets[t].profiles[prof];
311 }
312 }
313 }
315 /* -----------------------------------------------------------------------*/
316 /* make release files '.tar.gz' files (.tar is default) */
317 Pkg.attrs.compress = true;
319 /* catch inadvertant use of unsupported data types */
320 Pkg.attrs.defs = "-Dxdc__strict";