1    /* 
     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     * */
    12    import xdc.bld.ITarget2;
    13    
    14    /*!
    15     *  ======== M4.xdc ========
    16     *  Embedded Cortex M4, little endian, bare metal target
    17     *
    18     *  This module defines an embedded bare metal target on Cortex M4. The target
    19     *  generates code compatible with the "v7M" architecture.
    20     *
    21     */
    22    metaonly module M4 inherits gnu.targets.ITarget {
    23        override readonly config string name                = "M4"; 
    24        override readonly config string suffix              = "m4g";
    25        override readonly config string isa                 = "v7M4";
    26        override readonly config xdc.bld.ITarget.Model model= {
    27            endian: "little",
    28            codeModel: "thumb2",
    29            shortEnums: true
    30        };
    31    
    32        override readonly config Bool alignDirectiveSupported = true;
    33    
    34        override readonly config string rts = "gnu.targets.arm.rtsv7M";
    35        override config string platform     = "ti.platforms.stellaris:LM4F232H5QD";
    36    
    37        override config string LONGNAME = "bin/arm-none-eabi-gcc";
    38        
    39        override readonly config String stdInclude = "gnu/targets/arm/std.h";
    40    
    41        override readonly config ITarget2.Command cc = {
    42            cmd: "$(rootDir)/$(LONGNAME) -c -MD -MF $@.dep",
    43            opts: "-mcpu=cortex-m4 -mthumb -msoft-float -mabi=aapcs -mapcs"
    44        };
    45    
    46        readonly config ITarget2.Command ccBin = {
    47            cmd: "bin/arm-none-eabi-gcc -c -MD -MF $@.dep",
    48            opts: "-mabi=aapcs -mapcs"
    49        };
    50    
    51        override config ITarget2.Options ccOpts = {
    52            prefix: "-Wunused -Wunknown-pragmas -ffunction-sections -fdata-sections",
    53            suffix: "-Dfar= "
    54        };
    55    
    56        override readonly config ITarget2.Command asm = {
    57            cmd: "$(rootDir)/$(LONGNAME) -c -x assembler-with-cpp",
    58            opts: "-Wa,-mcpu=cortex-m4 -Wa,-mthumb"
    59        };
    60    
    61        readonly config ITarget2.Command asmBin = {
    62            cmd: "bin/arm-none-eabi-gcc -c -x assembler-with-cpp",
    63            opts: "-Wa,-mcpu=cortex-m4 -Wa,-mthumb"
    64        };
    65    
    66        override config ITarget2.Options lnkOpts = {
    67            prefix: "-nostartfiles -Wl,-static -Wl,--gc-sections ",
    68            suffix: "-Wl,-Map=$(XDCCFGDIR)/$@.map -L$(rootDir)/$(GCCTARG)/lib/thumb2 -L$(rootDir)/lib/gcc/$(GCCTARG)/4.5.2/thumb2"
    69        };
    70    
    71        readonly config ITarget2.Command arBin = {
    72            cmd: "bin/arm-none-eabi-ar ",
    73            opts: ""
    74        };
    75    
    76        /*
    77         *  ======== profiles ========
    78         */
    79        override config xdc.bld.ITarget.OptionSet profiles[string] = [
    80            ["debug", {
    81                compileOpts: {
    82                    copts: "-g",
    83                    defs:  "-D_DEBUG_=1",
    84                },
    85                linkOpts: "-g",
    86            }],
    87    
    88            ["release", {
    89                compileOpts: {
    90                    copts: " -O2 ",
    91                },
    92                linkOpts: " ",
    93            }],
    94        ];
    95            
    96        /*
    97         *  ======== compatibleSuffixes ========
    98         */
    99        override config String compatibleSuffixes[] = [];
   100    
   101        override readonly config xdc.bld.ITarget.StdTypes stdTypes = {
   102            t_IArg          : { size: 4, align: 4 },
   103            t_Char          : { size: 1, align: 1 },
   104            t_Double        : { size: 8, align: 4 },
   105            t_Float         : { size: 4, align: 4 },
   106            t_Fxn           : { size: 4, align: 4 },
   107            t_Int           : { size: 4, align: 4 },
   108            t_Int8          : { size: 1, align: 1 },
   109            t_Int16         : { size: 2, align: 2 },
   110            t_Int32         : { size: 4, align: 4 },
   111            t_Int64         : { size: 8, align: 4 },
   112            t_Long          : { size: 4, align: 4 },
   113            t_LDouble       : { size: 8, align: 4 },
   114            t_LLong         : { size: 8, align: 4 },
   115            t_Ptr           : { size: 4, align: 4 },
   116            t_Short         : { size: 2, align: 2 },
   117            t_Size          : { size: 4, align: 4 },
   118        };
   119    }
   120    /*
   121     *  @(#) gnu.targets.arm; 1, 0, 0, 0,427; 9-27-2012 15:05:28; /db/ztree/library/trees/xdctargets/xdctargets-f36x/src/ xlibrary
   122    
   123     */
   124