1    /*
     2     *  Copyright 2019 by Texas Instruments Incorporated.
     3     *
     4     */
     5    
     6    /*
     7     * Copyright (c) 2017, Texas Instruments Incorporated
     8     * All rights reserved.
     9     *
    10     * Redistribution and use in source and binary forms, with or without
    11     * modification, are permitted provided that the following conditions
    12     * are met:
    13     *
    14     * *  Redistributions of source code must retain the above copyright
    15     *    notice, this list of conditions and the following disclaimer.
    16     *
    17     * *  Redistributions in binary form must reproduce the above copyright
    18     *    notice, this list of conditions and the following disclaimer in the
    19     *    documentation and/or other materials provided with the distribution.
    20     *
    21     * *  Neither the name of Texas Instruments Incorporated nor the names of
    22     *    its contributors may be used to endorse or promote products derived
    23     *    from this software without specific prior written permission.
    24     *
    25     * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
    26     * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
    27     * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
    28     * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
    29     * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
    30     * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
    31     * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
    32     * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
    33     * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
    34     * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
    35     * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    36     */
    37    
    38    import xdc.bld.ITarget2;
    39    
    40    /*!
    41     *  ======== M33F.xdc ========
    42     *  Embedded Cortex M33F, little endian, bare metal target
    43     *
    44     *  This module defines an embedded bare metal target on Cortex M33F. The target
    45     *  generates code compatible with the "v8M" architecture.
    46     *
    47     */
    48    metaonly module M33F inherits IM {
    49        override readonly config string name                = "M33F";       
    50        override readonly config string suffix              = "m33fg";
    51        override readonly config string isa                 = "v8M";
    52        override readonly config string rts         = "gnu.targets.arm.rtsv8M";
    53        override config string platform             = "ti.platforms.cortexM:FVP_MPS2";
    54    
    55        override readonly config ITarget2.Command cc = {
    56            cmd: "$(rootDir)/bin/$(GCCTARG)-gcc -c -MD -MF $@.dep",
    57            opts: "-march=armv8-m.main -mtune=cortex-m33 -mthumb -mfloat-abi=hard -mfpu=fpv5-sp-d16 -mabi=aapcs -g"
    58        };
    59    
    60        readonly config ITarget2.Command ccBin = {
    61            cmd: "bin/arm-none-eabi-gcc -c -MD -MF $@.dep",
    62            opts: "-march=armv8-m.main -mtune=cortex-m33 -mthumb -mfloat-abi=hard -mfpu=fpv5-sp-d16 -mabi=aapcs -g"
    63        };
    64    
    65        override config ITarget2.Options ccOpts = {
    66            prefix: "-Wunused -Wunknown-pragmas -ffunction-sections -fdata-sections ",
    67            suffix: "-Dfar= "
    68        };
    69    
    70        /*!
    71         *  ======== ccConfigOpts ========
    72         *  User configurable compiler options for the generated config C file.
    73         */
    74        override config ITarget2.Options ccConfigOpts = {
    75            prefix: "$(ccOpts.prefix)",
    76            suffix: "$(ccOpts.suffix)"
    77        };
    78    
    79        override config String includeOpts = "-I$(rootDir)/$(GCCTARG)/include/newlib-nano -I$(rootDir)/$(GCCTARG)/include";
    80    
    81        override readonly config ITarget2.Command asm = {
    82            cmd: "$(rootDir)/bin/$(GCCTARG)-gcc -c -x assembler-with-cpp",
    83            opts: "-Wa,-march=armv8-m.main -Wa,-mthumb -Wa,-mfloat-abi=hard -Wa,-mfpu=fpv5-sp-d16 "
    84        };
    85    
    86        readonly config ITarget2.Command asmBin = {
    87            cmd: "bin/arm-none-eabi-gcc -c -x assembler-with-cpp",
    88            opts: "-Wa,-march=armv8-m.main -Wa,-mthumb -Wa,-mfloat-abi=hard -Wa,-mfpu=fpv5-sp-d16 "
    89        };
    90    
    91        override config ITarget2.Options lnkOpts = {
    92            prefix: "-march=armv8-m.main -mtune=cortex-m33 -mthumb -mfloat-abi=hard -mfpu=fpv5-sp-d16 -nostartfiles -Wl,-static -Wl,--gc-sections ",
    93            suffix: "-Wl,--start-group -lgcc -lc -lm -Wl,--end-group --specs=nano.specs -Wl,-Map=$(XDCCFGDIR)/$@.map"
    94        };
    95    
    96        /*!
    97         *  ======== bspLib ========
    98         *  bspLib is assigned the name of the BSP library. The specified library
    99         *  is included on the link line.
   100         *
   101         *  Possible values for this field are "nosys" and "rdimon" with the default
   102         *  being "nosys".
   103         */
   104        override config string bspLib = "nosys";
   105    }
   106    /*
   107     *  @(#) gnu.targets.arm; 1, 0, 0,0; 4-18-2019 17:32:46; /db/ztree/library/trees/xdctargets/xdctargets-t04/src/ xlibrary
   108    
   109     */
   110