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     */
    16    
    17    /*!
    18     *  ======== MSP430.xdc ========
    19     *  MSP430 small code, small data model, little endian
    20     *
    21     *  This target corresponds to the TI default runtime model for MSP430 devices.
    22     */
    23    metaonly module MSP430 inherits ti.targets.ITarget {
    24        override readonly config string name    = "MSP430"; 
    25        override readonly config string suffix  = "430";
    26        override readonly config string isa     = "430";    
    27        override readonly config string rts     = "ti.targets.msp430.rts430";
    28        override readonly config xdc.bld.ITarget.Model model = {
    29            endian: "little",
    30            codeModel: "small",
    31            dataModel: "small"
    32        };
    33    
    34        override readonly config string stdInclude = "ti/targets/msp430/std.h";
    35    
    36        override readonly config ti.targets.ITarget.Command ar = {
    37            cmd:  "ar430",
    38            opts: "rq"
    39        };
    40    
    41        override readonly config ti.targets.ITarget.Command cc = {
    42            cmd:  "cl430 -c",
    43            opts: " -vmsp"
    44        };
    45    
    46        override readonly config ti.targets.ITarget.Command vers = {
    47            cmd:  "cl430",
    48            opts: "--compiler_revision"
    49        };
    50    
    51        override readonly config ti.targets.ITarget.Command asm = {
    52            cmd:  "cl430 -c",
    53            opts: " -vmsp"
    54        };
    55    
    56        override readonly config ti.targets.ITarget.Command lnk = {
    57            cmd:  "lnk430",
    58            opts: ""
    59        };
    60    
    61        /*!
    62         *  ======== asmOpts ========
    63         *  User configurable assembler options.
    64         *
    65         *  Defaults:
    66         *  @p(dlist)
    67         *      -`-qq`
    68         *          super quiet mode
    69         */
    70        override config ti.targets.ITarget.Options asmOpts = {
    71            prefix: "-qq",
    72            suffix: ""
    73        };
    74    
    75        /*!
    76         *  ======== ccOpts ========
    77         *  User configurable compiler options.
    78         *
    79         *  Defaults:
    80         *  @p(dlist)
    81         *      -`-qq`
    82         *          super quiet mode
    83         *      -`-pdsw225`
    84         *          generate a warning for implicitly declared functions; i.e.,
    85         *          functions without prototypes
    86         */
    87        override config ti.targets.ITarget.Options ccOpts = {
    88            prefix: "-qq -pdsw225",
    89            suffix: ""
    90        };
    91    
    92        /*!
    93         *  ======== ccConfigOpts ========
    94         *  User configurable compiler options for the generated config C file.
    95         */
    96        override config ti.targets.ITarget.Options ccConfigOpts = {
    97            prefix: "$(ccOpts.prefix)",
    98            suffix: "$(ccOpts.suffix)"
    99        };
   100    
   101        /*!
   102         *  ======== linkLib ========
   103         *  Default MSP430 cgtools runtime library to link with 
   104         *  (options: rts16e.lib, rts32e.lib)
   105         */
   106        config string linkLib = "rts430.lib";
   107        
   108        /*!
   109         *  ======== lnkOpts ========
   110         *  User configurable linker options.
   111         *
   112         *  Defaults:
   113         *  @p(dlist)
   114         *      -`-w`
   115         *          Display linker warnings
   116         *      -`-q`
   117         *          Quite run
   118         *      -`-u`
   119         *          Place unresolved external symbol into symbol table
   120         *      -`-c`
   121         *          ROM autoinitialization model
   122         *      -`-m`
   123         *          create a map file
   124         */
   125        override config ti.targets.ITarget.Options lnkOpts = {
   126            prefix: "-w -q -u _c_int00",
   127            suffix: "-c -m $(XDCCFGDIR)/$@.map " /* + -l $(rootDir)/lib/linkLib */
   128        };
   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: "-g",
   138                    defs:  "-D_DEBUG_=1",
   139                }
   140            }],
   141            ["release", {
   142                compileOpts: {
   143                    copts: "-O2",
   144                },
   145            }],
   146            ["profile", {
   147                compileOpts: {
   148                    copts: "-gp",
   149                },
   150            }],
   151            ["coverage", {
   152                compileOpts: {
   153                    copts: "-gp",
   154                },
   155            }],
   156            ["whole_program", {
   157                compileOpts: {
   158                    copts: "-oe -O2",
   159                },
   160            }],
   161            ["whole_program_debug", {
   162                compileOpts: {
   163                    copts: "-oe --symdebug:dwarf",
   164                },
   165            }],
   166        ];
   167    
   168        override config string includeOpts = "-I$(rootDir)/include ";
   169    
   170        final override readonly config string sectMap[string] = [
   171            [".text", "code"],
   172            [".cinit", "code"],
   173            [".const", "code"],
   174            [".pinit", "code"],
   175    
   176            [".bss", "data"],
   177            [".sysmem", "data"],
   178            [".stack", "stack"],
   179            [".args", "data"],
   180            [".cio", "data"],
   181            [".reset", "data"],
   182        ];
   183    
   184        override readonly config xdc.bld.ITarget.StdTypes stdTypes = {
   185            t_IArg          : { size: 2, align: 2 },
   186            t_Char          : { size: 1, align: 1 },
   187            t_Double        : { size: 4, align: 2 },
   188            t_Float         : { size: 4, align: 2 },
   189            t_Fxn           : { size: 2, align: 2 },
   190            t_Int           : { size: 2, align: 2 },
   191            t_Int8          : { size: 1, align: 1 },
   192            t_Int16         : { size: 2, align: 2 },
   193            t_Int32         : { size: 4, align: 2 },
   194            t_Long          : { size: 4, align: 2 },
   195            t_LDouble       : { size: 4, align: 2 },
   196            t_LLong         : { size: 4, align: 2 },
   197            t_Ptr           : { size: 2, align: 2 },
   198            t_Short         : { size: 2, align: 2 },
   199            t_Size          : { size: 2, align: 2 },
   200        };
   201    };