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