/*
 *  ======== package/cfg/JpegEncApp6678_xe66.cfg ========
 *  This generated configuration script runs the user's configuration script
 *  the context of a specific target and platform in order to generate
 *  all the files necessary to create an executable; e.g., linker command
 *  files, static C/C++ data structures, etc.
 */

/*
 *  ======== _runescape ========
 *  Recursive unescape to decode serialized strings
 */
function _runescape(obj) {
    for (var i in obj) {
	if (obj[i] != null) {
	    if (typeof obj[i] == 'string') {
		obj[i] = unescape(obj[i]);
	    }
	    else if (typeof obj[i] == 'object') {
		_runescape(obj[i]);
	    }
	}
    }
}

/*
 *  ======== _getPlatCfg ========
 */
function _getPlatCfg() {
    var tmp = {};
    _runescape(tmp);
    return (tmp);
}
/*
 *  ======== _cfginit ========
 */
function _cfginit() {
    xdc.loadPackage('xdc.services.intern.cmd');
    var prog = xdc.om['xdc.cfg.Program'];

    /* initialize prog attrs from build model */
    var build = {
        releases: {
            0: {
                name: "xconfig_JpegEncApp6678",
                attrs: {
                    prefix: "",
                    label: "default"
                },
                otherFiles: {},
                excludeDirs: {}
            }
        },
        target: {
            $name:"ti.targets.elf.C66",
            name: "C66",
            suffix: "e66",
            compatibleSuffixes: {
                $name:"ti.targets.elf.C66/compatibleSuffixes",
                0: "e674",
                1: "e64P"
            },
            isa: "66",
            model: {
                $name:"ti.targets.elf.C66/model",
                endian: "little",
                shortEnums: false
            },
            rts: "ti.targets.rts6000",
            base: {
                $name:"ti.targets.C62",
                name: "C62",
                suffix: "62",
                compatibleSuffixes: {
                    $name:"ti.targets.C62/compatibleSuffixes",
                },
                isa: "62",
                model: {
                    $name:"ti.targets.C62/model",
                    endian: "little"
                },
                rts: "ti.targets.rts6000",
                platform: "ti.platforms.sim6xxx%3ATMS320C6211",
                platforms: {
                    $name:"ti.targets.C62/platforms",
                },
                binaryParser: "ti.targets.omf.cof.Coff",
                debugGen: {
                    $name:"ti.targets.C62/debugGen",
                    execTemplate: "ti/targets/ccs_exec.xdt",
                    execPattern: "%24%28cfgDir%29%24%28cfgName%29.pjt",
                    packageTemplate: "ti/targets/ccs_package.xdt",
                    packagePattern: "package/%24%28pkgName%29.pjt"
                },
                extensions: {
                    $name:"ti.targets.C62/extensions",
                    ".s62": {
                        $name:"ti.targets.C62/extensions/'.s62'",
                        suf: ".s62",
                        typ: "asm"
                    },
                    ".asm": {
                        $name:"ti.targets.C62/extensions/'.asm'",
                        suf: ".asm",
                        typ: "asm"
                    },
                    ".c": {
                        $name:"ti.targets.C62/extensions/'.c'",
                        suf: ".c",
                        typ: "c"
                    },
                    ".cpp": {
                        $name:"ti.targets.C62/extensions/'.cpp'",
                        suf: ".cpp",
                        typ: "cpp"
                    },
                    ".cxx": {
                        $name:"ti.targets.C62/extensions/'.cxx'",
                        suf: ".cxx",
                        typ: "cpp"
                    },
                    ".C": {
                        $name:"ti.targets.C62/extensions/'.C'",
                        suf: ".C",
                        typ: "cpp"
                    },
                    ".cc": {
                        $name:"ti.targets.C62/extensions/'.cc'",
                        suf: ".cc",
                        typ: "cpp"
                    }
                },
                versionMap: {
                    $name:"ti.targets.C62/versionMap",
                    "TMS320C6x_4.32": "1%2C0%2C4.32%2C0",
                    "TMS320C55x_2.56": "1%2C0%2C2.56%2C0",
                    "TMS320C54x_3.83": "1%2C0%2C3.83%2C0",
                    "TMS320C2000_3.07": "1%2C0%2C3.07%2C0"
                },
                alignDirectiveSupported: true,
                profiles: {
                    $name:"ti.targets.C62/profiles",
                    debug: {
                        $name:"ti.targets.C62/profiles/'debug'",
                        compileOpts: {
                            $name:"ti.targets.C62/profiles/'debug'/compileOpts",
                            copts: "-g",
                            defs: "-D_DEBUG_%3D1"
                        },
                        filters: {
                            $name:"ti.targets.C62/profiles/'debug'/filters",
                        }
                    },
                    release: {
                        $name:"ti.targets.C62/profiles/'release'",
                        compileOpts: {
                            $name:"ti.targets.C62/profiles/'release'/compileOpts",
                            copts: "-O2"
                        },
                        filters: {
                            $name:"ti.targets.C62/profiles/'release'/filters",
                        }
                    },
                    profile: {
                        $name:"ti.targets.C62/profiles/'profile'",
                        compileOpts: {
                            $name:"ti.targets.C62/profiles/'profile'/compileOpts",
                            copts: "-gp"
                        },
                        filters: {
                            $name:"ti.targets.C62/profiles/'profile'/filters",
                        }
                    },
                    coverage: {
                        $name:"ti.targets.C62/profiles/'coverage'",
                        compileOpts: {
                            $name:"ti.targets.C62/profiles/'coverage'/compileOpts",
                            copts: "-gp"
                        },
                        filters: {
                            $name:"ti.targets.C62/profiles/'coverage'/filters",
                        }
                    },
                    whole_program: {
                        $name:"ti.targets.C62/profiles/'whole_program'",
                        compileOpts: {
                            $name:"ti.targets.C62/profiles/'whole_program'/compileOpts",
                            copts: "-oe%20-O2%20-mo"
                        },
                        filters: {
                            $name:"ti.targets.C62/profiles/'whole_program'/filters",
                        }
                    },
                    whole_program_debug: {
                        $name:"ti.targets.C62/profiles/'whole_program_debug'",
                        compileOpts: {
                            $name:"ti.targets.C62/profiles/'whole_program_debug'/compileOpts",
                            copts: "-oe%20--symdebug%3Adwarf%20-mo"
                        },
                        filters: {
                            $name:"ti.targets.C62/profiles/'whole_program_debug'/filters",
                        }
                    }
                },
                sectMap: {
                    $name:"ti.targets.C62/sectMap",
                    ".text": "code",
                    ".stack": "stack",
                    ".bss": "data",
                    ".cinit": "data",
                    ".pinit": "data",
                    ".const": "data",
                    ".data": "data",
                    ".switch": "data",
                    ".sysmem": "data",
                    ".far": "data",
                    ".args": "data",
                    ".cio": "data"
                },
                stdInclude: "ti/targets/std.h",
                stdTypes: {
                    $name:"ti.targets.C62/stdTypes",
                    t_IArg: {
                        $name:"ti.targets.C62/stdTypes/t_IArg",
                        size: 4,
                        align: 4
                    },
                    t_Char: {
                        $name:"ti.targets.C62/stdTypes/t_Char",
                        size: 1,
                        align: 1
                    },
                    t_Double: {
                        $name:"ti.targets.C62/stdTypes/t_Double",
                        size: 8,
                        align: 8
                    },
                    t_Float: {
                        $name:"ti.targets.C62/stdTypes/t_Float",
                        size: 4,
                        align: 4
                    },
                    t_Fxn: {
                        $name:"ti.targets.C62/stdTypes/t_Fxn",
                        size: 4,
                        align: 4
                    },
                    t_Int: {
                        $name:"ti.targets.C62/stdTypes/t_Int",
                        size: 4,
                        align: 4
                    },
                    t_Int8: {
                        $name:"ti.targets.C62/stdTypes/t_Int8",
                        size: 1,
                        align: 1
                    },
                    t_Int16: {
                        $name:"ti.targets.C62/stdTypes/t_Int16",
                        size: 2,
                        align: 2
                    },
                    t_Int32: {
                        $name:"ti.targets.C62/stdTypes/t_Int32",
                        size: 4,
                        align: 4
                    },
                    t_Int40: {
                        $name:"ti.targets.C62/stdTypes/t_Int40",
                        size: 8,
                        align: 8
                    },
                    t_Int64: {
                        $name:"ti.targets.C62/stdTypes/t_Int64",
                        size: 8,
                        align: 8
                    },
                    t_Long: {
                        $name:"ti.targets.C62/stdTypes/t_Long",
                        size: 8,
                        align: 8
                    },
                    t_LDouble: {
                        $name:"ti.targets.C62/stdTypes/t_LDouble",
                        size: 8,
                        align: 8
                    },
                    t_LLong: {
                        $name:"ti.targets.C62/stdTypes/t_LLong",
                        size: 8,
                        align: 8
                    },
                    t_Ptr: {
                        $name:"ti.targets.C62/stdTypes/t_Ptr",
                        size: 4,
                        align: 4
                    },
                    t_Short: {
                        $name:"ti.targets.C62/stdTypes/t_Short",
                        size: 2,
                        align: 2
                    },
                    t_Size: {
                        $name:"ti.targets.C62/stdTypes/t_Size",
                        size: 4,
                        align: 4
                    }
                },
                bitsPerChar: 8
            },
            platform: "ti.platforms.simTCI6616",
            platforms: {
                $name:"ti.targets.elf.C66/platforms",
                0: "ti.platforms.simTCI6616"
            },
            binaryParser: "ti.targets.omf.elf.Elf32",
            version: "ti.targets.elf.C66%7B1%2C0%2C7.3%2C1",
            debugGen: {
                $name:"ti.targets.elf.C66/debugGen",
                execTemplate: "ti/targets/ccs_exec.xdt",
                execPattern: "%24%28cfgDir%29%24%28cfgName%29.pjt",
                packageTemplate: "ti/targets/ccs_package.xdt",
                packagePattern: "package/%24%28pkgName%29.pjt"
            },
            extensions: {
                $name:"ti.targets.elf.C66/extensions",
                ".se66": {
                    $name:"ti.targets.elf.C66/extensions/'.se66'",
                    suf: ".se66",
                    typ: "asm"
                },
                ".s66": {
                    $name:"ti.targets.elf.C66/extensions/'.s66'",
                    suf: ".s66",
                    typ: "asm"
                },
                ".s674": {
                    $name:"ti.targets.elf.C66/extensions/'.s674'",
                    suf: ".s674",
                    typ: "asm"
                },
                ".s64P": {
                    $name:"ti.targets.elf.C66/extensions/'.s64P'",
                    suf: ".s64P",
                    typ: "asm"
                },
                ".s64": {
                    $name:"ti.targets.elf.C66/extensions/'.s64'",
                    suf: ".s64",
                    typ: "asm"
                },
                ".s62": {
                    $name:"ti.targets.elf.C66/extensions/'.s62'",
                    suf: ".s62",
                    typ: "asm"
                },
                ".asm": {
                    $name:"ti.targets.elf.C66/extensions/'.asm'",
                    suf: ".asm",
                    typ: "asm"
                },
                ".c": {
                    $name:"ti.targets.elf.C66/extensions/'.c'",
                    suf: ".c",
                    typ: "c"
                },
                ".cpp": {
                    $name:"ti.targets.elf.C66/extensions/'.cpp'",
                    suf: ".cpp",
                    typ: "cpp"
                },
                ".cxx": {
                    $name:"ti.targets.elf.C66/extensions/'.cxx'",
                    suf: ".cxx",
                    typ: "cpp"
                },
                ".C": {
                    $name:"ti.targets.elf.C66/extensions/'.C'",
                    suf: ".C",
                    typ: "cpp"
                },
                ".cc": {
                    $name:"ti.targets.elf.C66/extensions/'.cc'",
                    suf: ".cc",
                    typ: "cpp"
                }
            },
            versionMap: {
                $name:"ti.targets.elf.C66/versionMap",
                "TMS320C6x_4.32": "1%2C0%2C4.32%2C0",
                "TMS320C55x_2.56": "1%2C0%2C2.56%2C0",
                "TMS320C54x_3.83": "1%2C0%2C3.83%2C0",
                "TMS320C2000_3.07": "1%2C0%2C3.07%2C0"
            },
            alignDirectiveSupported: true,
            rootDir: "C%3A/ti/ccsv5/tools/compiler/c6000",
            profiles: {
                $name:"ti.targets.elf.C66/profiles",
                debug: {
                    $name:"ti.targets.elf.C66/profiles/'debug'",
                    compileOpts: {
                        $name:"ti.targets.elf.C66/profiles/'debug'/compileOpts",
                        copts: "--symdebug%3Adwarf",
                        defs: "-D_DEBUG_%3D1"
                    },
                    filters: {
                        $name:"ti.targets.elf.C66/profiles/'debug'/filters",
                    }
                },
                release: {
                    $name:"ti.targets.elf.C66/profiles/'release'",
                    compileOpts: {
                        $name:"ti.targets.elf.C66/profiles/'release'/compileOpts",
                        copts: "-O2"
                    },
                    filters: {
                        $name:"ti.targets.elf.C66/profiles/'release'/filters",
                    }
                },
                profile: {
                    $name:"ti.targets.elf.C66/profiles/'profile'",
                    compileOpts: {
                        $name:"ti.targets.elf.C66/profiles/'profile'/compileOpts",
                        copts: "--gen_profile_info"
                    },
                    filters: {
                        $name:"ti.targets.elf.C66/profiles/'profile'/filters",
                    }
                },
                coverage: {
                    $name:"ti.targets.elf.C66/profiles/'coverage'",
                    compileOpts: {
                        $name:"ti.targets.elf.C66/profiles/'coverage'/compileOpts",
                        copts: "--gen_profile_info"
                    },
                    filters: {
                        $name:"ti.targets.elf.C66/profiles/'coverage'/filters",
                    }
                },
                whole_program: {
                    $name:"ti.targets.elf.C66/profiles/'whole_program'",
                    compileOpts: {
                        $name:"ti.targets.elf.C66/profiles/'whole_program'/compileOpts",
                        copts: "-oe%20-O2%20-mo"
                    },
                    filters: {
                        $name:"ti.targets.elf.C66/profiles/'whole_program'/filters",
                    }
                },
                whole_program_debug: {
                    $name:"ti.targets.elf.C66/profiles/'whole_program_debug'",
                    compileOpts: {
                        $name:"ti.targets.elf.C66/profiles/'whole_program_debug'/compileOpts",
                        copts: "-oe%20--symdebug%3Adwarf%20-mo"
                    },
                    filters: {
                        $name:"ti.targets.elf.C66/profiles/'whole_program_debug'/filters",
                    }
                }
            },
            sectMap: {
                $name:"ti.targets.elf.C66/sectMap",
                ".text": "code",
                ".ti.decompress": "code",
                ".stack": "stack",
                ".bss": "data",
                ".cinit": "data",
                ".init_array": "data",
                ".const": "data",
                ".data": "data",
                ".rodata": "data",
                ".neardata": "data",
                ".fardata": "data",
                ".switch": "data",
                ".sysmem": "data",
                ".far": "data",
                ".args": "data",
                ".cio": "data",
                ".ti.handler_table": "data"
            },
            stdInclude: "ti/targets/elf/std.h",
            stdTypes: {
                $name:"ti.targets.elf.C66/stdTypes",
                t_IArg: {
                    $name:"ti.targets.elf.C66/stdTypes/t_IArg",
                    size: 4,
                    align: 4
                },
                t_Char: {
                    $name:"ti.targets.elf.C66/stdTypes/t_Char",
                    size: 1,
                    align: 1
                },
                t_Double: {
                    $name:"ti.targets.elf.C66/stdTypes/t_Double",
                    size: 8,
                    align: 8
                },
                t_Float: {
                    $name:"ti.targets.elf.C66/stdTypes/t_Float",
                    size: 4,
                    align: 4
                },
                t_Fxn: {
                    $name:"ti.targets.elf.C66/stdTypes/t_Fxn",
                    size: 4,
                    align: 4
                },
                t_Int: {
                    $name:"ti.targets.elf.C66/stdTypes/t_Int",
                    size: 4,
                    align: 4
                },
                t_Int8: {
                    $name:"ti.targets.elf.C66/stdTypes/t_Int8",
                    size: 1,
                    align: 1
                },
                t_Int16: {
                    $name:"ti.targets.elf.C66/stdTypes/t_Int16",
                    size: 2,
                    align: 2
                },
                t_Int32: {
                    $name:"ti.targets.elf.C66/stdTypes/t_Int32",
                    size: 4,
                    align: 4
                },
                t_Int40: {
                    $name:"ti.targets.elf.C66/stdTypes/t_Int40",
                },
                t_Int64: {
                    $name:"ti.targets.elf.C66/stdTypes/t_Int64",
                    size: 8,
                    align: 8
                },
                t_Long: {
                    $name:"ti.targets.elf.C66/stdTypes/t_Long",
                    size: 4,
                    align: 4
                },
                t_LDouble: {
                    $name:"ti.targets.elf.C66/stdTypes/t_LDouble",
                    size: 8,
                    align: 8
                },
                t_LLong: {
                    $name:"ti.targets.elf.C66/stdTypes/t_LLong",
                    size: 8,
                    align: 8
                },
                t_Ptr: {
                    $name:"ti.targets.elf.C66/stdTypes/t_Ptr",
                    size: 4,
                    align: 4
                },
                t_Short: {
                    $name:"ti.targets.elf.C66/stdTypes/t_Short",
                    size: 2,
                    align: 2
                },
                t_Size: {
                    $name:"ti.targets.elf.C66/stdTypes/t_Size",
                    size: 4,
                    align: 4
                }
            },
            bitsPerChar: 8,
            ar: {
                $name:"ti.targets.elf.C66/ar",
                cmd: "ar6x",
                opts: "rq"
            },
            arOpts: {
                $name:"ti.targets.elf.C66/arOpts",
                prefix: "",
                suffix: ""
            },
            lnk: {
                $name:"ti.targets.elf.C66/lnk",
                cmd: "lnk6x",
                opts: "--abi%3Delfabi"
            },
            lnkOpts: {
                $name:"ti.targets.elf.C66/lnkOpts",
                prefix: "-q%20-u%20_c_int00",
                suffix: "-c%20-m%20%24%28XDCCFGDIR%29/%24@.map%20-l%20%24%28rootDir%29/lib/rts6600_elf.lib"
            },
            cc: {
                $name:"ti.targets.elf.C66/cc",
                cmd: "cl6x%20-c",
                opts: "-mv6600%20--abi%3Delfabi"
            },
            ccOpts: {
                $name:"ti.targets.elf.C66/ccOpts",
                prefix: "-qq%20-pdsw225",
                suffix: ""
            },
            ccConfigOpts: {
                $name:"ti.targets.elf.C66/ccConfigOpts",
                prefix: "%24%28ccOpts.prefix%29%20-mo",
                suffix: "%24%28ccOpts.suffix%29"
            },
            asm: {
                $name:"ti.targets.elf.C66/asm",
                cmd: "cl6x%20-c",
                opts: "-mv6600%20--abi%3Delfabi"
            },
            asmOpts: {
                $name:"ti.targets.elf.C66/asmOpts",
                prefix: "-qq",
                suffix: ""
            },
            includeOpts: "-I%24%28rootDir%29/include",
            binDir: "%24%28rootDir%29/bin/",
            pathPrefix: "",
            vers: {
                $name:"ti.targets.elf.C66/vers",
                cmd: "cl6x",
                opts: "--compiler_revision"
            }
        },
        test: {},
        cfgArgsEncoded: true,
        cfgArgs: "null",
        cfgScript: "C%3A/Program%20Files/Texas%20Instruments/Codecs/C66x_jpegenc_02_02_00_01_ELF/packages/ti/sdo/codecs/jpegenc/App/Client/Build/TestAppEncoder/JpegEncApp6678.cfg",
        cfgHome: "xconfig_JpegEncApp6678",
        profile: "release"
    };
    build.target.findSuffix = function findSuffix(pkg) {
        if (arguments.length < 1) {
            throw new Error("The function ITarget.findSuffix() requires an " + "argument");
        }
        var suffixMap = {};
        if ("build" in pkg) {
            var build = pkg.build;
            if (build.libraries.length != 0) {
                if (build.libDesc[0].suffix != undefined) {
                    for (var i = 0; i < build.libDesc.length; i++) {
                        suffixMap[build.libDesc[i].suffix] = "";
                    }
                } else {
                    for (var i = 0; i < build.libDesc.length; i++) {
                        if (build.libDesc[i].target == prog.build.target.$name) {
                            suffixMap[prog.build.target.suffix] = "";
                            break;
                        }
                    }
                }
            }
        } else {
            if ("length" in pkg) {
                for (var i = 0; i < pkg.length; i++) {
                    suffixMap[pkg[i]] = "";
                }
            } else {
                throw new Error("An invalid argument type supplied to " + "ITarget.findSuffix()");
            }
        }
        var compTargs = [];
        for (var prop in this.compatibleSuffixes) {
            compTargs[prop] = this.compatibleSuffixes[prop];
        }
        if (this.suffix in suffixMap) {
            return (this.suffix);
        }
        if (compTargs.length < 1) {
            return (null);
        }
        for (var i = 0; i < compTargs.length; i++) {
            if (compTargs[i] in suffixMap) {
                return (compTargs[i]);
            }
        }
        return (null);
    };

    build.target.selectSuffix = function selectSuffix(list) {
        var suffixMap = {};
        for (var i = 0; i < list.length; i++) {
            suffixMap[list[i]] = "";
        }
        var compTargs = [];
        for (var prop in this.compatibleSuffixes) {
            compTargs[prop] = this.compatibleSuffixes[prop];
        }
        if (this.suffix in suffixMap) {
            return (this.suffix);
        }
        if (compTargs.length < 1) {
            return (null);
        }
        for (var i = 0; i < compTargs.length; i++) {
            if (compTargs[i] in suffixMap) {
                return (compTargs[i]);
            }
        }
        return (null);
    };

    build.target.asmName = function asmName(CName) {
        return (CName);
    };

    _runescape(build);
    build.cfgArgs = null;
    prog.build = build;
    
    prog.name = "JpegEncApp6678.xe66";

    prog.endian = prog.build.target.model.endian;

    /* use the platform package's Platform module */
    var Platform = xdc.useModule("ti.platform.custom66x.Platform");
    var platParams = _getPlatCfg();
    for (var prop in platParams) {
        if (!(prop in Platform.PARAMS)) {
            delete platParams[prop];
        }
    }
    prog.platformName = "ti.platform.custom66x";
    prog.platform = Platform.create("", _getPlatCfg(), platParams);
    /* record the executable's package name */
    prog.buildPackage = "xconfig_JpegEncApp6678";

    /* record build-model information required during config generation */
    prog.$$bind("$$isasm", 0);
    prog.$$bind("$$isrom", 0);
    prog.$$bind("$$gentab", [
    ]);
    
    /* bind prog to an appropriate execution context */
    prog.cpu = prog.platform.getExeContext(prog);

    /* import the target's run-time support pkg */
    xdc.loadPackage("ti.targets.rts6000");
}
    
