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     *  ======== M4F.xdc ========
    16     *  Embedded Cortex M4F, little endian, bare metal target
    17     *
    18     *  This module defines an embedded bare metal target on Cortex M4F. The target
    19     *  generates code compatible with the "v7M" architecture.
    20     *
    21     */
    22    metaonly module M4F inherits gnu.targets.ITarget {
    23        override readonly config string name                = "M4F";        
    24        override readonly config string suffix              = "m4fg";
    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 -mhard-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    
    57        override readonly config ITarget2.Command asm = {
    58            cmd: "$(rootDir)/$(LONGNAME) -c -x assembler-with-cpp",
    59            opts: "-Wa,-mcpu=cortex-m4 -Wa,-mthumb"
    60        };
    61    
    62        readonly config ITarget2.Command asmBin = {
    63            cmd: "bin/arm-none-eabi-gcc -c -x assembler-with-cpp",
    64            opts: "-Wa,-mcpu=cortex-m4 -Wa,-mthumb"
    65        };
    66    
    67        override config ITarget2.Options lnkOpts = {
    68            prefix: "-nostartfiles -Wl,-static -Wl,--gc-sections ",
    69            suffix: "-Wl,-Map=$(XDCCFGDIR)/$@.map -L$(rootDir)/$(GCCTARG)/lib/thumb2 -L$(rootDir)/lib/gcc/$(GCCTARG)/4.5.2/thumb2"
    70        };
    71    
    72        readonly config ITarget2.Command arBin = {
    73            cmd: "bin/arm-none-eabi-ar ",
    74            opts: ""
    75        };
    76    
    77        /*
    78         *  ======== profiles ========
    79         */
    80        override config xdc.bld.ITarget.OptionSet profiles[string] = [
    81            ["debug", {
    82                compileOpts: {
    83                    copts: "-g",
    84                    defs:  "-D_DEBUG_=1",
    85                },
    86                linkOpts: "-g",
    87            }],
    88    
    89            ["release", {
    90                compileOpts: {
    91                    copts: " -O2 ",
    92                },
    93                linkOpts: " ",
    94            }],
    95        ];
    96            
    97        /*
    98         *  ======== compatibleSuffixes ========
    99         */
   100        override config String compatibleSuffixes[] = [];
   101    
   102        override readonly config xdc.bld.ITarget.StdTypes stdTypes = {
   103            t_IArg          : { size: 4, align: 4 },
   104            t_Char          : { size: 1, align: 1 },
   105            t_Double        : { size: 8, align: 4 },
   106            t_Float         : { size: 4, align: 4 },
   107            t_Fxn           : { size: 4, align: 4 },
   108            t_Int           : { size: 4, align: 4 },
   109            t_Int8          : { size: 1, align: 1 },
   110            t_Int16         : { size: 2, align: 2 },
   111            t_Int32         : { size: 4, align: 4 },
   112            t_Int64         : { size: 8, align: 4 },
   113            t_Long          : { size: 4, align: 4 },
   114            t_LDouble       : { size: 8, align: 4 },
   115            t_LLong         : { size: 8, align: 4 },
   116            t_Ptr           : { size: 4, align: 4 },
   117            t_Short         : { size: 2, align: 2 },
   118            t_Size          : { size: 4, align: 4 },
   119        };
   120    }
   121    /*
   122     *  @(#) gnu.targets.arm; 1, 0, 0, 0,324; 11-11-2011 10:33:05; /db/ztree/library/trees/xdctargets/xdctargets-f12x/src/ xlibrary
   123    
   124     */
   125