1    /* 
     2     *  Copyright (c) 2008 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     *  ======== gnu.targets.ITarget ========
    14     *  Interface to GCC compatible compilers
    15     */
    16    @TargetHeader("xdc/bld/stddefs.xdt")
    17    metaonly interface ITarget inherits xdc.bld.ITarget2 {
    18    
    19        override readonly config string stdInclude = "gnu/targets/std.h";
    20        override config string dllExt     = ".so";
    21    
    22        /*!
    23         *  ======== GCCVERS ========
    24         *  Version number of the GCC compiler; e.g., "3.2".
    25         *
    26         *  This string can be supplied by the user, otherwise it is obtained
    27         *  by running "gcc -dumpversion".
    28         */
    29        config string GCCVERS = null;
    30    
    31        /*!
    32         *  ======== BINVERS ========
    33         *  Version number of binutils used with the compiler; e.g., "2.19".
    34         *
    35         *  This string can be supplied by the user, otherwise it is obtained
    36         *  by running "ld -v".
    37         */
    38        config string BINVERS = null;
    39    
    40        /*!
    41         *  ======== version ========
    42         *  The Compatibility Key associated with this target.
    43         *
    44         *  The first two components of this target's Compatibility Key are '1,0'.
    45         *  The rest of the Key represents the compiler version. The third
    46         *  component combines the major and the minor version number in the format
    47         *  Major.Minor. The fourth component is the patch number.
    48         *
    49         *  @a(Example)
    50         *  If this target's `rootDir` points to the compiler version 3.4.6, the 
    51         *  Compatibility Key is [1,0,3.4,6].
    52         *  
    53         */
    54        override metaonly config String version;
    55    
    56        /*!
    57         *  ======== GCCTARG ========
    58         *  The name of the platform executing programs produced by this target
    59         *
    60         *  This string can be supplied by the user, otherwise is is obtained
    61         *  from the compiler and follows the GNU standard format
    62         *  (<cpu>-<manufacturer>-<os> or <cpu>-<manufacturer>-<kernel>-<os>);
    63         *  e.g., "sparc-sun-solaris2.6" or "i586-pc-linux-gnu".
    64         *
    65         *  When building a GCC compiler, there are three different execution
    66         *  platforms to consider: the platform used to "build" the compiler, the
    67         *  "host" platform that runs the compiler, and the "target" platform
    68         *  that runs the executables produced by the compiler. All three
    69         *  platforms are identified using a
    70         *  {@link http://sources.redhat.com/autobook/autobook/autobook_17.html configuration name}
    71         *  defined by GNU Autotools.  `GCCTARG` is the name of the "target"
    72         *  platform.
    73         */
    74        config string GCCTARG = null;
    75    
    76        /*!
    77         *  ======== LONGNAME ========
    78         *  The "long name" of the gcc compiler
    79         *
    80         *  This name is used (in conjunction with rootDir) to find the compiler
    81         *  and linker for this target. The format of `LONGNAME` is always
    82         *  "/bin/<machine>-gcc". For majority of the targets, the default value
    83         *  for `LONGNAME` does not ever need to be changed. But, there are
    84         *  targets where the different but compatible compilers may have
    85         *  different `LONGNAME` parameters. For such targets and compilers,
    86         *  `LONGNAME` can be set in `config.bld`.
    87         *
    88         *  @a(Example)
    89         *  If a version 2010q1 of the CodeSourcery GNU toolchain for Arm is
    90         *  installed in C:/CodeSourcery/arm-2010q1, the following settings in
    91         *  `config.bld` configure `gnu.targets.arm.GCArmv6` target to use that
    92         *  toolchain:
    93         *  @p(code)
    94         *  var GCArmv6 = xdc.module("gnu.targets.arm.GCArmv6");
    95         *  GCArmv6.rootDir = "C:/CodeSourcery/arm-2010q1"; 
    96         *  GCArmv6.LONGNAME = "bin/arm-none-linux-gnueabi-gcc";
    97         *  @p
    98         *
    99         */
   100        config string LONGNAME = "/bin/gcc";
   101        
   102        /*!
   103         *  ======== CYGWIN ========
   104         *  Is the target's compiler a cygwin executable
   105         *
   106         *  Since file names produced by cygwin-based tools differ from the
   107         *  names understood by other Windows executables, it is important
   108         *  to avoid using the names output by cygwin tools as input to
   109         *  non-cygwin programs.  This property tells the target whether
   110         *  or not it's possible to use the output from `gcc -MD -MF`, for
   111         *  example.
   112         */
   113        readonly config Bool CYGWIN = false;
   114        
   115        /*!
   116         *  ======== noStdLinkScript ========
   117         *  Don't use the standard linker script
   118         *
   119         *  If `true`, add a `-T` flag before the generated `package/cfg/*.xdl`
   120         *  file passed to the linker.  This flag suppresses use of the
   121         *  standard linker script implicit in the GCC flow, which effectively
   122         *  says the generated `.xdl` file assumes total control for all
   123         *  `MEMORY` and `SECTION` directives.
   124         *
   125         */
   126        config Bool noStdLinkScript = false;
   127        
   128        /*
   129         *  ======== profiles ========
   130         */
   131        override config xdc.bld.ITarget.OptionSet profiles[string] = [
   132            ["debug", {
   133                compileOpts: {
   134                    copts: "-g",
   135                    defs:  "-D_DEBUG_=1",
   136                },
   137                linkOpts: "-g",
   138            }],
   139    
   140            ["release", {
   141                compileOpts: {
   142                    copts: "-O2 -ffunction-sections -fdata-sections",
   143                },
   144                linkOpts: "",
   145            }],
   146    
   147            ["profile", {
   148                compileOpts: {
   149                    copts: "-g -pg",
   150                },
   151                linkOpts: "-pg"     /* can't use -static here */
   152            }],
   153    
   154            ["coverage", {
   155                compileOpts: {
   156                    copts: "-fprofile-arcs -ftest-coverage",
   157                },
   158                linkOpts: "-fprofile-arcs -ftest-coverage",
   159            }],
   160        ];
   161    
   162        /*!
   163         *  ======== versionMap ========
   164         *  Map of GCC compiler version numbers to compatibility keys.
   165         *
   166         *  This map translates version string information from the compiler
   167         *  into a compatibility key.  The compatibilty key is used to
   168         *  validate consistency among a collection of packages used in
   169         *  a configuration.
   170         *
   171         *  The compiler version string is "gcc<ver>", where <ver> is
   172         *  GCCVERS.
   173         *
   174         *  If a compiler version is not found in this map the default is
   175         *  "1,0,<ver>", where <ver> is the compiler version number.  Thus,
   176         *  the user only needs to extend this table when a significant
   177         *  incompatibility occurs or when two versions of the compiler should
   178         *  be treated as 100% compatible.
   179         */
   180        override config string versionMap[string] = [
   181            ["gcc3.2", "1,0,3.2,0"],
   182        ];
   183    
   184        /*!
   185         *  ======== remoteHost ========
   186         *  Remote host used to run compiler, linker, and archiver tools
   187         *
   188         *  If `remoteHost` is `null` (or `undefined`), the configured compiler
   189         *  is run locally; otherwise, `remoteHost` is taken to be the host name
   190         *  of the machine that that should be used to run the specified compiler.
   191         *
   192         *  All target commands are prefixed with a command that uses `rsh` to run
   193         *  the commands on the specified host.  Thus, in order to use this
   194         *  setting, the remote machine must be support `rsh` and the user must 
   195         *  have permission to run commands from the local machine on the remote 
   196         *  host named `remoteHost`.  This usually involves adding a line to the 
   197         *  user's `~/.rhosts` file on the remote machine of the form:
   198         *  @p(code)
   199         *      local-machine-name user-name
   200         *  @p
   201         *  where `local-machine-name` is the name of the local machine and
   202         * `user-name` is the user's login name on the local machine.
   203         */
   204        config string remoteHost;
   205        
   206        /*!
   207         *  ======== ar ========
   208         *  The command used to create an archive
   209         */
   210        override readonly config xdc.bld.ITarget2.Command ar = {
   211            cmd: "$(rootDir)/$(GCCTARG)/bin/ar",
   212            opts: "cr"
   213        };
   214    
   215        /*!
   216         *  ======== lnk ========
   217         *  The command used to link executables.
   218         */
   219        override readonly config xdc.bld.ITarget2.Command lnk = {
   220            cmd: "$(rootDir)/$(LONGNAME)",
   221            opts: ""
   222        };
   223    
   224        /*!
   225         *  ======== cc ========
   226         *  The command used to compile C/C++ source files into object files
   227         */
   228        override readonly config xdc.bld.ITarget2.Command cc = {
   229            cmd: "$(rootDir)/$(LONGNAME) -c -MD -MF $@.dep",
   230            opts: ""
   231        };
   232    
   233        /*!
   234         *  ======== asm ========
   235         *  The command used to assembles assembly source files into object files
   236         */
   237        override readonly config xdc.bld.ITarget2.Command asm = {
   238            cmd: "$(rootDir)/$(LONGNAME) -c -x assembler",
   239            opts: ""
   240        };
   241    
   242        /*!
   243         *  ======== includeOpts ========
   244         *  Additional user configurable target-specific include path options
   245         */
   246        override config string includeOpts = "";
   247    }
   248    /*
   249     *  @(#) gnu.targets; 1, 0, 1,423; 11-8-2010 12:37:06; /db/ztree/library/trees/xdctargets/xdctargets-c33x/src/ xlibrary
   250    
   251     */
   252