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.ITarget3` interface.
    20     */
    21    @TargetHeader("xdc/bld/stddefs.xdt")
    22    metaonly interface ITarget inherits xdc.bld.ITarget3 {
    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         *  @_nodoc
    73         *  These templates below a long outdated and are no longer used.
    74         *  They remain as an example in the event that we want to generate
    75         *  project suport in the future.
    76         *
    77         *  To avoid unnecessary build time overhead, these files are not always
    78         *  generated; by default, they are only generated for "debug" profiles.
    79         *  The generation of these files is controlled by the
    80         *  `{@link xdc.cfg.Program#gen}` configuration parameter.  To force these
    81         *  files to be generated for a particular executable, add the following
    82         *  line to the executable's program configuration script:
    83         *  @p(code)
    84         *      Program.gen.debuggerFiles = true;
    85         *  @p
    86         *  It is also possible to control the generation via build options; see
    87         *  `{@link xdc.bld.ITarget#DebugGen}`.
    88         *
    89         *  @a(See Also) `xdc.bld.ITarget` contains addition information about
    90         *  how to create and use these templates.
    91         */
    92        //    override config xdc.bld.ITarget.DebugGen debugGen = {
    93        //  execTemplate   : "ti/targets/ccs_exec.xdt",
    94        //  execPattern    : "$(cfgDir)$(cfgName).pjt",
    95        //  packageTemplate: "ti/targets/ccs_package.xdt",
    96        //  packagePattern : "package/$(pkgName).pjt"
    97        //    };
    98        override config xdc.bld.ITarget.DebugGen debugGen = {
    99            execTemplate   : null,
   100            execPattern    : null,
   101            packageTemplate: null,
   102            packagePattern : null
   103        };
   104        
   105        /*!
   106         *  ======== extensions ========
   107         *  File extensions recognized by TI targets
   108         *
   109         *  @a(TI Specifics)
   110         *  For TI targets, the `typ` string field of an
   111         *  `xdc.bld.ITarget.Extension` structure may be of the form
   112         * `"<cmd>:<langOpt>"` where `<cmd>` is one of `"asm"`, `"c"`, `"cpp"`,
   113         *  and `<langOpt>` is the language option to used to identify the source
   114         *  language of a source file.  This allows one to explicitly control the
   115         *  language flag passed to the compiler based on a source file's
   116         *  extension; in particular, one can define separate source extensions
   117         *  for "linear" and "scheduled" assembly files, or simply cause `".s62"`
   118         *  files to be treated as "linear" assembly rather than "scheduled"
   119         *  assembly.
   120         *
   121         *  For example,
   122         *  @p(code)
   123         *  tiTargets.C62.extensions[".s62"] = {suf: ".s62", typ: "asm:-fl"};
   124         *  @p
   125         *  causes all `".s62"` files to be treated as linear assembly.
   126         *
   127         *  If no ':' appears in the `typ` string, a default will be used:
   128         *  `"-fa"` for `"asm"` files `"-fc"` for `"c"` files, and `"-fp"` for
   129         *  `"cpp"` files.
   130         */
   131        override config xdc.bld.ITarget.Extension extensions[string] =
   132            xdc.bld.ITarget.extensions;
   133    
   134        readonly config Bool splitMap[string];
   135    
   136        /*!
   137         *  ======== profiles ========
   138         *  Standard options profiles for the TI tool-chain.
   139         */
   140        override config xdc.bld.ITarget.OptionSet profiles[string] = [
   141            ["debug", {
   142                compileOpts: {
   143                    copts: "-g",
   144                    defs:  "-D_DEBUG_=1",
   145                }
   146            }],
   147            ["release", {
   148                compileOpts: {
   149                    copts: "-O2",
   150                },
   151            }],
   152            ["whole_program", {
   153                compileOpts: {
   154                    copts: "-oe -O2 -mo",
   155                },
   156            }],
   157            ["whole_program_debug", {
   158                compileOpts: {
   159                    copts: "-oe --symdebug:dwarf -mo",
   160                },
   161            }],
   162        ];
   163    
   164        /*!
   165         *  ======== versionMap ========
   166         *  Map of TI compiler version numbers to compatibility keys.
   167         *
   168         *  This map translates version string information from the compiler
   169         *  into a compatibility key.  The compatibility key is used to validate
   170         *  consistency among a collection of packages used in a configuration.
   171         *
   172         *  TI compiler strings are formed by parsing the output of the
   173         *  compiler's --compiler_revision option and creating a string of the
   174         *  form:
   175         *  @p(code)
   176         *      <comp>_<ver>
   177         *  @p
   178         *  where `<comp>` is the first word of the output and `<ver>` is the
   179         *  version number that appears on this same line.
   180         *
   181         *  There are two forms of version numbers output by the TI code gen
   182         *  tools; an "old" style that is of the form "<major>.<minor>" and a
   183         *  new style of the form "<major>.<minor>.<update>[.<branch>][<qual>],
   184         *  where <major>, <minor>, <update>, and <branch> are non-negative
   185         *  integers and <qual> is of  the form "[IBAP]<yyddd>", and <yyddd>
   186         *  is the last two digits of the year concatenated with the number of
   187         *  the day.
   188         *
   189         *  If a compiler version is not found in this map the default is
   190         *  "1,0,<major>.<minor>" for old style version numbers, and
   191         *  "1,0,<major>.<minor>,<update>[.<branch>][,<yyddd>]" for new style
   192         *  version numbers.
   193         *
   194         *  The user only needs to extend this table when a significant
   195         *  incompatibility occurs (and this package doesn't know about it) or
   196         *  when two versions of the compiler should be treated as 100%
   197         *  compatible.
   198         *
   199         *  @a(Examples)
   200         *  @p(code)
   201         *      var C62 = xdc.useModule('ti.targets.C62');
   202         *
   203         *      // assert that 4.0 is forward compatible with 4.32
   204         *      C62.versionMap["TMS320C6x_4.32"] =  "1,0,4.0,0";
   205         *
   206         *      // assert that 4.28 is incompatible with all other compilers
   207         *      C62.versionMap["TMS320C6x_4.28"] =  "1,1,4.28,0";
   208         */
   209        override config string versionMap[string] = [
   210            ["TMS320C6x_4.32", "1,0,4.32,0"],
   211            ["TMS320C2000_3.07", "1,0,3.07,0"],
   212        ];    
   213        
   214        /*!
   215         *  ======== alignDirectiveSupported ========
   216         *  The compiler supports an align directive.
   217         */
   218        override readonly config Bool alignDirectiveSupported = true;
   219        
   220        /*!
   221         *  ======== ccConfigOpts ========
   222         *  User configurable compiler options for the generated config C file.
   223         */
   224        override config xdc.bld.ITarget2.Options ccConfigOpts = {
   225            prefix: "$(ccOpts.prefix) -mo",
   226            suffix: "$(ccOpts.suffix)"
   227        };
   228    
   229        /*!
   230         *  ======== lnkOpts ========
   231         *  Linker options
   232         *
   233         *  Options:
   234         *  @p(dlist)
   235         *      -`-q`
   236         *          Quite run
   237         *      -`-u`
   238         *          Place unresolved external symbol into symbol table
   239         *      -`-c`
   240         *          ROM autoinitialization model
   241         *      -`-m`
   242         *          create a map file
   243         *      -`-l`
   244         *          archive library file as linker input
   245         */
   246        override config xdc.bld.ITarget2.Options lnkOpts = {
   247            prefix: "-w -q -u _c_int00",
   248            suffix: "-c -m $(XDCCFGDIR)/$@.map -l $(rootDir)/lib/libc.a"
   249        };
   250            
   251        /*!
   252         *  ======== asmName ========
   253         *  The function that converts a C name into an assembly name
   254         */
   255        String asmName(String CName);
   256    
   257        /*!
   258         *  ======== vers ========
   259         *  The command used to get the tool-chain to return a version number.
   260         */
   261        readonly config xdc.bld.ITarget2.Command vers;
   262    
   263        /*!
   264         *  ======== version ========
   265         *  The Compatibility Key associated with this target.
   266         *
   267         *  The first two components of this target Compatibility Key are '1,0'.
   268         *  The rest of the Key represents the compiler version. The third
   269         *  component combines the major and the minor version number in the format
   270         *  Major.Minor. The fourth component is the patch number, and the optional
   271         *  fifth component is the version of an Alpha or Beta release.
   272         *
   273         *  @a(Example)
   274         *  If this target's `rootDir` points to the compiler version 6.0.11, the 
   275         *  Compatibility Key is [1,0,6.0,11]. If this target's `rootDir` points to
   276         *  the compiler version 7.0.0B1, the Compatibility Key is [1,0,7.0,0,1]. 
   277         *  
   278         */
   279        override metaonly config String version;
   280            
   281        /*
   282         *  ======== rawVersion ========
   283         *  The raw version string from the compiler
   284         *
   285         */
   286        override metaonly config String rawVersion;
   287    
   288    }
   289    /*
   290     *  @(#) ti.targets; 1, 0, 3,669; 3-17-2014 16:50:16; /db/ztree/library/trees/xdctargets/xdctargets-h18x/src/ xlibrary
   291    
   292     */
   293