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            [".sv8M", {suf: ".sv8M",typ: "asm"}],
   107        ];
   108    
   109        /*!
   110         *  ======== includeOpts ========
   111         *  Additional user configurable target-specific include path options
   112         */
   113        override config String includeOpts = "";
   114    
   115        /*!
   116         *  ======== cmdPrefix ========
   117         *  Prefix to put in front of each command
   118         *
   119         *  This string is put in front of every Command before being passed to
   120         *  the shell for execution.  This string can be used to run the compiler
   121         *  in emulation environments. 
   122         *
   123         *  LC_ALL=C must be set for code gen to run on SUSE
   124         */
   125        config String cmdPrefix = "LC_ALL=C ";
   126    
   127        /*!
   128         *  ======== alignDirectiveSupported ========
   129         *  The compiler supports an align directive.
   130         */
   131        override readonly config Bool alignDirectiveSupported = true;
   132    
   133        /*!
   134         *  ======== stdTypes  ========
   135         *  Size and alignment for standard base types
   136         */
   137        override readonly config xdc.bld.ITarget.StdTypes stdTypes = {
   138            t_IArg          : { size: 4, align: 4 },
   139            t_Char          : { size: 1, align: 1 },
   140            t_Double        : { size: 8, align: 8 },
   141            t_Float         : { size: 4, align: 4 },
   142            t_Fxn           : { size: 4, align: 4 },
   143            t_Int           : { size: 4, align: 4 },
   144            t_Int8          : { size: 1, align: 1 },
   145            t_Int16         : { size: 2, align: 2 },
   146            t_Int32         : { size: 4, align: 4 },
   147            t_Long          : { size: 4, align: 4 },
   148            t_LDouble       : { size: 8, align: 8 },
   149            t_LLong         : { size: 8, align: 8 },
   150            t_Ptr           : { size: 4, align: 4 },
   151            t_Short         : { size: 2, align: 2 },
   152            t_Size          : { size: 4, align: 4 },
   153            t_Int64         : { size: 8, align: 8 },
   154        };
   155    
   156        /*!
   157         *  ======== profiles ========
   158         *  Standard options profiles.
   159         */
   160        override config xdc.bld.ITarget.OptionSet profiles[string] = [
   161            ["debug", {
   162                compileOpts: {
   163                    copts: "--debug --dlib_config $(rootDir)/inc/c/DLib_Config_Normal.h",
   164                },
   165                linkOpts: "--semihosting=iar_breakpoint",
   166            }],
   167            ["release", {
   168                compileOpts: {
   169                    copts: "-Ohs --dlib_config $(rootDir)/inc/c/DLib_Config_Normal.h",
   170                },
   171                linkOpts: "--semihosting=iar_breakpoint",
   172            }],
   173            ["debug_full", {
   174                compileOpts: {
   175                    copts: "--debug --dlib_config $(rootDir)/inc/c/DLib_Config_Full.h",
   176                },
   177                linkOpts: "--semihosting=iar_breakpoint",
   178            }],
   179            ["release_full", {
   180                compileOpts: {
   181                    copts: "-Ohs --dlib_config $(rootDir)/inc/c/DLib_Config_Full.h",
   182                },
   183                linkOpts: "--semihosting=iar_breakpoint",
   184            }],
   185        ];
   186    
   187        override config String binaryParser = "ti.targets.omf.elf.Elf32";
   188    }
   189    /*
   190     *  @(#) iar.targets.arm; 1, 0, 0,0; 4-18-2019 17:32:50; /db/ztree/library/trees/xdctargets/xdctargets-t04/src/ xlibrary
   191    
   192     */
   193