1    /*
     2     *  Copyright 2020 by Texas Instruments Incorporated.
     3     *
     4     */
     5    
     6    /*
     7     * Copyright (c) 2016-2019 Texas Instruments Incorporated - http://www.ti.com
     8     * All rights reserved.
     9     *
    10     * Redistribution and use in source and binary forms, with or without
    11     * modification, are permitted provided that the following conditions
    12     * are met:
    13     *
    14     * *  Redistributions of source code must retain the above copyright
    15     *    notice, this list of conditions and the following disclaimer.
    16     *
    17     * *  Redistributions in binary form must reproduce the above copyright
    18     *    notice, this list of conditions and the following disclaimer in the
    19     *    documentation and/or other materials provided with the distribution.
    20     *
    21     * *  Neither the name of Texas Instruments Incorporated nor the names of
    22     *    its contributors may be used to endorse or promote products derived
    23     *    from this software without specific prior written permission.
    24     *
    25     * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
    26     * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
    27     * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
    28     * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
    29     * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
    30     * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
    31     * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
    32     * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
    33     * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
    34     * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
    35     * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    36     */
    37    
    38    /*!
    39     *  ======== gnu.targets.arm.ITarget ========
    40     *  Interface to GCC compatible Arm compilers
    41     */
    42    @TargetHeader("xdc/bld/stddefs.xdt")
    43    metaonly interface ITarget inherits xdc.bld.ITarget3 {
    44    
    45        /*!
    46         *  ======== GCCVERS ========
    47         *  Version number of the GCC compiler; e.g., "3.2".
    48         *
    49         *  This string can be supplied by the user, otherwise it is obtained
    50         *  by running "gcc -dumpversion".
    51         */
    52        config string GCCVERS = null;
    53    
    54        /*!
    55         *  ======== BINVERS ========
    56         *  Version number of binutils used with the compiler; e.g., "2.19".
    57         *
    58         *  This string can be supplied by the user, otherwise it is obtained
    59         *  by running "ld -v".
    60         */
    61        config string BINVERS = null;
    62    
    63        /*!
    64         *  ======== GCCTARG ========
    65         *  The name of the platform executing programs produced by this target
    66         *
    67         *  This string can be supplied by the user, otherwise is is obtained
    68         *  from the compiler and follows the GNU standard format
    69         *  (<cpu>-<manufacturer>-<os> or <cpu>-<manufacturer>-<kernel>-<os>);
    70         *  e.g., "arm-none-eabi" or "x86_64-unknown-linux-gnu".
    71         *
    72         *  When building a GCC compiler, there are three different execution
    73         *  platforms to consider: the platform used to "build" the compiler, the
    74         *  "host" platform that runs the compiler, and the "target" platform
    75         *  that runs the executables produced by the compiler. All three
    76         *  platforms are identified using a
    77         *  {@link http://sources.redhat.com/autobook/autobook/autobook_17.html configuration name}
    78         *  defined by GNU Autotools.  `GCCTARG` is the name of the "target"
    79         *  platform.
    80         */
    81        config string GCCTARG = null;
    82    
    83        /*!
    84         *  ======== LONGNAME ========
    85         *  @_nodoc
    86         *  The "long name" of the gcc compiler
    87         *
    88         *  This name is used (in conjunction with rootDir) to find the compiler
    89         *  and linker for this target. The format of `LONGNAME` is always
    90         *  "/bin/<machine>-gcc". For majority of the targets, the default value
    91         *  for `LONGNAME` does not ever need to be changed. But, there are
    92         *  targets where the different but compatible compilers may have
    93         *  different `LONGNAME` parameters. For such targets and compilers,
    94         *  `LONGNAME` can be set in `config.bld`.
    95         *
    96         *  @a(Example)
    97         *  If a version 2010q1 of the CodeSourcery GNU toolchain for Arm is
    98         *  installed in C:/CodeSourcery/arm-2010q1, the following settings in
    99         *  `config.bld` configure `gnu.targets.arm.GCArmv6` target to use that
   100         *  toolchain:
   101         *  @p(code)
   102         *  var GCArmv6 = xdc.module("gnu.targets.arm.GCArmv6");
   103         *  GCArmv6.rootDir = "C:/CodeSourcery/arm-2010q1";
   104         *  GCArmv6.LONGNAME = "bin/arm-none-linux-gnueabi-gcc";
   105         *  @p
   106         *
   107         */
   108        config string LONGNAME = null;
   109    
   110        /*!
   111         *  ======== remoteHost ========
   112         *  Remote host used to run compiler, linker, and archiver tools
   113         *
   114         *  If `remoteHost` is `null` (or `undefined`), the configured compiler
   115         *  is run locally; otherwise, `remoteHost` is taken to be the host name
   116         *  of the machine that that should be used to run the specified compiler.
   117         *
   118         *  All target commands are prefixed with a command that uses `rsh` to run
   119         *  the commands on the specified host.  Thus, in order to use this
   120         *  setting, the remote machine must be support `rsh` and the user must
   121         *  have permission to run commands from the local machine on the remote
   122         *  host named `remoteHost`.  This usually involves adding a line to the
   123         *  user's `~/.rhosts` file on the remote machine of the form:
   124         *  @p(code)
   125         *      local-machine-name user-name
   126         *  @p
   127         *  where `local-machine-name` is the name of the local machine and
   128         * `user-name` is the user's login name on the local machine.
   129         */
   130        config string remoteHost;
   131    
   132        /*!
   133         *  ======== ar ========
   134         *  The command used to create an archive
   135         */
   136        override readonly config xdc.bld.ITarget2.Command ar = {
   137            cmd: "$(rootDir)/bin/$(GCCTARG)-ar",
   138            opts: "cr"
   139        };
   140    
   141        /*!
   142         *  ======== lnk ========
   143         *  The command used to link executables.
   144         */
   145        override readonly config xdc.bld.ITarget2.Command lnk = {
   146            cmd: "$(rootDir)/bin/$(GCCTARG)-gcc",
   147            opts: ""
   148        };
   149    
   150        /*!
   151         *  ======== cc ========
   152         *  The command used to compile C/C++ source files into object files
   153         */
   154        override readonly config xdc.bld.ITarget2.Command cc = {
   155            cmd: "$(rootDir)/bin/$(GCCTARG)-gcc -c -MD -MF $@.dep",
   156            opts: ""
   157        };
   158    
   159        /*!
   160         *  ======== asm ========
   161         *  The command used to assembles assembly source files into object files
   162         */
   163        override readonly config xdc.bld.ITarget2.Command asm = {
   164            cmd: "$(rootDir)/bin/$(GCCTARG)-gcc -c -x assembler",
   165            opts: ""
   166        };
   167    
   168        /*
   169         *  ======== profiles ========
   170         *
   171         *  -fdata-sections is removed from "release" because of
   172         *  https://bugs.launchpad.net/gcc-linaro/+bug/1329080. It applies only to
   173         *  Linux-on-Arm targets. The bare metal targets specify -fdata-sections
   174         *  in their ccOpts, so this change doesn't affect them.
   175         */
   176        override config xdc.bld.ITarget.OptionSet profiles[string] = [
   177            ["debug", {
   178                compileOpts: {
   179                    copts: "-g",
   180                    defs:  "-D_DEBUG_=1",
   181                },
   182                linkOpts: "-g",
   183            }],
   184    
   185            ["release", {
   186                compileOpts: {
   187                    copts: "-O2 -ffunction-sections",
   188                },
   189                linkOpts: "-Wl,--gc-sections",
   190            }],
   191    
   192            ["profile", {
   193                compileOpts: {
   194                    copts: "-g -pg",
   195                },
   196                linkOpts: "-pg"     /* can't use -static here */
   197            }],
   198    
   199            ["coverage", {
   200                compileOpts: {
   201                    copts: "-fprofile-arcs -ftest-coverage",
   202                },
   203                linkOpts: "-fprofile-arcs -ftest-coverage",
   204            }],
   205        ];
   206    
   207        /*!
   208         *  ======== includeOpts ========
   209         *  Additional user configurable target-specific include path options
   210         */
   211        override config string includeOpts = "";
   212    
   213        override config String binaryParser = "xdc.targets.omf.Elf";
   214    
   215        /*!
   216         *  ======== bspLib ========
   217         *  bspLib is assigned the name of the BSP library. The specified library
   218         *  is included on the link line.
   219         */
   220        config string bspLib = null;
   221    
   222        /*
   223         *  ======== initVers ========
   224         *  The function that detects the version of the Gnu compiler.
   225         */
   226        String initVers();
   227    
   228        /*!
   229         *  ======== asmName ========
   230         *  The function that converts a C name into an assembly name
   231         */
   232        String asmName(String CName);
   233    }
   234    /*
   235     *  @(#) gnu.targets.arm; 1, 0, 0,; 1-17-2020 15:49:03; /db/ztree/library/trees/xdctargets/xdctargets-w07/src/ xlibrary
   236    
   237     */
   238