1    /*
     2     *  Copyright 2020 by Texas Instruments Incorporated.
     3     *
     4     */
     5    
     6    /*
     7     * Copyright (c) 2008-2019 Texas Instruments Incorporated
     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     *  ======== ITarget ========
    40     *  An ELF extension to the `ti.targets.ITarget` interface.
    41     */
    42    metaonly interface ITarget inherits ti.targets.ITarget {
    43    
    44        override readonly config string rts = "ti.targets.rts6000";
    45    
    46        override readonly config xdc.bld.ITarget2.Command ar = {
    47            cmd: "ar6x",
    48            opts: "rq"
    49        };
    50    
    51        override readonly config xdc.bld.ITarget2.Command lnk = {
    52            cmd: "cl6x",
    53            opts: "--abi=eabi -z"
    54        };
    55    
    56        override readonly config xdc.bld.ITarget2.Command vers = {
    57            cmd: "cl6x",
    58            opts: "--compiler_revision"
    59        };
    60    
    61        /*!
    62         *  ======== asmOpts ========
    63         *  User configurable assembler options.
    64         *
    65         *  Defaults:
    66         *  @p(dlist)
    67         *      -`-qq`
    68         *          super quiet mode
    69         */
    70        override config xdc.bld.ITarget2.Options asmOpts = {
    71            prefix: "-qq",
    72            suffix: ""
    73        };
    74    
    75        /*!
    76         *  ======== ccOpts ========
    77         *  User configurable compiler options.
    78         *
    79         *  Defaults:
    80         *  @p(dlist)
    81         *      -`-qq`
    82         *          super quiet mode
    83         *      -`-pdsw225`
    84         *          generate a warning for implicitly declared functions; i.e.,
    85         *          functions without prototypes
    86         */
    87        override config xdc.bld.ITarget2.Options ccOpts = {
    88            prefix: "-qq -pdsw225",
    89            suffix: ""
    90        };
    91    
    92        /*!
    93         *  ======== ccConfigOpts ========
    94         *  User configurable compiler options for the generated config C file.
    95         *
    96         *  -mo places all functions into subsections
    97         *  --no_compress helps with compile time with no real difference in
    98         *  code size since the generated config.c is mostly data and small
    99         *  function stubs.
   100         */
   101        override config xdc.bld.ITarget2.Options ccConfigOpts = {
   102            prefix: "$(ccOpts.prefix) -mo",
   103            suffix: "$(ccOpts.suffix)"
   104        };
   105    
   106        override config xdc.bld.ITarget.OptionSet profiles[string] = [
   107            ["debug", {
   108                compileOpts: {
   109                    copts: "--symdebug:dwarf",
   110                    defs:  "-D_DEBUG_=1",
   111                }
   112            }],
   113            ["release", {
   114                compileOpts: {
   115                    copts: "-O2",
   116                },
   117            }],
   118        ];
   119    
   120        final override readonly config string sectMap[string] = [
   121            [".text", "code"],
   122            [".ti.decompress", "code"],
   123            [".stack", "stack"],
   124            [".bss", "data"],
   125            [".cinit", "data"],
   126            [".pinit", "data"],
   127            [".init_array", "data"],
   128            [".const", "data"],
   129            [".data", "data"],
   130            [".rodata", "data"],
   131            [".neardata", "data"],
   132            [".fardata", "data"],
   133            [".switch", "data"],
   134            [".sysmem", "data"],
   135            [".far", "data"],
   136            [".args", "data"],
   137            [".cio", "data"],
   138            [".ti.handler_table", "data"],
   139            [".c6xabi.exidx", "data"],
   140            [".c6xabi.extab", "data"],
   141        ];
   142    
   143        override readonly config Bool splitMap[string] = [
   144            [".text", true],
   145            [".pinit", true],
   146            [".const", true],
   147            [".data", true],
   148            [".fardata", true],
   149            [".switch", true],
   150            [".far", true],
   151            [".args", true],
   152            [".cio", true],
   153            [".c6xabi.extab", true]
   154        ];
   155    
   156        override readonly config xdc.bld.ITarget.StdTypes stdTypes = {
   157            t_IArg          : { size: 4, align: 4 },
   158            t_Char          : { size: 1, align: 1 },
   159            t_Double        : { size: 8, align: 8 },
   160            t_Float         : { size: 4, align: 4 },
   161            t_Fxn           : { size: 4, align: 4 },
   162            t_Int           : { size: 4, align: 4 },
   163            t_Int8          : { size: 1, align: 1 },
   164            t_Int16         : { size: 2, align: 2 },
   165            t_Int32         : { size: 4, align: 4 },
   166            t_Int64         : { size: 8, align: 8 },
   167            t_Long          : { size: 4, align: 4 },
   168            t_LDouble       : { size: 8, align: 8 },
   169            t_LLong         : { size: 8, align: 8 },
   170            t_Ptr           : { size: 4, align: 4 },
   171            t_Short         : { size: 2, align: 2 },
   172            t_Size          : { size: 4, align: 4 },
   173        };
   174    
   175        override config String includeOpts = "-I$(rootDir)/include";
   176    
   177        override config String stdInclude = "ti/targets/elf/std.h";
   178    
   179        override config String binaryParser = "xdc.targets.omf.Elf";
   180    }
   181    /*
   182     *  @(#) ti.targets.elf; 1, 0, 0,; 4-8-2020 12:50:38; /db/ztree/library/trees/xdctargets/xdctargets-w13/src/ xlibrary
   183    
   184     */
   185