GEL File

Table of Contents

TI Creating Device Initialization GEL Files PDF

Startup GEL files are used to automate device initialization when Code Composer Studio starts up.

StartUp() Function

The StartUp() GEL function is called by CCStudio whenever the GEL file containing it is loaded.

If you are using a version of CCStudio that supports Connect/Disconnect, no actions that attempt to access the target can be placed here since CCStudio starts disconnected from the target. Place target initialization actions in the OnTargetConnect() callback.

Recommended:

  • Setting up basic CCStudio memory map (that does not need target access to accomplish).
  • Any basic initialization step that does not attempt to access the target. Not Recommended:
  • GELReset()
  • Setting Breakpoints via GELBreakPtAdd(). (This also tries to access the target.)
  • GELTextOut() and GELOpenWindow(). Since StartUp() executes before any CCStudio control window is open, this may cause an error depending on the version of CCStudio.
  • Basically any action that attempts to access the target

Example in evm816x.gel

/*--------------------------------------------------------------*/
/* The StartUp() function is called each time CCS is started. */
/* Customize this function to perform desired initialization */
/* that will not access the target. */
/*--------------------------------------------------------------*/
StartUp( )
{
    Setup_Memory_Map( );
}

OnTargetConnect() Function

the OnTargetConnect() callback was created with the intention that it perform the minimum target initialization needed to access the target regularly (for example, to set PLLs and disable watchdog timers). Its execution finishes before anything else occurs.

Recommended:

  • Absolute minimum target initialization actions to get the target in a reliable state for CCStudio. For example, disabling watchdog timers and pulling the DSP out of reset in heterogeneous environments Not Recommended:
  • Non-critical actions that should not be repeatedly called each time there is a target disconnect and connect.
  • "Custom" non-essential target initialization steps.

In summary, the default OnTargetConnect() function should only call what is necessary. Give users a baseline initialization.

Example in evm816x.gel

/*--------------------------------------------------------------*/
/* OnTargetConnect() is called every time a target is connected.*/
/* Its execution finishes before anything else occurs. Customize*/
/* this function to perform essential target initialization. */
/*--------------------------------------------------------------*/
OnTargetConnect( )
{
    GEL_TextOut( "\EVM816x Startup Sequence\n\n" );

    Setup_PRCM();
    Setup_Power();
    Setup_PADCTRL();
    Setup_MainPLL();
    Setup_DDR();

    GEL_TextOut( "Startup Complete.\n\n" );
}

OnPreFileLoaded() Function

This callback function is called before a program/symbol (.out) file is loaded. This is a good place to perform additional target initialization that needs to be done before the program can be loaded and debugging done.

Example

/*--------------------------------------------------------------*/
/* OnPreFileLoaded() */
/* This function is called automatically when the 'Load Program'*/
/* Menu item is selected. */
/*--------------------------------------------------------------*/
OnPreFileLoaded( )
{
    /*
     *  GEL_Reset() is used to deal with the worst case senario of
     *  unknown target state.  If for some reason a reset is not desired
     *  upon target connection, GEL_Reset() may be removed and replaced
     *  with something "less brutal" like a cache initialization
     *  function.
     */
    GEL_Reset( );
    GEL_TextOut( "GEL Reset\n" );
}

OnFileLoaded() Function

This callback function is called after a program/symbol file has been loaded. Actions such as setting up the debug source search path (if no CCStudio project file exists), setting breakpoints and probepoints, performing a software reset and restart, and loading a saved profile configuration can be done here

OnReset() Function

This callback function is called after the target processor has been reset. If you need to restart the program each time you do a software reset, the GELRestart() call can be made here.

OnRestart() Function

This callback function is called after the program is restarted.

Example

/* ------------------------------------------------------------------------ *
 *  OnRestart( )                                                            *
 *      This function is called by CCS when you do Debug->Restart.          *
 * ------------------------------------------------------------------------ */
OnRestart( int nErrorCode )
{
}

Memory Mapping

The CCStudio memory map tells the debugger which areas of target memory it can and cannot access.

GELMapAdd() Function

This function adds a section of memory to the memory map. You can specify the starting address, length, memory page (program/data/IO), and readable/writeable flags.

GELMapAddStr() Function

GELMapAddStr() is a superset of the GELMapAdd() function. It provides the same readable/writable attributes that can be specified in GELMapAdd(). However, it also supports additional parameters for memory access size, a “shared memory” tag, and specification of memory wait states. With the addition of GELMapAddStr(), there is really no reason to use GELMapAdd(). GELMapAdd() is maintained for compatibility purposes.

  • Example
    /* L3 Memory Map */
       GEL_MapAddStr( 0x00000000, 0, 0x20000000, "R|W|AS4", 0 );  // GPMC
       GEL_MapAddStr( 0x20000000, 0, 0x10000000, "R|W|AS4", 0 );  // PCIe Gen2
    

GELMapDelete() Function

GELMapDelete() allows a portion of the memory map to be removed. This can be useful if it is necessary to have a “dynamic” memory map.

GELMapDelete() accepts only two parameters: address and page. If

GELMapOn() and GELMapOff() Functions

If at some point you need to turn on or off the memory mapping feature, you can do so with the GELMapOn() or GELMapOff() functions.

GELMapReset() Function

GELMapReset() can be used to clear all of the settings in the memory map configuration.

Author: Shi Shougang

Created: 2015-03-05 Thu 23:20

Emacs 24.3.1 (Org mode 8.2.10)

Validate