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 ========
    40     *  TI C28 default runtime model (little endian)
    41     */
    42    metaonly module C28 inherits ti.targets.ITarget {
    43        override readonly config string name                = "C28";
    44        override readonly config string suffix              = "28";
    45        override readonly config string isa                 = "28";
    46        override readonly config xdc.bld.ITarget.Model model= {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         */
    77        override readonly config xdc.bld.ITarget2.Command cc = {
    78            cmd: "cl2000 -c",
    79            opts: "-v28"
    80        };
    81    
    82        /*!
    83         *  ======== vers ========
    84         *  Define the vers command
    85         */
    86        override readonly config xdc.bld.ITarget2.Command vers = {
    87            cmd: "cl2000",
    88            opts: "--compiler_revision"
    89        };
    90    
    91        /*!
    92         *  ======== asm ========
    93         *  Define assembler executable
    94         *
    95         *  Options:
    96         *  @p(dlist)
    97         *      -`-c`
    98         *          no linking
    99         *      -`-v28`
   100         *          compile for c28x.
   101         *
   102         */
   103        override readonly config xdc.bld.ITarget2.Command asm = {
   104            cmd: "cl2000 -c",
   105            opts: "-v28"
   106        };
   107    
   108        /*!
   109         *  Define linker executable
   110         */
   111        override readonly config xdc.bld.ITarget2.Command lnk = {
   112            cmd: "cl2000",
   113            opts: "-z"
   114        };
   115    
   116        /*!
   117         *  ======== asmOpts ========
   118         *  User configurable assembler options.
   119         *
   120         *  Defaults:
   121         *  @p(dlist)
   122         *      -`-qq`
   123         *          super quiet mode
   124         */
   125        override config xdc.bld.ITarget2.Options asmOpts = {
   126            prefix: "-qq",
   127            suffix: ""
   128        };
   129    
   130        /*!
   131         *  ======== ccOpts ========
   132         *  Compiler options
   133         *  @p(dlist)
   134         *      -`-qq`
   135         *          super quiet mode
   136         *      -`-pdsw225`
   137         *          generate a warning for implicitly declared functions; i.e.,
   138         *          functions without prototypes
   139         */
   140        override config xdc.bld.ITarget2.Options ccOpts = {
   141            prefix: "-qq -pdsw225",
   142            suffix: ""
   143        };
   144    
   145        /*!
   146         *  ======== profiles ========
   147         *  Standard options profiles for the TI tool-chain.
   148         */
   149        override config xdc.bld.ITarget.OptionSet profiles[string] = [
   150            ["debug", {
   151                compileOpts: {
   152                    copts: "-g",
   153                    defs:  "-D_DEBUG_=1",
   154                }
   155            }],
   156            ["release", {
   157                compileOpts: {
   158                    copts: "-O2",
   159                },
   160            }],
   161            ["profile", {
   162                compileOpts: {
   163                    copts: "-g --gen_profile_info",
   164                },
   165            }],
   166            ["coverage", {
   167                compileOpts: {
   168                    copts: "-g --gen_profile_info",
   169                },
   170            }],
   171        ];
   172    
   173        /*  Include search path  */
   174        override config string includeOpts = "-I$(rootDir)/include";
   175    
   176        final override readonly config string sectMap[string] = [
   177            [".text", "code"],
   178            [".switch", "code"],
   179            [".data", "data"],
   180            [".cinit", "code"],
   181            [".bss", "data"],
   182            [".ebss", "data"],
   183            [".econst", "code"],
   184            [".const", "code"],
   185            [".stack", "stack"],
   186            [".sysmem", "data"],
   187            [".esysmem", "data"],
   188            [".pinit", "code"],
   189            [".args", "data"],
   190            [".cio", "data"],
   191        ];
   192    
   193        final override readonly config Bool splitMap[string] = [
   194            [".text", true],
   195            [".const", true],
   196            [".econst", true],
   197            [".ebss", true],
   198            [".data", true],
   199            [".switch", true],
   200            [".far", true],
   201            [".args", true],
   202            [".cio", true]
   203        ];
   204    
   205        override readonly config xdc.bld.ITarget.StdTypes stdTypes = {
   206            t_IArg          : { size: 2, align: 2 },
   207            t_Char          : { size: 1, align: 1 },
   208            t_Double        : { size: 2, align: 2 },
   209            t_Float         : { size: 2, align: 2 },
   210            t_Fxn           : { size: 2, align: 1 }, /* near */
   211            t_Int           : { size: 1, align: 1 },
   212            t_Int8          : { size: 1, align: 1 },
   213            t_Int16         : { size: 1, align: 1 },
   214            t_Int32         : { size: 2, align: 2 },
   215            t_Int64         : { size: 4, align: 2 },
   216            t_Long          : { size: 2, align: 2 },
   217            t_LDouble       : { size: 2, align: 2 },
   218            t_LLong         : { size: 4, align: 2 },
   219            t_Ptr           : { size: 1, align: 1 },
   220            t_Short         : { size: 1, align: 1 },
   221            t_Size          : { size: 2, align: 2 },
   222        };
   223    
   224        override readonly config Int bitsPerChar = 16;
   225    }
   226    /*
   227     *  @(#) ti.targets; 1, 0, 3,; 1-17-2020 15:49:10; /db/ztree/library/trees/xdctargets/xdctargets-w07/src/ xlibrary
   228    
   229     */
   230