1    /* --COPYRIGHT--,EPL
     2     *  Copyright (c) 2012 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     *  ======== MSP430X_small ========
    14     *  IAR MSP430X little endian, large code model, small data model target.
    15     */
    16    
    17    metaonly module MSP430X_small inherits ITarget
    18    {
    19        override readonly config String name             = "MSP430X_small";
    20        override readonly config String suffix           = "r430XS";
    21        override readonly config String isa              = "430X";    
    22        override readonly config xdc.bld.ITarget.Model model = {
    23            endian: "little",
    24            codeModel: "large",
    25            dataModel: "small"
    26        };
    27    
    28        /*!
    29         *  ======== cc ========
    30         *  The command used to compile C/C++ source files into object files
    31         *
    32         *  Defaults:
    33         *  @p(dlist)
    34         *      -`-e`
    35         *          enable compiler extensions so it's possible to get segment
    36         *          start addresses in C, via:
    37         *          @p(code)
    38         *              #pragma segment = "CSTACK"
    39         *              isrStack = __segment_begin("CSTACK");
    40         *          @p
    41         *      -`--core=430X`
    42         *          MSP430X architecture     
    43         *      -`--data_model`
    44         *          Small data model for MSP430X architecture     
    45         *      -`--save_reg20`
    46         *          All 20 bits of registers are preserved in all interrupt functions    
    47         *  @p
    48         */
    49        override readonly config Command cc = {
    50            cmd: "icc430",
    51            opts: "-e --core=430X --data_model=small --save_reg20"
    52        };
    53       
    54        /*!
    55         *  ======== asm ========
    56         *  The command used to assembles assembly source files into object files
    57         *
    58         *  Defaults:
    59         *  @p(dlist)
    60         *      -`-v1`
    61         *          MSP430X architecture
    62         *      -`-D__SMALL_DATA_MODEL__`
    63         *          indicate that this is small model to assembly code; IAR does
    64         *          currently have any pre-defined macros for this purpose; we use
    65         *          this symbol because it is the same as that used by the TI
    66         *          compiler (so some degree of portability is possible).
    67         *  @p
    68         */
    69        override readonly config Command asm = {
    70            cmd: "a430",
    71            opts: "-v1 -D__SMALL_DATA_MODEL__"
    72        };
    73    
    74        /*!
    75         *  ======== profiles ========
    76         *  Standard options profiles for the IAR MSP430 tool-chain.
    77         */
    78        override config xdc.bld.ITarget.OptionSet profiles[string] = [
    79            ["debug", {
    80                compileOpts: {
    81                    copts: "-r --dlib_config $(rootDir)/lib/dlib/dl430xsfn.h",
    82                },
    83                linkOpts: "$(rootDir)/lib/dlib/dl430xsfn.r43",
    84            }],
    85            ["release", {
    86                compileOpts: {
    87                    copts: "-Om --dlib_config $(rootDir)/lib/dlib/dl430xsfn.h",
    88                },
    89                linkOpts: "$(rootDir)/lib/dlib/dl430xsfn.r43",
    90            }],
    91            ["debug_full", {
    92                compileOpts: {
    93                    copts: "-r --dlib_config $(rootDir)/lib/dlib/dl430xsff.h",
    94                },
    95                linkOpts: "$(rootDir)/lib/dlib/dl430xsff.r43",
    96            }],
    97            ["release_full", {
    98                compileOpts: {
    99                    copts: "-Om --dlib_config $(rootDir)/lib/dlib/dl430xsff.h",
   100                },
   101                linkOpts: "$(rootDir)/lib/dlib/dl430xsff.r43",
   102            }],
   103        ];
   104    
   105        override readonly config xdc.bld.ITarget.StdTypes stdTypes = {
   106            t_IArg          : { size: 4, align: 2 },
   107            t_Char          : { size: 1, align: 1 },
   108            t_Double        : { size: 4, align: 2 },
   109            t_Float         : { size: 4, align: 2 },
   110            t_Fxn           : { size: 4, align: 2 },
   111            t_Int           : { size: 2, align: 2 },
   112            t_Int8          : { size: 1, align: 1 },
   113            t_Int16         : { size: 2, align: 2 },
   114            t_Int32         : { size: 4, align: 2 },
   115            t_Long          : { size: 4, align: 2 },
   116            t_LDouble       : { size: 4, align: 2 },
   117            t_LLong         : { size: 8, align: 2 },
   118            t_Ptr           : { size: 2, align: 2 },
   119            t_Short         : { size: 2, align: 2 },
   120            t_Size          : { size: 2, align: 2 },
   121        };
   122    }