1    /*
     2     * Copyright (c) 2016, Texas Instruments Incorporated
     3     * All rights reserved.
     4     *
     5     * Redistribution and use in source and binary forms, with or without
     6     * modification, are permitted provided that the following conditions
     7     * are met:
     8     *
     9     * *  Redistributions of source code must retain the above copyright
    10     *    notice, this list of conditions and the following disclaimer.
    11     *
    12     * *  Redistributions in binary form must reproduce the above copyright
    13     *    notice, this list of conditions and the following disclaimer in the
    14     *    documentation and/or other materials provided with the distribution.
    15     *
    16     * *  Neither the name of Texas Instruments Incorporated nor the names of
    17     *    its contributors may be used to endorse or promote products derived
    18     *    from this software without specific prior written permission.
    19     *
    20     * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
    21     * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
    22     * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
    23     * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
    24     * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
    25     * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
    26     * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
    27     * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
    28     * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
    29     * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
    30     * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    31     */
    32    
    33    /*
    34     *  ======== Platform.xdc ========
    35     */
    36    package ti.platforms.msp432;
    37    
    38    /*!
    39     *  ======== Platform ========
    40     *  A generic platform that supports any MSP432 device
    41     *
    42     *  The device to be used by this platform is passed as the platform instance
    43     *  name. On the `xdc.tools.configuro` command line, it is done in the
    44     *  following way:
    45     *  @p(code)
    46     *  xs xdc.tools.configuro ... -p "ti.platforms.msp432:MSP432P401R"
    47     *  @p
    48     *
    49     *  In package.bld, the platform instance is selected as in:
    50     *  @p(code)
    51     *  Pkg.addExecutable("test", target, "ti.platforms.msp432:MSP432P401R");
    52     *  @p
    53     *
    54     *  @a(Note)
    55     *  The 'msp432' platform provides support for allowing the user to
    56     *  specify the application's C stack size within their linker command
    57     *  file. If the user sets 'Program.stack = 0' in their configuration
    58     *  file, then it is up to the user to add the necessary content to their
    59     *  linker command file to define the size and placment of the C stack.
    60     *  Additionally, if GNU tools are being used, then the user must define
    61     *  'STACKSIZE' in their linker command file and have its value be the
    62     *  size of the C stack in bytes. The 'STACKSIZE' symbol is used
    63     *  internally to initialize other symbols that must be provided to SYS/BIOS.
    64     */
    65    @Template ("./Platform.xdt")
    66    metaonly module Platform inherits xdc.platform.IPlatform
    67    {
    68        config xdc.platform.IPlatform.Board BOARD = {
    69            id:             "0",
    70            boardName:      "msp432",
    71            boardFamily:    null,
    72            boardRevision:  null
    73        };
    74    
    75        /*!
    76         *  ======== nameFormat ========
    77         *  Encoding of instance creation parameters in the instance's name
    78         *
    79         *  For this platform, the parameters `deviceName`, `includeLinkCmdFile`
    80         *  and `clockRate` can be encoded in the instance name supplied on
    81         *  `xdc.tools.configuro` command line, for example:
    82         *  @p(code)
    83         *      xs xdc.tools.configuro ... -p ti.platforms.msp432:MSP432P401R:1:20
    84         *  @p
    85         *  Optional parameters can be omitted:
    86         *  @p(code)
    87         *      xs xdc.tools.configuro ... -p ti.platforms.msp432:MSP432P401R
    88         *  @p
    89         */
    90         readonly config string nameFormat
    91             = "$(deviceName):$(includeLinkCmdFile):$(clockRate)";
    92    
    93    instance:
    94    
    95        /*
    96         *  This platform supports MSP432 devices with Cortex M4F cores.
    97         *  The corresponding "actual" catalogName is overwritten
    98         *  in Platform.instance$meta$init() based on the device name
    99         */
   100        config xdc.platform.IExeContext.Cpu CPU = {
   101            id:             "0",
   102            clockRate:      1.0,
   103            catalogName:    "ti.catalog.arm.cortexm4",
   104            deviceName:     "MSP432",
   105            revision:       "",
   106        };
   107    
   108        /*!
   109         *  ======== deviceName ========
   110         *  The name of an `ICpuDataSheet` module for the device
   111         *
   112         *  This parameter is required, but it does not have to be set explicitly;
   113         *  it can be encoded in the instance's name.
   114         */
   115        config string deviceName;
   116    
   117        /*!
   118         *  ======== clockRate ========
   119         *  The clock rate for this device.
   120         */
   121        config Double clockRate;
   122    
   123        override config string codeMemory = null;
   124    
   125        override config string dataMemory = null;
   126    
   127        override config string stackMemory = null;
   128    
   129        /*!
   130         *  ======== includeLinkCmdFile ========
   131         *  The flag that specifies if the platform should include a linker command
   132         *  file.
   133         *
   134         *  By default, a user is responsible for adding a linker command file to
   135         *  the project, or to the linker command line. However, if this flag is
   136         *  set, this platform will include a default linker command file for the
   137         *  selected device.
   138         */
   139        config Bool includeLinkCmdFile = false;
   140    };