| /* |
| * Copyright (c) 2011-2018 Texas Instruments Incorporated - http://www.ti.com |
| * All rights reserved. |
| * |
| * Redistribution and use in source and binary forms, with or without |
| * modification, are permitted provided that the following conditions |
| * are met: |
| * |
| * * Redistributions of source code must retain the above copyright |
| * notice, this list of conditions and the following disclaimer. |
| * |
| * * Redistributions in binary form must reproduce the above copyright |
| * notice, this list of conditions and the following disclaimer in the |
| * documentation and/or other materials provided with the distribution. |
| * |
| * * Neither the name of Texas Instruments Incorporated nor the names of |
| * its contributors may be used to endorse or promote products derived |
| * from this software without specific prior written permission. |
| * |
| * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
| * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, |
| * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
| * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR |
| * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
| * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
| * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; |
| * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, |
| * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR |
| * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, |
| * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| */ |
| |
| /* |
| * Generally there is no need to edit this file! |
| * |
| * This file controls which libraries are built, as well as compiler options |
| * to use. |
| * |
| * The contents of this file usually don't change, but having it in your |
| * ownership allows you to tweak your compiler options. If you do change |
| * this file, however, on the next upgrade of the product we recommend |
| * that you take "ipc.bld" file as supplied by the upgrade and then merge |
| * your changes with it. |
| */ |
| |
| /* |
| * ======== ipc-bios.bld ======== |
| * This script is run prior to all build scripts. It sets host-system- |
| * independent values for targets and platforms, then it attempts to |
| * find the host-system-specific user.bld script that sets rootDirs. |
| * |
| * These settings may be a function of the following global variables: |
| * |
| * environment a hash table of environment strings |
| * |
| * arguments an array of string arguments to the script |
| * initialized as follows: |
| * arguments[0] - the file name of the script |
| * arguments[1] - the first argument specified in XDCARGS |
| * : |
| * arguments[n] - the n'th argument in XDCARGS |
| * |
| * Build an alias for xdc.om.xdc.bld.BuildEnvironment |
| */ |
| |
| var Build = xdc.useModule('xdc.bld.BuildEnvironment'); |
| var Pkg = xdc.useModule('xdc.bld.PackageContents'); |
| |
| /* Common ccopts suffix used for all C6x targets */ |
| var c6xOpts = " -mi10 -mo -pdr -pden -pds=238 -pds=880 -pds1110 -g --mem_model:const=data --mem_model:data=far "; |
| |
| /* |
| * -mi10 => maximum cycles that interrupts may be disabled is 10 |
| * -mo => place each function in subsection |
| * -pdr => show remarks |
| * -pden => show remark ids |
| * -pds=238 => ignore "controlling expression is constant" |
| * -pds=880 => ignore "unused parameter" |
| * --mem_model:const=data => Const objects are placed according to the |
| * --mem_model:data option |
| * --mem_model:data=far => Data accesses default to far |
| */ |
| |
| var ccOpts = { |
| "ti.targets.C64P" : c6xOpts, |
| "ti.targets.C674" : c6xOpts, |
| |
| "ti.targets.elf.C64P" : c6xOpts, |
| "ti.targets.elf.C64T" : c6xOpts, |
| "ti.targets.elf.C66" : c6xOpts, |
| "ti.targets.elf.C674" : c6xOpts, |
| |
| "ti.targets.arm.elf.Arm9" : " -ms -g ", |
| "ti.targets.arm.elf.A8F" : " -ms -g ", |
| "ti.targets.arm.elf.A8Fnv" : " -ms -g ", |
| "ti.targets.arm.elf.M3" : " --embed_inline_assembly -ms -pds=71", |
| "ti.targets.arm.elf.M4" : " -ms -g ", |
| "ti.targets.arm.elf.M4F" : " -ms -g ", |
| "ti.targets.arm.elf.R5F" : " -ms -g ", |
| |
| "ti.targets.arp32.elf.ARP32" : " -g ", |
| "ti.targets.arp32.elf.ARP32_far" : " -g ", |
| |
| "gnu.targets.arm.A8F" : " -g ", |
| "gnu.targets.arm.A15F" : " -g ", |
| "gnu.targets.arm.A53F" : " -g " |
| }; |
| |
| var lnkOpts = { |
| "ti.targets.elf.C66" : " --cinit_compression=off", |
| "ti.targets.arm.elf.M4" : " --retain=.resource_table" + |
| " --cinit_compression=off", |
| "ti.targets.arm.elf.R5F" : " --retain=.resource_table" + |
| " --cinit_compression=off" |
| }; |
| |
| var platform = ""; |
| var smpEnabled = true; |
| var Bld_goal = ""; |
| |
| /* initialize local vars with those set in xdcpaths.mak (via XDCARGS) */ |
| for (arg = 0; arg < arguments.length; arg++) { |
| /* split each arg into its '+' separated parts */ |
| var configParts = arguments[arg].split(";"); |
| // print("arg " + arg + " has " + configParts.length + " parts"); |
| |
| /* if "known args come in, filter them... else they're targets */ |
| if (configParts[0].split("=")[0] == "PLATFORM") { |
| // print("FOUND PLATFORM ARG - " + configParts[0]); |
| platform = configParts[0].split("=")[1]; |
| continue; |
| } |
| else if (configParts[0].split("=")[0] == "BIOS_SMPENABLED") { |
| // print("FOUND SMP_ENABLED ARG - " + configParts[0]); |
| smpEnabled = configParts[0].split("=")[1].match(/^1$/); |
| continue; |
| } |
| else if (configParts[0].split("=")[0] == "GOAL") { |
| Bld_goal = configParts[0].split("=")[1]; |
| continue; |
| } |
| |
| if (platform == "") { |
| platform = "NONE"; |
| } |
| |
| /* |
| * Get the compiler's installation directory. |
| * For "ti.targets.elf.C674=/vendors/c6x/7.2.0", we get "/vendors/c6x/7.2.0" |
| */ |
| var targetName = configParts[0].split("=")[0]; |
| var rootDir = configParts[0].split("=")[1]; |
| |
| /* only build for the specified compilers */ |
| if (rootDir == "" || rootDir == undefined) { |
| continue; |
| } |
| |
| // print("Building for platform:" + platform + " targetName:" + targetName |
| // + " rootDir: " + rootDir + " smpEnabled:" + smpEnabled + "..."); |
| |
| var target = xdc.useModule(targetName); |
| target.rootDir = rootDir; |
| if (ccOpts[targetName] != undefined) { |
| target.ccOpts.suffix += ccOpts[targetName]; |
| } |
| if (lnkOpts[targetName] != undefined) { |
| target.lnkOpts.suffix += lnkOpts[targetName]; |
| } |
| |
| /* for all the other parts, assign target.<left> = <right> */ |
| for (var i = 1; i < configParts.length; i++) { |
| var modCfgParam = configParts[i].split("=")[0]; |
| var modCfgValue = configParts[i].split("=")[1]; |
| var modCfgIndex = modCfgParam.split("."); |
| var element = target; |
| |
| // print("Configuring target." + modCfgParam + " = " + modCfgValue); |
| |
| for (j = 0; j < (modCfgIndex.length -1); j++) { |
| element = element[modCfgIndex[j]]; |
| } |
| element[modCfgIndex[j]] = modCfgValue; |
| } |
| |
| /* Add appropriate platforms to build for based on target name */ |
| if (targetName.match(/elf\.C674/)) { |
| if (platform == 'OMAPL138') { |
| target.platforms.$add("ti.platforms.evmOMAPL138:DSP"); |
| } |
| } |
| |
| if (targetName.match(/elf\.C66$/)) { |
| switch (platform) { |
| case '66AK2G': |
| target.platforms.$add("ti.platforms.evmTCI66AK2G02:core0"); |
| break; |
| |
| case '66AK2E': |
| target.platforms.$add("ti.platforms.evmC66AK2E:core0"); |
| break; |
| |
| case 'TCI6630': |
| target.platforms.$add("ti.platforms.evmTCI6630K2L:core0"); |
| break; |
| |
| case 'TCI6636': |
| target.platforms.$add("ti.platforms.evmTCI6636K2H:core0"); |
| break; |
| |
| case 'TCI6638': |
| target.platforms.$add("ti.platforms.evmTCI6638K2K:core0"); |
| break; |
| |
| case 'C6678': |
| target.platforms.$add("ti.platforms.evm6678"); |
| break; |
| |
| case 'DRA7XX': |
| target.platforms.$add("ti.platforms.evmDRA7XX:dsp1"); |
| target.platforms.$add("ti.platforms.evmDRA7XX:dsp2"); |
| break; |
| |
| case 'TDA3XX': |
| target.platforms.$add("ti.platforms.evmTDA3XX"); |
| break; |
| |
| case 'NONE': |
| /* okay, no platform specified */ |
| break; |
| |
| default: |
| print("Unknown C66x platform, skipping " + platform); |
| break; |
| } |
| } |
| |
| if (targetName.match(/elf\.C64T/)) { |
| if (platform == 'OMAP54XX') { |
| target.platforms.$add("ti.platforms.sdp5430:DSP"); |
| } |
| } |
| |
| if (targetName.match(/elf\.M4$/)) { |
| switch (platform) { |
| case 'OMAP54XX': |
| target.platforms.$add("ti.platforms.sdp5430:IPU"); |
| break; |
| |
| case 'DRA7XX': |
| target.platforms.$add("ti.platforms.evmDRA7XX:ipu2"); |
| target.platforms.$add("ti.platforms.evmDRA7XX:ipu1"); |
| break; |
| |
| case 'TDA3XX': |
| target.platforms.$add("ti.platforms.evmTDA3XX"); |
| break; |
| |
| case 'NONE': |
| /* okay, no platform specified */ |
| break; |
| |
| default: |
| print("Unknown M4 platform, skipping " + platform); |
| break; |
| } |
| } |
| |
| if (targetName.match(/elf\.R5F$/)) { |
| switch (platform) { |
| case 'AM65XX': |
| target.platforms.$add("ti.platforms.cortexR:AM65X:false:R5F0"); |
| target.platforms.$add("ti.platforms.cortexR:AM65X:false:R5F1"); |
| break; |
| |
| default: |
| print("Unknown R5F platform, skipping " + platform); |
| break; |
| } |
| } |
| |
| Build.targets.$add(target); |
| } |
| |
| if (smpEnabled) { |
| /* Enable building SMP-BIOS enabled libraries for targets that support it */ |
| if (Pkg.name.match(/^ti\.sdo\.(ipc|utils)/)) { |
| xdc.module("ti.targets.arm.elf.M3").profiles["smp"] = |
| xdc.module("ti.targets.arm.elf.M3").profiles["debug"]; |
| xdc.module("ti.targets.arm.elf.M4").profiles["smp"] = |
| xdc.module("ti.targets.arm.elf.M4").profiles["debug"]; |
| xdc.module("gnu.targets.arm.A15F").profiles["smp"] = |
| xdc.module("gnu.targets.arm.A15F").profiles["debug"]; |
| xdc.module("gnu.targets.arm.A53F").profiles["smp"] = |
| xdc.module("gnu.targets.arm.A53F").profiles["debug"]; |
| } |
| } |
| |
| /* lib/ is a generated directory that 'xdc clean' should remove */ |
| Pkg.generatedFiles.$add("lib/"); |
| |
| /* |
| * Some packages build for 'all profiles' - but that's too much to ship. |
| * Loop over all profiles in all Build.targets and remove everything |
| * except 'release' and 'debug'. |
| */ |
| for (var t = 0; t < Build.targets.length; t++) { |
| for (prof in Build.targets[t].profiles) { |
| if ((prof != 'release') && (prof != 'debug') && (prof != 'smp')) { |
| delete Build.targets[t].profiles[prof]; |
| } |
| } |
| } |
| |
| /* -----------------------------------------------------------------------*/ |
| /* make release files '.tar.gz' files (.tar is default) */ |
| Pkg.attrs.compress = true; |
| |
| /* catch inadvertant use of unsupported data types */ |
| Pkg.attrs.defs = "-Dxdc__strict"; |