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            CC26X2,         /*! Use for all CC26x2 agama devices, OAD supported */
   113            CC13X2,         /*! Use for all CC13x2 agama devices */
   114            CC26X2_NO_OAD,  /*! Use for all CC26x2 agama devices, OAD not supported. */
   115            CC2652R2,       /* Use for all CC26x2 agama devices, OAD not supported */
   116            CC1352,         /* Use for all CC13x2 agama devices */
   117            CC2652          /* Use for all CC26x2 agama devices, OAD supported */
   118        };
   119    
   120        /*!
   121         *  The name of the device being used.
   122         *  Currently only 'ROM.CC2650' and
   123         *  'ROM.CC1350' are supported.
   124         */
   125        metaonly config RomName romName = NO_ROM;
   126    
   127        /*!  @_nodoc */
   128        metaonly config String configDefs[];
   129    
   130        /*!
   131         *  @_nodoc
   132         *  Defines an array of func pointers to allow
   133         *  indirect access to functions accessed from within ROM code
   134         *  but NOT to be included in the ROM.
   135         *
   136         *  When the ROM is built, functions labels added to the excludedFuncs
   137         *  are -D defined as derefenced function calls.
   138         *
   139         *  When an application is built, the API's corresponding function ptr
   140         *  is populated with the named function addresses.
   141         */
   142        metaonly config String excludedFuncs[];
   143    
   144        /*!  @_nodoc */
   145        metaonly config String generatedFuncs[];
   146    
   147        /*!  @_nodoc */
   148        metaonly config String otherLibs[];
   149    
   150        /*!  @_nodoc */
   151        metaonly config String otherLibIncludes[];
   152    
   153        /*!  @_nodoc */
   154        metaonly config String otherLibFuncs[];
   155    
   156        /*!  @_nodoc */
   157        metaonly config Bool makePatch = false;
   158    
   159        /*!  @_nodoc */
   160        metaonly config Bool groupFuncPtrs = false;
   161    
   162        metaonly config Ptr constStructAddr = null;
   163        metaonly config Ptr dataStructAddr = null;
   164        metaonly config Ptr externFuncStructAddr = null;
   165    
   166        metaonly struct ExFunc {
   167            Bool generated;
   168            String type;
   169            String name;
   170            String args;
   171        };
   172            
   173        metaonly config ExFunc excludeFuncs[];
   174        metaonly config String excludeIncludes[];
   175    
   176        /*!
   177         *  @_nodoc
   178         *  ======== getOtherLibs ========
   179         *  Get the list of "-l lib" 
   180         *  to link rom with.
   181         */
   182        metaonly String getOtherLibs();
   183    
   184        /*!
   185         *  @_nodoc
   186         *  ======== getLibDefs ========
   187         *  Get the compiler -D mappings of the
   188         *  library funcs into function ptrs
   189         */
   190        metaonly String getOtherLibDefs();
   191    
   192        /*!
   193         *  @_nodoc
   194         *  ======== getExternDefs ========
   195         *  Get the compiler -D mappings of the
   196         *  extern funcs into function ptrs
   197         */
   198        metaonly String getExternDefs();
   199    
   200        /*!
   201         *  @_nodoc
   202         *  ======== getGeneratedDefs ========
   203         *  Get the compiler -D mappings of the
   204         *  generated funcs into function ptrs
   205         */
   206        metaonly String getGeneratedDefs();
   207    
   208        /*!
   209         *  @_nodoc
   210         *  ======== getConfigDefs ========
   211         *  Get the list of module configuration -D's
   212         */
   213        metaonly String getConfigDefs();
   214    
   215        /*!
   216         *  @_nodoc
   217         *  ======== getExterns ========
   218         *  Get the list of externally referenced symbols
   219         */
   220        metaonly String getExterns();
   221    
   222    
   223        /*!
   224         *  @_nodoc
   225         *  ======== makeExternsFile ========
   226         *  Creates a file of name 'fileName' that includes the list of funcs
   227         *  defined in the excludedFuncs[] array.
   228         */
   229        function makeExternsFile(fileName);
   230    }