1    /* 
     2     *  Copyright (c) 2009 Texas Instruments and others.
     3     *  All rights reserved. This program and the accompanying materials
     4     *  are made available under the terms of the Eclipse Public License v1.0
     5     *  which accompanies this distribution, and is available at
     6     *  http://www.eclipse.org/legal/epl-v10.html
     7     * 
     8     *  Contributors:
     9     *      Texas Instruments - initial implementation
    10     * 
    11     * */
    12    /*
    13     *  ======== ITarget.xdc ========
    14     *
    15     */
    16    
    17    /*!
    18     *  ======== ITarget ========
    19     *  A TI specific extension to the base `xdc.bld.ITarget2` interface.
    20     */
    21    @TargetHeader("xdc/bld/stddefs.xdt")
    22    metaonly interface ITarget inherits xdc.bld.ITarget2 {
    23    
    24        override readonly config string stdInclude = "ti/targets/std.h";
    25        
    26        /*!
    27         *  ======== binDir ========
    28         *  This parameter controls the location of the target's commands.
    29         *
    30         *  All build commands returned within a command set
    31         *  (`xdc.bld.ITarget.CommandSet.cmds`) are formed by prefixing `binDir`
    32         *  to this target's Command.cmd specification.  For example, the
    33         *  compile command returned is formed as follows:
    34         *  @p(code)
    35         *      $(binDir)$(cc.cmd)
    36         *  @p
    37         *  where, `$(binDir)` is this target's `binDir` value and `$(cc.cmd)` is
    38         *  the value of this target's `cc.cmd` string.
    39         *  
    40         *  If `binDir` is non-empty then it must end with '/'.  If it is empty, 
    41         *  the target's commands (compiler, linker, archiver, etc.) will be
    42         *  located along a path constructed from this target's `pathPrefix`.
    43         */
    44        config string binDir = "$(rootDir)/bin/";
    45    
    46        /*!
    47         *  ======== pathPrefix ========
    48         *  A prefix to the PATH environment variable
    49         *
    50         *  Each target command is executed with C_DIR set to "" and PATH
    51         *  set as follows:
    52         *  @p(code)
    53         *      $(pathPrefix);$(binDir);$(PATH)
    54         *  @p
    55         *  where, `$(pathPrefix)` and `$(binDir)` are the values of the
    56         *  configuration parameters and `$(PATH)` is the value of the `PATH`
    57         *  environment variable set by the `xdc` command (type 'xdc -n' to
    58         *  see this).
    59         *
    60         *  Embedded ';' characters within `pathPrefix` separate directory
    61         *  names.  On UNIX hosts these ';' characters are convered to an
    62         *  appropriate separator; i.e., ':'.
    63         */
    64        config string pathPrefix = "";
    65        
    66        override config String binaryParser = "ti.targets.omf.cof.Coff";
    67    
    68        /*!
    69         *  ======== debugGen ========
    70         *  TI Debugger/IDE file generation support.
    71         *
    72         *  The settings below generate CCS project files that enable one
    73         *  to debug (and even rebuild) Executables from within the CCS GUI.
    74         *
    75         *  To avoid unnecessary build time overhead, these files are not always
    76         *  generated; by default, they are only generated for "debug" profiles.
    77         *  The generation of these files is controlled by the
    78         *  `{@link xdc.cfg.Program#gen}` configuration parameter.  To force these
    79         *  files to be generated for a particular executable, add the following
    80         *  line to the executable's program configuration script:
    81         *  @p(code)
    82         *      Program.gen.debuggerFiles = true;
    83         *  @p
    84         *  It is also possible to control the generation via build options; see
    85         *  `{@link xdc.bld.ITarget#DebugGen}`.
    86         *
    87         *  Note: if you are using CCS 2.x, disable CodeMaestro to prevent
    88         *  instabilities when re-loading project files.  CodeMaestro can be
    89         *  disabled via: Options->"Customize ..."->"CodeMaestro Settings"
    90         *
    91         *  To debug an executable:
    92         *  @p(nlist)
    93         *      - load generated project for the executable:
    94         *             package/cfg/<cfg_name>.pjt
    95         *      - load generated GEL script for the executable:
    96         *             package/cfg/<cfg_name>.gel
    97         *      - load prerequisite packages:
    98         *             GEL->"XDC Package"->open_project
    99         *  @p
   100         *  where <cfg_name> is the name of the executable (foo.x62) with the
   101         *  '.' replaced by and '_' (foo_x62).
   102         *
   103         *  Alternatively, one can use the `ccs_start.pl` script in this package
   104         *  to automate the steps above.  In addition, it is possible to
   105         *  associate `ccs_start.bat` (also in this package) with the generated 
   106         *  `.pjt` files to automate the above by double-clicking on the `.pjt`
   107         *  file.
   108         *
   109         *  To avoid navigation to the executable via file menus, you can load
   110         *  the executable associated with the project via:
   111         *
   112         *      GEL->"XDC Package"->load_executable
   113         *
   114         *  @a(See Also) `xdc.bld.ITarget` contains addition information about
   115         *  how to create and use these templates.
   116         */
   117        override config xdc.bld.ITarget.DebugGen debugGen = {
   118            execTemplate   : "ti/targets/ccs_exec.xdt",
   119            execPattern    : "$(cfgDir)$(cfgName).pjt",
   120            packageTemplate: "ti/targets/ccs_package.xdt",
   121            packagePattern : "package/$(pkgName).pjt"
   122        };
   123        
   124        /*!
   125         *  ======== extensions ========
   126         *  File extensions recognized by TI targets
   127         *
   128         *  @a(TI Specifics)
   129         *  For TI targets, the `typ` string field of an
   130         *  `xdc.bld.ITarget.Extension` structure may be of the form
   131         * `"<cmd>:<langOpt>"` where `<cmd>` is one of `"asm"`, `"c"`, `"cpp"`,
   132         *  and `<langOpt>` is the language option to used to identify the source
   133         *  language of a source file.  This allows one to explicitly control the
   134         *  language flag passed to the compiler based on a source file's
   135         *  extension; in particular, one can define separate source extensions
   136         *  for "linear" and "scheduled" assembly files, or simply cause `".s62"`
   137         *  files to be treated as "linear" assembly rather than "scheduled"
   138         *  assembly.
   139         *
   140         *  For example,
   141         *  @p(code)
   142         *  tiTargets.C62.extensions[".s62"] = {suf: ".s62", typ: "asm:-fl"};
   143         *  @p
   144         *  causes all `".s62"` files to be treated as linear assembly.
   145         *
   146         *  If no ':' appears in the `typ` string, a default will be used:
   147         *  `"-fa"` for `"asm"` files `"-fc"` for `"c"` files, and `"-fp"` for
   148         *  `"cpp"` files.
   149         */
   150        override config xdc.bld.ITarget.Extension extensions[string] =
   151            xdc.bld.ITarget.extensions;
   152    
   153        /*!
   154         *  ======== profiles ========
   155         *  Standard options profiles for the TI tool-chain.
   156         */
   157        override config xdc.bld.ITarget.OptionSet profiles[string] = [
   158            ["debug", {
   159                compileOpts: {
   160                    copts: "-g",
   161                    defs:  "-D_DEBUG_=1",
   162                }
   163            }],
   164            ["release", {
   165                compileOpts: {
   166                    copts: "-O2",
   167                },
   168            }],
   169            ["profile", {
   170                compileOpts: {
   171                    copts: "-gp",
   172                },
   173            }],
   174            ["coverage", {
   175                compileOpts: {
   176                    copts: "-gp",
   177                },
   178            }],
   179            ["whole_program", {
   180                compileOpts: {
   181                    copts: "-oe -O2 -mo",
   182                },
   183            }],
   184            ["whole_program_debug", {
   185                compileOpts: {
   186                    copts: "-oe --symdebug:dwarf -mo",
   187                },
   188            }],
   189        ];
   190    
   191        /*!
   192         *  ======== versionMap ========
   193         *  Map of TI compiler version numbers to compatibility keys.
   194         *
   195         *  This map translates version string information from the compiler
   196         *  into a compatibility key.  The compatibility key is used to validate
   197         *  consistency among a collection of packages used in a configuration.
   198         *
   199         *  TI compiler strings are formed by parsing the output of the
   200         *  compiler's --compiler_revision option and creating a string of the
   201         *  form:
   202         *  @p(code)
   203         *      <comp>_<ver>
   204         *  @p
   205         *  where `<comp>` is the first word of the output and `<ver>` is the
   206         *  version number that appears on this same line.
   207         *
   208         *  There are two forms of version numbers output by the TI code gen
   209         *  tools; an "old" style that is of the form "<major>.<minor>" and a
   210         *  new style of the form "<major>.<minor>.<update>[.<branch>][<qual>],
   211         *  where <major>, <minor>, <update>, and <branch> are non-negative
   212         *  integers and <qual> is of  the form "[IBAP]<yyddd>", and <yyddd>
   213         *  is the last two digits of the year concatenated with the number of
   214         *  the day.
   215         *
   216         *  If a compiler version is not found in this map the default is
   217         *  "1,0,<major>.<minor>" for old style version numbers, and
   218         *  "1,0,<major>.<minor>,<update>[.<branch>][,<yyddd>]" for new style
   219         *  version numbers.
   220         *
   221         *  The user only needs to extend this table when a significant
   222         *  incompatibility occurs (and this package doesn't know about it) or
   223         *  when two versions of the compiler should be treated as 100%
   224         *  compatible.
   225         *
   226         *  @a(Examples)
   227         *  @p(code)
   228         *      var C62 = xdc.useModule('ti.targets.C62');
   229         *
   230         *      // assert that 4.0 is forward compatible with 4.32
   231         *      C62.versionMap["TMS320C6x_4.32"] =  "1,0,4.0,0";
   232         *
   233         *      // assert that 4.28 is incompatible with all other compilers
   234         *      C62.versionMap["TMS320C6x_4.28"] =  "1,1,4.28,0";
   235         */
   236        override config string versionMap[string] = [
   237            ["TMS320C6x_4.32", "1,0,4.32,0"],
   238            ["TMS320C55x_2.56", "1,0,2.56,0"],
   239            ["TMS320C54x_3.83", "1,0,3.83,0"],
   240            ["TMS320C2000_3.07", "1,0,3.07,0"],
   241        ];    
   242        
   243        /*!
   244         *  ======== alignDirectiveSupported ========
   245         *  The compiler supports an align directive.
   246         */
   247        override readonly config Bool alignDirectiveSupported = true;
   248        
   249        /*!
   250         *  ======== ccConfigOpts ========
   251         *  User configurable compiler options for the generated config C file.
   252         */
   253        override config xdc.bld.ITarget2.Options ccConfigOpts = {
   254            prefix: "$(ccOpts.prefix) -mo",
   255            suffix: "$(ccOpts.suffix)"
   256        };
   257    
   258        /*!
   259         *  ======== asmName ========
   260         *  The function that converts a C name into an assembly name
   261         */
   262        String asmName(String CName);
   263    
   264        /*!
   265         *  ======== vers ========
   266         *  The command used to get the tool-chain to return a version number.
   267         */
   268        readonly config xdc.bld.ITarget2.Command vers;
   269    
   270        /*!
   271         *  ======== version ========
   272         *  The Compatibility Key associated with this target.
   273         *
   274         *  The first two components of this target Compatibility Key are '1,0'.
   275         *  The rest of the Key represents the compiler version. The third
   276         *  component combines the major and the minor version number in the format
   277         *  Major.Minor. The fourth component is the patch number, and the optional
   278         *  fifth component is the version of an Alpha or Beta release.
   279         *
   280         *  @a(Example)
   281         *  If this target's `rootDir` points to the compiler version 6.0.11, the 
   282         *  Compatibility Key is [1,0,6.0,11]. If this target's `rootDir` points to
   283         *  the compiler version 7.0.0B1, the Compatibility Key is [1,0,7.0,0,1]. 
   284         *  
   285         */
   286        override metaonly config String version;
   287            
   288        /*
   289         *  ======== rawVersion ========
   290         *  The raw version string from the compiler
   291         *
   292         */
   293        //override metaonly config String rawVersion;
   294    
   295    }
   296    /*
   297     *  @(#) ti.targets; 1, 0, 3,595; 9-27-2012 15:05:49; /db/ztree/library/trees/xdctargets/xdctargets-f36x/src/ xlibrary
   298    
   299     */
   300