1    /*
     2     * Copyright (c) 2015-2017, 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    package ti.sysbios.rom;
    34    
    35    /*!
    36     *  ======== ROM.xdc ========
    37     *  ROM selection and support module.
    38     *
    39     *  @a(CC26xx Device Users)
    40     *
    41     *  To build a TI-RTOS application utilizing the ROM in a CC26xx device,
    42     *  add these lines to your configuration file:
    43     *
    44     *  @p(code)
    45     *       var ROM = xdc.useModule('ti.sysbios.rom.ROM');
    46     *       ROM.romName = ROM.CC2650;
    47     *  @p
    48     *
    49     *  @a(IAR Workbench Users of CC26xx Devices)
    50     *
    51     *  IAR Workbench users should use the CC2650.icf file provided in the
    52     *  the following directory relative to the BIOS installation:
    53     *  @p(code)
    54     *     ti/sysbios/rom/cortexm/cc26xx/golden/CC26xx/CC2650.icf
    55     *  @p
    56     *
    57     *  If for some reason you must use your own .icf file, then you are
    58     *  required to copy the contiguous block of 131 lines at the end of the
    59     *  above referenced CC2650.icf file starting with:
    60     *  @p(code)
    61     *    place at address mem:0x0000058c {readonly section .const_xdc_runtime_Error_policy__C};
    62     *    place at address mem:0x00000538 {readonly section .const_xdc_runtime_IModule_Interface__BASE__C};
    63     *    ...
    64     *  @p
    65     *  into your .icf file. Failing to do this will result in your application
    66     *  getting stuck in a forever loop at startup.
    67     *
    68     *  @p(html)
    69     *  <br/>
    70     *  <br/>
    71     *  @p
    72     *
    73     *  @a(CC13xx Device Users)
    74     *
    75     *  To build a TI-RTOS application utilizing the ROM in a CC13xx device,
    76     *  add these lines to your configuration file:
    77     *
    78     *  @p(code)
    79     *       var ROM = xdc.useModule('ti.sysbios.rom.ROM');
    80     *       ROM.romName = ROM.CC1350;
    81     *  @p
    82     *
    83     *  @a(IAR Workbench Users of CC13xx Devices)
    84     *
    85     *  IAR Workbench users should use the CC1350.icf file provided in the
    86     *  the following directory relative to the BIOS installation:
    87     *  @p(code)
    88     *     ti/sysbios/rom/cortexm/cc13xx/golden/CC13xx/CC1350.icf
    89     *  @p
    90     *
    91     *  If for some reason you must use your own .icf file, then you are
    92     *  required to copy the contiguous block of 131 lines at the end of the
    93     *  above referenced CC1350.icf file starting with:
    94     *  @p(code)
    95     *    place at address mem:0x00001490 {readonly section .const_xdc_runtime_Error_policy__C};
    96     *    place at address mem:0x0000143c {readonly section .const_xdc_runtime_IModule_Interface__BASE__C};
    97     *    ...
    98     *  @p
    99     *  into your .icf file. Failing to do this will result in your application
   100     *  getting stuck in a forever loop at startup.
   101     */
   102    
   103    @Template('./ROM.xdt')
   104    metaonly module ROM
   105    {
   106        enum RomName {
   107            NO_ROM,         /*! Default for NOT building against a ROM */
   108            CC2650,         /*! Use for all CC26xx devices */
   109            CC2640R2F,      /*! Use for all CC26xx R2 devices */
   110            CC1350,         /*! Use for all CC13xx devices */
   111            F28004x,        /*! Use for all F28004x class devices */
   112            CC2652,         /*! Use for all CC26xx agama devices */
   113            CC2652R2        /*! Use for all CC26xx agama devices */
   114        };
   115    
   116        /*!
   117         *  The name of the device being used.
   118         *  Currently only 'ROM.CC2650' and
   119         *  'ROM.CC1350' are supported.
   120         */
   121        metaonly config RomName romName = NO_ROM;
   122    
   123        /*!  @_nodoc */
   124        metaonly config String configDefs[];
   125    
   126        /*!
   127         *  @_nodoc
   128         *  Defines an array of func pointers to allow
   129         *  indirect access to functions accessed from within ROM code
   130         *  but NOT to be included in the ROM.
   131         *
   132         *  When the ROM is built, functions labels added to the excludedFuncs
   133         *  are -D defined as derefenced function calls.
   134         *
   135         *  When an application is built, the API's corresponding function ptr
   136         *  is populated with the named function addresses.
   137         */
   138        metaonly config String excludedFuncs[];
   139    
   140        /*!  @_nodoc */
   141        metaonly config String generatedFuncs[];
   142    
   143        /*!  @_nodoc */
   144        metaonly config String otherLibs[];
   145    
   146        /*!  @_nodoc */
   147        metaonly config String otherLibIncludes[];
   148    
   149        /*!  @_nodoc */
   150        metaonly config String otherLibFuncs[];
   151    
   152        /*!  @_nodoc */
   153        metaonly config Bool makePatch = false;
   154    
   155        /*!  @_nodoc */
   156        metaonly config Bool groupFuncPtrs = false;
   157    
   158        metaonly config Ptr constStructAddr = null;
   159        metaonly config Ptr dataStructAddr = null;
   160        metaonly config Ptr externFuncStructAddr = null;
   161    
   162        metaonly struct ExFunc {
   163            Bool generated;
   164            String type;
   165            String name;
   166            String args;
   167        };
   168            
   169        metaonly config ExFunc excludeFuncs[];
   170        metaonly config String excludeIncludes[];
   171    
   172        /*!
   173         *  @_nodoc
   174         *  ======== getOtherLibs ========
   175         *  Get the list of "-l lib" 
   176         *  to link rom with.
   177         */
   178        metaonly String getOtherLibs();
   179    
   180        /*!
   181         *  @_nodoc
   182         *  ======== getLibDefs ========
   183         *  Get the compiler -D mappings of the
   184         *  library funcs into function ptrs
   185         */
   186        metaonly String getOtherLibDefs();
   187    
   188        /*!
   189         *  @_nodoc
   190         *  ======== getExternDefs ========
   191         *  Get the compiler -D mappings of the
   192         *  extern funcs into function ptrs
   193         */
   194        metaonly String getExternDefs();
   195    
   196        /*!
   197         *  @_nodoc
   198         *  ======== getGeneratedDefs ========
   199         *  Get the compiler -D mappings of the
   200         *  generated funcs into function ptrs
   201         */
   202        metaonly String getGeneratedDefs();
   203    
   204        /*!
   205         *  @_nodoc
   206         *  ======== getConfigDefs ========
   207         *  Get the list of module configuration -D's
   208         */
   209        metaonly String getConfigDefs();
   210    
   211        /*!
   212         *  @_nodoc
   213         *  ======== getExterns ========
   214         *  Get the list of externally referenced symbols
   215         */
   216        metaonly String getExterns();
   217    
   218    
   219        /*!
   220         *  @_nodoc
   221         *  ======== makeExternsFile ========
   222         *  Creates a file of name 'fileName' that includes the list of funcs
   223         *  defined in the excludedFuncs[] array.
   224         */
   225        function makeExternsFile(fileName);
   226    }