1    /* --COPYRIGHT--,EPL
     2     *  Copyright (c) 2010 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    import ti.targets.ITarget;
    14    
    15    /*!
    16     *  ======== MSP430X.xdc ========
    17     *  MSP430X large code, restricted data model, little endian
    18     */
    19    metaonly module MSP430X inherits ITarget {
    20        override readonly config string name    = "MSP430X"; 
    21        override readonly config string suffix  = "430X";
    22        override readonly config string isa     = "430X";    
    23        override readonly config string rts     = "ti.targets.msp430.rts430";
    24        override readonly config xdc.bld.ITarget.Model model = {
    25            endian: "little",
    26            codeModel: "large",
    27            dataModel: "restricted"
    28        };
    29    
    30        override readonly config string stdInclude = "ti/targets/msp430/std.h";
    31    
    32        override readonly config ITarget.Command ar = {
    33            cmd:  "ar430",
    34            opts: "rq"
    35        };
    36    
    37        override readonly config ITarget.Command cc = {
    38            cmd:  "cl430 -c",
    39            opts: " -vmspx --near_data=none --code_model=large --data_model=restricted"
    40        };
    41    
    42        override readonly config ITarget.Command vers = {
    43            cmd:  "cl430",
    44            opts: "--compiler_revision"
    45        };
    46    
    47        override readonly config ITarget.Command asm = {
    48            cmd:  "cl430 -c",
    49            opts: " -vmspx --near_data=none --code_model=large --data_model=restricted"
    50        };
    51    
    52        override readonly config 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 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 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 ITarget.Options ccConfigOpts = {
    93            prefix: "$(ccOpts.prefix)",
    94            suffix: "$(ccOpts.suffix)"
    95        };
    96    
    97        /*!
    98         *  ======== linkLib ========
    99         *  Default MSP430 cgtools runtime library to link with 
   100         *  (options: rts16e.lib, rts32e.lib)
   101         */
   102        config string linkLib = "libc.a";
   103        
   104        /*!
   105         *  ======== lnkOpts ========
   106         *  User configurable linker options.
   107         *
   108         *  Defaults:
   109         *  @p(dlist)
   110         *      -`-w`
   111         *          Display linker warnings
   112         *      -`-q`
   113         *          Quite run
   114         *      -`-u`
   115         *          Place unresolved external symbol into symbol table
   116         *      -`-c`
   117         *          ROM autoinitialization model
   118         *      -`-m`
   119         *          create a map file
   120         */
   121        override config ITarget.Options lnkOpts = {
   122            prefix: "-w -q -u _c_int00",
   123            suffix: "-c -m $(XDCCFGDIR)/$@.map " /* + -l $(rootDir)/lib/linkLib */
   124        };
   125    
   126        /*!
   127         *  ======== profiles ========
   128         *  Standard options profiles for the TI tool-chain.
   129         */
   130        override config xdc.bld.ITarget.OptionSet profiles[string] = [
   131            ["debug", {
   132                compileOpts: {
   133                    copts: "-g",
   134                    defs:  "-D_DEBUG_=1",
   135                }
   136            }],
   137            ["release", {
   138                compileOpts: {
   139                    copts: "-O2",
   140                },
   141            }],
   142            ["profile", {
   143                compileOpts: {
   144                    copts: "-gp",
   145                },
   146            }],
   147            ["coverage", {
   148                compileOpts: {
   149                    copts: "-gp",
   150                },
   151            }],
   152            ["whole_program", {
   153                compileOpts: {
   154                    copts: "-oe -O2",
   155                },
   156            }],
   157            ["whole_program_debug", {
   158                compileOpts: {
   159                    copts: "-oe --symdebug:dwarf",
   160                },
   161            }],
   162        ];
   163    
   164        override config string includeOpts = "-I$(rootDir)/include ";
   165    
   166        final override readonly config string sectMap[string] = [
   167            [".text", "code"],
   168            [".cinit", "code"],
   169            [".const", "code"],
   170            [".pinit", "code"],
   171    
   172            [".bss", "data"],
   173            [".sysmem", "data"],
   174            [".stack", "stack"],
   175            [".args", "data"],
   176            [".cio", "data"],
   177            [".reset", "data"],
   178        ];
   179    
   180        override readonly config xdc.bld.ITarget.StdTypes stdTypes = {
   181            t_IArg          : { size: 4, align: 2 },
   182            t_Char          : { size: 1, align: 1 },
   183            t_Double        : { size: 4, align: 2 },
   184            t_Float         : { size: 4, align: 2 },
   185            t_Fxn           : { size: 4, align: 2 },
   186            t_Int           : { size: 2, align: 2 },
   187            t_Int8          : { size: 1, align: 1 },
   188            t_Int16         : { size: 2, align: 2 },
   189            t_Int32         : { size: 4, align: 2 },
   190            t_Long          : { size: 4, align: 2 },
   191            t_LDouble       : { size: 4, align: 2 },
   192            t_LLong         : { size: 4, align: 2 },
   193            t_Ptr           : { size: 4, align: 2 },
   194            t_Short         : { size: 2, align: 2 },
   195            t_Size          : { size: 2, align: 2 },
   196        };
   197    };