1    /*
     2     *  Copyright 2020 by Texas Instruments Incorporated.
     3     *
     4     */
     5    
     6    /*
     7     * Copyright (c) 2018-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     *  ======== C28_large ========
    40     *  TI C28 large model little endian
    41     */
    42    metaonly module C28_large inherits ti.targets.ITarget {
    43        override readonly config string name                = "C28_large";
    44        override readonly config string suffix              = "28L";
    45        override readonly config string isa                 = "28";
    46        override readonly config xdc.bld.ITarget.Model model    = {dataModel: "large", endian: "little"};
    47        override readonly config string rts                 = "ti.targets.rts2800";
    48        final override readonly config Bool alignDirectiveSupported = false;
    49    
    50        /*!
    51         *  ======== ar ========
    52         *  Define archiver executable
    53         *
    54         *  Options:
    55         *  @p(dlist)
    56         *      -`-r`
    57         *          replace file
    58         *      -`-q`
    59         *          quiet mode
    60         */
    61        override readonly config xdc.bld.ITarget2.Command ar = {
    62            cmd: "ar2000",
    63            opts: "rq"
    64        };
    65    
    66        /*!
    67         *  ======== cc ========
    68         *  Define compiler executable
    69         *
    70         *  Options:
    71         *  @p(dlist)
    72         *      -`-c`
    73         *          no linking
    74         *      -`-v28`
    75         *          compile for c28x.
    76         *      -`-ml`
    77         *          use large memory model
    78         *      -`-DLARGE_MODEL=1`
    79         *          required to use va_arg in large model
    80         */
    81        override readonly config xdc.bld.ITarget2.Command cc = {
    82            cmd: "cl2000 -c",
    83            opts: "-v28 -DLARGE_MODEL=1 -ml"
    84        };
    85    
    86        /*!
    87         *  ======== vers ========
    88         *  Define the vers command
    89         */
    90        override readonly config xdc.bld.ITarget2.Command vers = {
    91            cmd: "cl2000",
    92            opts: "--compiler_revision"
    93        };
    94    
    95        /*!
    96         *  ======== asm ========
    97         *  Define assembler executable
    98         *
    99         *  Options:
   100         *  @p(dlist)
   101         *      -`-c`
   102         *          no linking
   103         *      -`-v28`
   104         *          compile for c28x.
   105         *      -`-ml`
   106         *          use large memory model
   107         *      -`-DLARGE_MODEL=1`
   108         *          because compiler and BIOS are broken; asembler
   109         *          defines __LARGE_MODEL but BIOS uses LARGE_MODEL
   110         *
   111         */
   112        override readonly config xdc.bld.ITarget2.Command asm = {
   113            cmd: "cl2000 -c",
   114            opts: "-v28 -ml -DLARGE_MODEL=1"
   115        };
   116    
   117        /*!
   118         *  ======== lnk ========
   119         *  Define linker executable
   120         */
   121        override readonly config xdc.bld.ITarget2.Command lnk = {
   122            cmd: "cl2000",
   123            opts: "-z"
   124        };
   125    
   126        /*!
   127         *  ======== asmOpts ========
   128         *  User configurable assembler options.
   129         *
   130         *  Defaults:
   131         *  @p(dlist)
   132         *      -`-qq`
   133         *          super quiet mode
   134         */
   135        override config xdc.bld.ITarget2.Options asmOpts = {
   136            prefix: "-qq",
   137            suffix: ""
   138        };
   139    
   140        /*!
   141         *  ======== ccOpts ========
   142         *  Compiler options
   143         *  @p(dlist)
   144         *      -`-qq`
   145         *          super quiet mode
   146         *      -`-pdsw225`
   147         *          generate a warning for implicitly declared functions; i.e.,
   148         *          functions without prototypes
   149         *      -`-Dfar= `
   150         *          ignore keyword far; this allows one to write code that can
   151         *          be compiled in large model and small model without #ifdef's
   152         */
   153        override config xdc.bld.ITarget2.Options ccOpts = {
   154            prefix: "-qq -pdsw225 -Dfar= ",
   155            suffix: ""
   156        };
   157    
   158        /*!
   159         *  ======== profiles ========
   160         *  Standard options profiles for the TI tool-chain.
   161         */
   162        override config xdc.bld.ITarget.OptionSet profiles[string] = [
   163            ["debug", {
   164                compileOpts: {
   165                    copts: "-g",
   166                    defs:  "-D_DEBUG_=1",
   167                }
   168            }],
   169            ["release", {
   170                compileOpts: {
   171                    copts: "-O2",
   172                },
   173            }],
   174            ["profile", {
   175                compileOpts: {
   176                    copts: "-g --gen_profile_info",
   177                },
   178            }],
   179            ["coverage", {
   180                compileOpts: {
   181                    copts: "-g --gen_profile_info",
   182                },
   183            }],
   184        ];
   185    
   186        /*!
   187         *  ======== includeOpts ========
   188         *  Default include search path
   189         */
   190        override config string includeOpts = "-I$(rootDir)/include";
   191    
   192        final override readonly config string sectMap[string] =
   193            ti.targets.C28.sectMap;
   194    
   195        final override readonly config Bool splitMap[string] =
   196            ti.targets.C28.splitMap;
   197    
   198        override readonly config xdc.bld.ITarget.StdTypes stdTypes = {
   199            t_IArg          : { size: 2, align: 2 },
   200            t_Char          : { size: 1, align: 1 },
   201            t_Double        : { size: 2, align: 2 },
   202            t_Float         : { size: 2, align: 2 },
   203            t_Fxn           : { size: 2, align: 2 }, /* far */
   204            t_Int           : { size: 1, align: 1 },
   205            t_Int8          : { size: 1, align: 1 },
   206            t_Int16         : { size: 1, align: 1 },
   207            t_Int32         : { size: 2, align: 2 },
   208            t_Int64         : { size: 4, align: 2 },
   209            t_Long          : { size: 2, align: 2 },
   210            t_LDouble       : { size: 2, align: 2 },
   211            t_LLong         : { size: 4, align: 2 },
   212            t_Ptr           : { size: 2, align: 2 },
   213            t_Short         : { size: 1, align: 1 },
   214            t_Size          : { size: 2, align: 2 },
   215        };
   216    
   217        override readonly config Int bitsPerChar = 16;
   218    }
   219    /*
   220     *  @(#) ti.targets; 1, 0, 3,; 1-17-2020 15:49:10; /db/ztree/library/trees/xdctargets/xdctargets-w07/src/ xlibrary
   221    
   222     */
   223