1    /* --COPYRIGHT--,EPL
     2     *  Copyright (c) 2008 Texas Instruments and others.
     3     *  All rights reserved. This program and the accompanying materials
     4     *  are made available under the terms of the Eclipse Public License v1.0
     5     *  which accompanies this distribution, and is available at
     6     *  http://www.eclipse.org/legal/epl-v10.html
     7     * 
     8     *  Contributors:
     9     *      Texas Instruments - initial implementation
    10     * 
    11     * --/COPYRIGHT--*/
    12    
    13    /*!
    14     *  ======== MSP430.xdc ========
    15     *  ELF MSP430 small code, small data model, little endian
    16     *
    17     *  This target corresponds to the TI default runtime model for MSP430 devices.
    18     */
    19    metaonly module MSP430 inherits ti.targets.ITarget {
    20        override readonly config string name    = "MSP430"; 
    21        override readonly config string suffix  = "e430";
    22        override readonly config string isa     = "430";    
    23        override readonly config string rts     = "ti.targets.msp430.rts430";
    24        override readonly config xdc.bld.ITarget.Model model = {
    25            endian: "little",
    26            codeModel: "small",
    27            dataModel: "small"
    28        };
    29    
    30        override readonly config string stdInclude = "ti/targets/msp430/elf/std.h";
    31    
    32        override readonly config ti.targets.ITarget.Command ar = {
    33            cmd:  "ar430",
    34            opts: "rq"
    35        };
    36    
    37        override readonly config ti.targets.ITarget.Command cc = {
    38            cmd:  "cl430 --abi=eabi -c",
    39            opts: " -vmsp"
    40        };
    41    
    42        override readonly config ti.targets.ITarget.Command vers = {
    43            cmd:  "cl430",
    44            opts: "--compiler_revision"
    45        };
    46    
    47        override readonly config ti.targets.ITarget.Command asm = {
    48            cmd:  "cl430 --abi=eabi -c",
    49            opts: " -vmsp"
    50        };
    51    
    52        override readonly config ti.targets.ITarget.Command lnk = {
    53            cmd:  "lnk430",
    54            opts: ""
    55        };
    56    
    57        /*!
    58         *  ======== asmOpts ========
    59         *  User configurable assembler options.
    60         *
    61         *  Defaults:
    62         *  @p(dlist)
    63         *      -`-qq`
    64         *          super quiet mode
    65         */
    66        override config ti.targets.ITarget.Options asmOpts = {
    67            prefix: "-qq",
    68            suffix: ""
    69        };
    70    
    71        /*!
    72         *  ======== ccOpts ========
    73         *  User configurable compiler options.
    74         *
    75         *  Defaults:
    76         *  @p(dlist)
    77         *      -`-qq`
    78         *          super quiet mode
    79         *      -`-pdsw225`
    80         *          generate a warning for implicitly declared functions; i.e.,
    81         *          functions without prototypes
    82         */
    83        override config ti.targets.ITarget.Options ccOpts = {
    84            prefix: "-qq -pdsw225",
    85            suffix: ""
    86        };
    87    
    88        /*!
    89         *  ======== ccConfigOpts ========
    90         *  User configurable compiler options for the generated config C file.
    91         */
    92        override config ti.targets.ITarget.Options ccConfigOpts = {
    93            prefix: "$(ccOpts.prefix)",
    94            suffix: "$(ccOpts.suffix)"
    95        };
    96    
    97        /*!
    98         *  ======== profiles ========
    99         *  Standard options profiles for the TI tool-chain.
   100         */
   101        override config xdc.bld.ITarget.OptionSet profiles[string] = [
   102            ["debug", {
   103                compileOpts: {
   104                    copts: "-g",
   105                    defs:  "-D_DEBUG_=1",
   106                }
   107            }],
   108            ["release", {
   109                compileOpts: {
   110                    copts: "-O2 -g --optimize_with_debug",
   111                },
   112            }],
   113            ["profile", {
   114                compileOpts: {
   115                    copts: "-g",
   116                },
   117            }],
   118            ["coverage", {
   119                compileOpts: {
   120                    copts: "-g",
   121                },
   122            }],
   123            ["whole_program", {
   124                compileOpts: {
   125                    copts: "-oe -O2 -g --optimize_with_debug",
   126                },
   127            }],
   128            ["whole_program_debug", {
   129                compileOpts: {
   130                    copts: "-oe --symdebug:dwarf",
   131                },
   132            }],
   133        ];
   134    
   135        override config string includeOpts = "-I$(rootDir)/include ";
   136    
   137        final override readonly config string sectMap[string] = [
   138            [".text", "code"],
   139            [".cinit", "code"],
   140            [".const", "code"],
   141    
   142            [".init_array", "data"],
   143            [".bss", "data"],
   144            [".data", "data"],
   145            [".sysmem", "data"],
   146            [".stack", "stack"],
   147            [".args", "data"],
   148            [".cio", "data"],
   149            [".reset", "data"],
   150            [".mspabi.extab", "code"],
   151            [".mspabi.exidx", "code"]
   152        ];
   153    
   154        final override readonly config Bool splitMap[string] = [
   155            [".text", true],
   156            [".const", true],
   157            [".data", true],
   158            [".mspabi.extab", true],
   159            [".args", true],
   160            [".cio", true]
   161        ];
   162    
   163        override readonly config xdc.bld.ITarget.StdTypes stdTypes = {
   164            t_IArg          : { size: 2, align: 2 },
   165            t_Char          : { size: 1, align: 1 },
   166            t_Double        : { size: 8, align: 2 },
   167            t_Float         : { size: 4, align: 2 },
   168            t_Fxn           : { size: 2, align: 2 },
   169            t_Int           : { size: 2, align: 2 },
   170            t_Int8          : { size: 1, align: 1 },
   171            t_Int16         : { size: 2, align: 2 },
   172            t_Int32         : { size: 4, align: 2 },
   173            t_Long          : { size: 4, align: 2 },
   174            t_LDouble       : { size: 8, align: 2 },
   175            t_LLong         : { size: 8, align: 2 },
   176            t_Ptr           : { size: 2, align: 2 },
   177            t_Short         : { size: 2, align: 2 },
   178            t_Size          : { size: 2, align: 2 },
   179        };
   180    
   181        override config String binaryParser = "ti.targets.omf.elf.Elf32";
   182    };