1    /*
     2     * Copyright (c) 2018-2019, 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     *  ======== Boot.xdc ========
    34     */
    35    
    36    package ti.sysbios.family.arm.f2838x.init;
    37    
    38    import xdc.rov.ViewInfo;
    39    import xdc.runtime.Assert;
    40    
    41    /*!
    42     *  ======== Boot ========
    43     *  TMS320F2838X device Boot Support.
    44     *
    45     *  The Boot module supports boot initialization for the CM core.
    46     *  Two special Boot init functions are created based on the configuration
    47     *  settings for this module.  One function is an xdc.runtime.Reset
    48     *  function (called early at boot prior to cinit processing), and the second
    49     *  function is an xdc.runtime.Startup first function (called before main()).
    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 unless
    55     *  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    module Boot
    61    {
    62        metaonly struct ModuleView {
    63            Bool disableWatchdog;
    64            Bool configureFlashController;
    65            Bool configureFlashWaitStates;
    66            Bool enableFlashProgramCache;
    67            Bool enableFlashDataCache;
    68            Bool pllSourcedINTOSC;
    69            Bool bootFromFlash;
    70        }
    71    
    72        @Facet
    73        metaonly config ViewInfo.Instance rovViewInfo =
    74            ViewInfo.create({
    75                viewMap: [
    76                [
    77                    'Module',
    78                    {
    79                        type: ViewInfo.MODULE,
    80                        viewInitFxn: 'viewInitModule',
    81                        structName: 'ModuleView'
    82                    }
    83                ],
    84                ]
    85            });
    86    
    87        /*!
    88         *  Watchdog disable configuration flag, default is false.
    89         *
    90         *  Set to true to disable the watchdog.
    91         */
    92        metaonly config Bool disableWatchdog = false;
    93    
    94        /*!
    95         *  Flash controller configuration flag, default is true.
    96         *
    97         *  Set to true to enable the configuration of the Flash controller
    98         *  wait states, program and data cache.
    99         */
   100        metaonly config Bool configureFlashController = true;
   101    
   102        /*!
   103         *  Internal OSCCLK configuration flag, default is true.
   104         *
   105         *  Set to true to indicate PLLSYSCLK is derived from either INTOSC1 or
   106         *  or INTOSC2, set to false if PLLSYSCLK is derived from an external
   107         *  crystal (XTAL).
   108         */
   109        metaonly config Bool pllSourcedINTOSC = true;
   110    
   111        /*!
   112         *  Flash controller wait states configuration flag, default is true.
   113         *
   114         *  Set to true to configure the Flash controller wait states.  The number
   115         *  of wait states is computed based upon the CPU frequency.
   116         */
   117        metaonly config Bool configureFlashWaitStates = true;
   118    
   119        /*!
   120         *  Flash controller program cache enable flag, default is true.
   121         *
   122         *  Set to true to enable the Flash controller's program cache.
   123         */
   124        metaonly config Bool enableFlashProgramCache = true;
   125    
   126        /*!
   127         *  Flash controller data cache enable flag, default is true.
   128         *
   129         *  Set to true to enable the Flash controller's data cache.
   130         */
   131        metaonly config Bool enableFlashDataCache = true;
   132    
   133        /*!
   134         *  Boot from Flash flag.  Default is true.
   135         *
   136         *  Set to true to enable booting CM from Flash.
   137         */
   138        metaonly config Bool bootFromFlash = true;
   139    
   140        /*!
   141         *  ======== loadSegment ========
   142         *  Specifies where to load the Flash controller configuration function.
   143         *
   144         *  If 'configureFlashController' is true, then this parameter
   145         *  determines where the ".ti_sysbios_family_arm_f2838x_init_flashfuncs"
   146         *  section gets loaded.
   147         */
   148        metaonly config String loadSegment;
   149    
   150        /*!
   151         *  ======== runSegment ========
   152         *  Specifies where to run the Flash controller configuration function.
   153         *
   154         *  If 'configureFlashController' is true then this parameter
   155         *  determines where the ".ti_sysbios_family_arm_f2838x_init_flashfuncs"
   156         *  section gets executed at runtime.
   157         */
   158        metaonly config String runSegment;
   159    
   160    internal:
   161    
   162        /* The computed Flash wait states */
   163        metaonly config UInt flashWaitStates;
   164    
   165        /*
   166         *  ======== init ========
   167         *  Generated entry point for Boot initialization.
   168         *
   169         *  Installed as an xdc.runtime.Reset function.
   170         */
   171        Void init();
   172    };