Enabling trace in DSPLink

From Texas Instruments Embedded Processors Wiki

Jump to: navigation, search

Contents

Overview

In certain kinds of failures seen in applications, sometimes the system just hangs without a kernel crash dump. Or some Operating Systems do not provide such crash dump. In this case, it is useful to enable trace within DSPLink to give information about the APIs and steps that have resulted in the crash/hang.

Enabling trace

Run the dsplinkcfg static build configuration script to enable trace

      ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
                 DSP/BIOS(TM) LINK  Configuration Tool
      ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

      Enable debug trace?

      0.   No

      1.   Yes

      ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

      YOUR CHOICE : 1

With this step, trace is enabled.

Disabling trace for user-level prints (from API module)

User-level print levels cannot be controlled, and hence all user-level prints are automatically enabled. Sometimes this gives too many prints, and it is difficult to identify the exact failures. Also, if user and kernel-level prints are sent to the same console, they most often do not come in order, and it is difficult to identify the exact control flow. In such situations, it may be desirable to disable the user-level prints.

To disable the user-level prints, take the following steps: File: ${DSPLINK}/gpp/src/osal/print.h

Existing code:

#if defined (TRACE_USER)
/*  ----------------------------------------------------------------------------
 *  Extern declaration for printf to avoid compiler warning.
 *  ----------------------------------------------------------------------------
 */
extern int printf (const char * format, ...) ;
#define PRINT_Printf printf
#endif

Change to:

#if defined (TRACE_USER)
/*  ----------------------------------------------------------------------------
 *  Extern declaration for printf to avoid compiler warning.
 *  ----------------------------------------------------------------------------
 */
extern int printf (const char * format, ...) ;
#define PRINT_Printf(...)
#endif

This disables all user-level prints, so that only special focused kernel level prints can be logged as desired.

Enabling kernel-level prints

To enable kernel level prints, following additional steps are needed:
File: ${DSPLINK}/gpp/src/pmgr/${GPPOS}/${GPPOSVERSION}/drv_pmgr.c
For example: ${DSPLINK}/gpp/src/pmgr/Linux/2.6/drv_pmgr.c
OR
${DSPLINK}/gpp/src/pmgr/PrOS/drv_pmgr.c
Function: DRV_InitializeModule() (for Linux) OR DRV_PMGR_Initialize() (for PrOS)
Several component trace enables are available but commented out in this function. Enable trace prints for required components by uncommenting specific TRC_ENABLE calls.
Refer to file ${DSPLINK}/gpp/inc/_signature.h for component and sub-component ID definitions.
For example, to enable trace for selective LDRV subcomponents, uncomment some of the following lines as required:

/* TRC_ENABLE (ID_LDRV)            ; */
/* TRC_ENABLE (ID_LDRV_PROC)       ; */
/* TRC_ENABLE (ID_LDRV_CHNL)       ; */
/* TRC_ENABLE (ID_LDRV_MSGQ)       ; */
/* TRC_ENABLE (ID_LDRV_CHIRPS)     ; */
/* TRC_ENABLE (ID_LDRV_MPCS)       ; */
/* TRC_ENABLE (ID_LDRV_MPLIST)     ; */
/* TRC_ENABLE (ID_LDRV_RINGIO)     ; */
/* TRC_ENABLE (ID_LDRV_SMM)        ; */
/* TRC_ENABLE (ID_LDRV_DATA_ZCPY)  ; */
/* TRC_ENABLE (ID_LDRV_DRV)        ; */
/* TRC_ENABLE (ID_LDRV_DRV_SHM)    ; */
/* TRC_ENABLE (ID_LDRV_DSP)        ; */
/* TRC_ENABLE (ID_LDRV_HAL_OBJECT) ; */
/* TRC_ENABLE (ID_LDRV_HAL_INTGEN) ; */
/* TRC_ENABLE (ID_LDRV_HAL_PCI)    ; */
/* TRC_ENABLE (ID_LDRV_IPS)        ; */
/* TRC_ENABLE (ID_LDRV_IPS_IPS)    ; */
/* TRC_ENABLE (ID_LDRV_MQT)        ; */
/* TRC_ENABLE (ID_LDRV_MQT_ZCPY)   ; */
/* TRC_ENABLE (ID_LDRV_POOL)       ; */
/* TRC_ENABLE (ID_LDRV_POOL_SMA)   ; */
/* TRC_ENABLE (ID_LDRV_POOL_BUF)   ; */
/* TRC_ENABLE (ID_LDRV_POOL_MPBUF) ; */
  • Set desired trace severity level. For example, if all prints are desired, set severity level as TRC_ENTER (default). If only error and specific prints are desired, for example severity could be set at TRC_LEVEL4:
TRC_SET_SEVERITY (TRC_ENTER) ;
  • Now rebuild DSPLink
  • Rebuild the application
  • Run the application
  • Log the prints
  • Check the log and interpret it to see the cause and backtrace resulting in failure.

For technical support please post your questions at http://e2e.ti.com. Please post only comments about the article Enabling trace in DSPLink here.
Leave a Comment
Personal tools