1    /*
     2     * Copyright (c) 2015, 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     *  ======== Boot.xdc ========
    35     */
    36    
    37    package ti.catalog.msp430.init;
    38    
    39    import xdc.rov.ViewInfo;
    40    
    41    /*!
    42     *  ======== Boot ========
    43     *  Boot time initialization code manager
    44     *
    45     *  The Boot module supports boot initialization for the MSP430 devices.
    46     *  A special boot init function is created based on the configuration
    47     *  settings for this module.  This function is hooked into the
    48     *  `{@link xdc.runtime.Reset#fxns xdc.runtime.Reset.fxns[]}` array and
    49     *  is called very early at boot time (prior to C runtime initialization).
    50     *
    51     *  The code to support the boot module is placed in a separate section
    52     *  named `".text:bootCodeSection"` to allow placement of this section in
    53     *  the linker .cmd file if necessary. This section is a subsection of the
    54     *  `".text"` section so this code will be placed into the .text section
    55     *  unless explicitly placed, either through
    56     *  `{@link xdc.cfg.Program#sectMap Program.sectMap}` or through a linker
    57     *  command file.
    58     */
    59    @Template("./Boot.xdt")
    60    metaonly module Boot
    61    {
    62        metaonly struct ModuleView {
    63            Bool         disableWatchdog;
    64            UInt         watchdogAddress;
    65            Bool         configureDCO;
    66            Bool         useLFXT;
    67        }
    68    
    69        @Facet
    70        metaonly config ViewInfo.Instance rovViewInfo =
    71            ViewInfo.create({
    72                viewMap: [
    73                [
    74                    'Module',
    75                    {
    76                        type: ViewInfo.MODULE,
    77                        viewInitFxn: 'viewInitModule',
    78                        structName: 'ModuleView'
    79                    }
    80                ],
    81                ]
    82            });
    83    
    84        /*!
    85         *  ======== disableWatchdog ========
    86         *  Watchdog disable flag
    87         *
    88         *  The default is `true`.  Set to `false` to not automatically disable the
    89         *  watchdog timer.
    90         */
    91        config Bool disableWatchdog = true;
    92    
    93        /*!
    94         *  ======== watchdogAddress ========
    95         *  Watchdog control register address
    96         *
    97         *  The default (0x15c) is set for MSP430F54xx and MSP430F552x devices.
    98         *  Change for other devices.
    99         */
   100        config UInt watchdogAddress = 0x15c;
   101    
   102        /*!
   103         *  ======== configureDCO ========
   104         *  Configure DCO flag
   105         *
   106         *  The default is `false`.  Set to `true` to initialize the DCO at boot.
   107         *
   108         */
   109        config Bool configureDCO = false;
   110    
   111        /*!
   112         *  ======== useLFXT ========
   113         *  Use a low frequency crystal (LFXT) reference
   114         *
   115         *  The default is `false`.  Set to `true` to indicate a 32768Hz low
   116         *  frequency crystal is present, and available for configuring the clock
   117         *  system.
   118         *
   119         *  This configuration parameter is utilized for only a subset of MSP430
   120         *  device types, and only when `configureDCO` is set to `true`.
   121         *
   122         *  For FR58xx/FR59xx devices: if `useLFXT` is set to `true`, an LFXT
   123         *  will be used as reference, for generating more accurate clock
   124         *  frequencies.  Othewise, and by default, MODOSC will be used as
   125         *  reference.
   126         *
   127         *  For all other MSP430 device types: at present, the `useLFXT` parameter
   128         *  will be ignored, and an internal reference will be used instead.
   129         */
   130        config Bool useLFXT = false;
   131    };