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