1    /* 
     2     *  Copyright (c) 2013 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     * */
    12    /*!
    13     *  ======== ITarget ========
    14     *  IAR ARM extension to the base `xdc.bld.ITarget3` interface.
    15     */
    16    @TargetHeader("xdc/bld/stddefs.xdt")
    17    metaonly interface ITarget inherits xdc.bld.ITarget3 {
    18    
    19        override readonly config String rts = "iar.targets.arm.rts";
    20    
    21        override config string stdInclude = "iar/targets/arm/std.h";
    22    
    23        /*
    24         *  ======== binDir ========
    25         *  Code gen tools bin directory path
    26         */
    27        config string binDir = "$(rootDir)/bin/";
    28    
    29        /*!
    30         *  ======== model ========
    31         *  Little endian, thumb2 model
    32         */
    33        override readonly config xdc.bld.ITarget.Model model = {
    34            endian: "little",
    35            codeModel: "thumb2",
    36            shortEnums: true
    37        };
    38    
    39        /*!
    40         *  ======== ccOpts ========
    41         *  User configurable compiler options.
    42         */
    43        override config Options ccOpts = {
    44            prefix: "--silent",
    45            suffix: ""
    46        };
    47    
    48        /*!
    49         *  ======== asmOpts ========
    50         *  User configurable assembler options.
    51         */
    52        override config Options asmOpts = {
    53            prefix: "-S",
    54            suffix: ""
    55        };
    56    
    57        /*!
    58         *  ======== ar ========
    59         *  The command used to create an archive
    60         */
    61        override readonly config Command ar = {
    62            cmd: "iarchive",
    63            opts: ""
    64        };
    65    
    66        /*!
    67         *  ======== arOpts ========
    68         *  User configurable archiver options.
    69         */
    70        override config Options arOpts = {
    71            prefix: "--silent",
    72            suffix: ""
    73        };
    74    
    75        /*!
    76         *  ======== lnkOpts ========
    77         *  User configurable linker options.
    78         */
    79        override config xdc.bld.ITarget2.Options lnkOpts = {
    80            prefix: "--silent",
    81            suffix: "--map $(XDCCFGDIR)/$@.map  --redirect _Printf=_PrintfSmall --redirect _Scanf=_ScanfSmall ",
    82        };
    83    
    84        /*!
    85         *  ======== vers ========
    86         *  The command used to get the tool-chain to return a version number.
    87         */
    88        readonly config Command vers = {
    89            cmd: "iccarm",
    90            opts: "-v"
    91        };
    92    
    93        /*!
    94         *  ======== extension ========
    95         *  The IAR assembly file extension recognised by this target.
    96         */
    97        override config Extension extensions[string] = [
    98            [".asm",  {suf: ".asm", typ: "asm"}],
    99            [".c",    {suf: ".c",   typ: "c"  }],
   100            [".cpp",  {suf: ".cpp", typ: "cpp"}],
   101            [".cxx",  {suf: ".cxx", typ: "cpp"}],
   102            [".C",    {suf: ".C",   typ: "cpp"}],
   103            [".cc",   {suf: ".cc",  typ: "cpp"}],
   104            [".s",    {suf: ".s",   typ: "asm"}],
   105            [".sv7M", {suf: ".sv7M",typ: "asm"}],
   106        ];
   107    
   108        /*!
   109         *  ======== includeOpts ========
   110         *  Additional user configurable target-specific include path options
   111         */
   112        override config String includeOpts = "";
   113    
   114        /*!
   115         *  ======== cmdPrefix ========
   116         *  Prefix to put in front of each command
   117         *
   118         *  This string is put in front of every Command before being passed to
   119         *  the shell for execution.  This string can be used to run the compiler
   120         *  in emulation environments. 
   121         *
   122         *  LC_ALL=C must be set for code gen to run on SUSE
   123         */
   124        config String cmdPrefix = "LC_ALL=C ";
   125    
   126        /*!
   127         *  ======== alignDirectiveSupported ========
   128         *  The compiler supports an align directive.
   129         */
   130        override readonly config Bool alignDirectiveSupported = true;
   131    
   132        /*!
   133         *  ======== stdTypes  ========
   134         *  Size and alignment for standard base types
   135         */
   136        override readonly config xdc.bld.ITarget.StdTypes stdTypes = {
   137            t_IArg          : { size: 4, align: 4 },
   138            t_Char          : { size: 1, align: 1 },
   139            t_Double        : { size: 8, align: 8 },
   140            t_Float         : { size: 4, align: 4 },
   141            t_Fxn           : { size: 4, align: 4 },
   142            t_Int           : { size: 4, align: 4 },
   143            t_Int8          : { size: 1, align: 1 },
   144            t_Int16         : { size: 2, align: 2 },
   145            t_Int32         : { size: 4, align: 4 },
   146            t_Long          : { size: 4, align: 4 },
   147            t_LDouble       : { size: 8, align: 8 },
   148            t_LLong         : { size: 8, align: 8 },
   149            t_Ptr           : { size: 4, align: 4 },
   150            t_Short         : { size: 2, align: 2 },
   151            t_Size          : { size: 4, align: 4 },
   152            t_Int64         : { size: 8, align: 8 },
   153        };
   154    
   155        /*!
   156         *  ======== profiles ========
   157         *  Standard options profiles.
   158         */
   159        override config xdc.bld.ITarget.OptionSet profiles[string] = [
   160            ["debug", {
   161                compileOpts: {
   162                    copts: "--debug --dlib_config $(rootDir)/inc/c/DLib_Config_Normal.h",
   163                },
   164                linkOpts: "--semihosting=iar_breakpoint",
   165            }],
   166            ["release", {
   167                compileOpts: {
   168                    copts: "-Ohs --dlib_config $(rootDir)/inc/c/DLib_Config_Normal.h",
   169                },
   170                linkOpts: "--semihosting=iar_breakpoint",
   171            }],
   172            ["debug_full", {
   173                compileOpts: {
   174                    copts: "--debug --dlib_config $(rootDir)/inc/c/DLib_Config_Full.h",
   175                },
   176                linkOpts: "--semihosting=iar_breakpoint",
   177            }],
   178            ["release_full", {
   179                compileOpts: {
   180                    copts: "-Ohs --dlib_config $(rootDir)/inc/c/DLib_Config_Full.h",
   181                },
   182                linkOpts: "--semihosting=iar_breakpoint",
   183            }],
   184        ];
   185    
   186        override config String binaryParser = "ti.targets.omf.elf.Elf32";
   187    }
   188    /*
   189     *  @(#) iar.targets.arm; 1, 0, 0,0; 6-8-2016 17:06:43; /db/ztree/library/trees/xdctargets/xdctargets-l00/src/ xlibrary
   190    
   191     */
   192