/* function to import the cfg script's package */
function _userscript($$legacy, script) {
    var home;
    var spath;
    home = xdc.loadPackage("xconfig_JpegEncApp6678");
    
    xdc.om.$$bind('$homepkg', home);

    var platParams = _getPlatCfg();

    /* load & run program cfg script and monitor all loaded files */
    _runCfg("C:/Program Files/Texas Instruments/Codecs/C66x_jpegenc_02_02_00_01_ELF/packages/ti/sdo/codecs/jpegenc/App/Client/Build/TestAppEncoder/JpegEncApp6678.cfg", spath, "package/cfg/JpegEncApp6678_xe66",  
             false, 
             false,
             platParams, script);

    /*
     *  ======== _loadOrEval ========
     *  Either load the user configuration script from disk, or else
     *  execute the supplied source text directly. In either case,
     *  provide the same execution environment.
     */
    function _loadOrEval(cfgScript, noTrack, path, script) {
        if (!script) {
            utils.loadCapsule(cfgScript, noTrack, path);
        }
        else {
            /* set up the same environment that loadCapsule would */ 
            var $saveCsd = utils.csd;
            var $cfgFile = utils.findFile(cfgScript, path);
            if ($cfgFile) {
                $cfgFile = java.io.File($cfgFile);
            }
            if ($cfgFile && $cfgFile.exists()) {
                utils.csd = $cfgFile.getParentFile().getCanonicalPath();
            }
            utils.evaluateScript(script);
            utils.csd = $saveCsd;
        }
    }

    /*
     *  ======== _runCfg ========
     *  Run a user supplied configuration script and prevent user's script from
     *  overwriting the global variable prog.
     */
    function _runCfg(cfgScript, path, programName, legacyTcf, legacyCfg,
        platParams, script)
    {
        if (legacyTcf) {
            /* save current global variables */
            var $save = {prog: utils.global.prog, Program: Program};
    
            /* initialize global variables for legacy config scripts */
            environment["config.programName"] = programName;
            environment["config.platform"] = Program.platformName;
            utils.seedPath = environment["config.importPath"];
            utils.loadPlatform.params = platParams;
            Program = $$legacy.Program;     /* defined in cfg.tci */
            
            /* run legacy config script with prog == to RTSC Program; this
             * allows legacy script to read build atributes from RTSC model
             * before re-creating the prog object
             */
            utils.loadCapsule(cfgScript, false, path);  
    
            /* restore global variables; now prog == TCOM prog because
             * utils.loadPlatform() creates the TCOM prog object.
             */
            $$legacy.prog = utils.global.prog;  /* in case XDC wants it */
            utils.global.prog = $save.prog;
            Program = $save.Program;
    
            /* run XDC configuration script, if it exists */
            if (legacyCfg) {
                utils.importFile(cfgScript.replace(/\.tcf/, ".cfg"), path);
            }
        }
        else {
            _loadOrEval(cfgScript, false, path, script);
        }
    }
}
    
function _postinit() {

    var cout = null;

    var prog = xdc.om['xdc.cfg.Program'];
    /* get the exec command for this executable */
    if (prog.execCmd == null) {
        prog.execCmd = prog.platform.getExecCmd(prog,
            xdc.om["ti.platform.custom66x"].packageBase);
    }
    cout = "define EXEC." + prog.name + '\n\n';
    cout += prog.execCmd;
    cout += "\nendef\n\n";

    utils.genDep("package/cfg/JpegEncApp6678_xe66", "xconfig_JpegEncApp6678", utils.loadedFiles, cout, null);
}
