This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

[FAQ] CCS/TDA4VM: How to view c6x trace buffer on Linux?

Part Number: TDA4VM

Tool/software: Code Composer Studio

How to Debug/view the contents of c6x trace buffer in CCS? In the absence of CCS
how to view the trace buffer from Linux side?

  • HI,

    1. A simple way to generate a c6x crash in firmware.
    2. To view the trace buffer using CCS
    3. In the absence of CCS One can use the Linux remoteproc sysfs entries to view the trace buffer contents from A72.

    All the above are answered in the pdf:

    tda4vm-c6x-trace-buffer-issue.pdf


    Patch referenced in the Presentation:

    0001-pdk-packages-ti-drv-ipc-examples-common-src-ipc_util.patch.txt
    From a1c31c0548037a191333b99ed1d79c4e25f76a6a Mon Sep 17 00:00:00 2001
    From: Angela Stegmaier <angelabaker@ti.com>
    Date: Sun, 9 Aug 2020 09:57:36 +0530
    Subject: [PATCH] pdk: packages: ti: drv: ipc: examples: common: src:
     ipc_utils: Cachewb the trace buffer upon a crash
    
    Currently the c6x firmware trace buffer is not written back to DDR after a crash/exception.
    This avoids A72/Linux viewing the crash dump. Fix this.
    
    Signed-off-by: Angela Stegmaier <angelabaker@ti.com>
    Signed-off-by: Keerthy <j-keerthy@ti.com>
    ---
     .../ti/drv/ipc/examples/common/j721e/ipc_override.cfg     | 3 +++
     packages/ti/drv/ipc/examples/common/src/ipc_utils.c       | 8 ++++++++
     packages/ti/drv/ipc/examples/common/src/ipc_utils.h       | 1 +
     3 files changed, 12 insertions(+)
    
    diff --git a/packages/ti/drv/ipc/examples/common/j721e/ipc_override.cfg b/packages/ti/drv/ipc/examples/common/j721e/ipc_override.cfg
    index 60b7e173..0974da04 100644
    --- a/packages/ti/drv/ipc/examples/common/j721e/ipc_override.cfg
    +++ b/packages/ti/drv/ipc/examples/common/j721e/ipc_override.cfg
    @@ -68,6 +68,9 @@ if(coreId=="c66xdsp_1" || coreId=="c66xdsp_2")
     {
         /* TraceBuf Idle Function */
         Idle.addFunc('&traceBuf_cacheWb');
    +
    +    var Exception = xdc.useModule('ti.sysbios.family.c64p.Exception');
    +    Exception.exceptionHook = '&traceBuf_cacheWb_Exception';
     }
     
     /* Set ipc/VRing buffer as uncached */
    diff --git a/packages/ti/drv/ipc/examples/common/src/ipc_utils.c b/packages/ti/drv/ipc/examples/common/src/ipc_utils.c
    index 03d189ad..be4fc2c5 100644
    --- a/packages/ti/drv/ipc/examples/common/src/ipc_utils.c
    +++ b/packages/ti/drv/ipc/examples/common/src/ipc_utils.c
    @@ -114,3 +114,11 @@ Void traceBuf_cacheWb()
             }
         }
     }
    +
    +Void traceBuf_cacheWb_Exception()
    +{
    +    uint8_t *traceBufAddr = 0;
    +
    +    traceBufAddr = Ipc_getResourceTraceBufPtr();
    +    CacheP_wb((const void *)traceBufAddr, 0x80000);
    +}
    diff --git a/packages/ti/drv/ipc/examples/common/src/ipc_utils.h b/packages/ti/drv/ipc/examples/common/src/ipc_utils.h
    index 0d96062f..27d94f71 100644
    --- a/packages/ti/drv/ipc/examples/common/src/ipc_utils.h
    +++ b/packages/ti/drv/ipc/examples/common/src/ipc_utils.h
    @@ -47,6 +47,7 @@ extern "C" {
     void SetManualBreak();
     void sysIdleLoop(void);
     void traceBuf_cacheWb(void);
    +Void traceBuf_cacheWb_Exception();
     
     #ifdef __cplusplus
     }
    -- 
    2.17.1
    
    

    Crash.txt referenced in the pdf:

    3240.crash.txt
    File: pdk_jacinto_07_00_00/packages/ti/drv/ipc/examples/common/src/ipc_testsetup.c
    
    Function:Ipc_echo_test
    
    
    int32_t Ipc_echo_test(void)
    {
        uint32_t          t;
        Task_Params       params;
        uint32_t          numProc = gNumRemoteProc;
        Ipc_VirtIoParams  vqParam;
        uint32_t          index = 0;
        void (*func)(void) = NULL; /* Declare a function pointer pointing to NULL */
        func();  /* Call that to crash c6c */
      
    

    Best Regards,
    Keerthy