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