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.

CCS/EVMK2GX: Debugging DSP side of Linux-BIOS IPC example

Part Number: EVMK2GX
Other Parts Discussed in Thread: SYSBIOS

Tool/software: Code Composer Studio

EVMK2GX
bios_6_52_00_12
ccsv8
ipc_3_47_01_00
multiprocmgr_3_0_4_0
pdk_k2g_1_0_9
processor_sdk_rtos_k2g_4_03_00_05
ti-cgt-c6000_8.2.2
xdctools_3_50_03_33_core
ti-processor-sdk-linux-k2g-evm-04.03.00.05

I would like to use CCS to debug a TI-RTOS programs on the DSP which is using IPC with a Linux program on the ARM.  To make things simple, I started with the IPC ex02_messageq example which runs fine when I mpmcl load it the DSP and run the host from the linux commandline.  When I load the program through CCS Debug, it fails.  There must be something that mpmcl load/run is doing that I need to replicate in code or a GEL file, but I have no idea what.   Can someone who has this working supply a file?

After starting the debug session, and continuing through main, there's an internal assertion failure
VirtQueue_Instance_init:
            Assert_isTrue(!(marValue & 0x1), NULL);
followed by failure due to VirtQueue having no available buffers.

The CCS Debug console output:
[t=0x000000a4:7ccf2f47] ti.ipc.family.tci6638.VirtQueue: ERROR: line 187: assertion failure
ti.ipc.family.tci6638.VirtQueue: line 187: assertion failure
xdc.runtime.Error.raise: terminating execution
2 Resource entries at 0x800000
[t=0x000000a4:7cd901a5] xdc.runtime.Main: --> main:
registering rpmsg-proto:rpmsg-proto service on 61 with HOST
[t=0x000000a6:4e4818c3] xdc.runtime.Main: NameMap_sendMessage: HOST 53, port=61
[t=0x000000a6:4e4873e8] ti.sysbios.knl.Semaphore: ERROR: line 202: assertion failure: A_badContext: bad calling context. Must be called from a Task.
ti.sysbios.knl.Semaphore: line 202: assertion failure: A_badContext: bad calling context. Must be called from a Task.
xdc.runtime.Error.raise: terminating execution

The stack:

  • xdc_runtime_Assert_raise__I(unsigned short, char *, int, unsigned int)() at Assert.c:36 0x00871410     
  • ti_sysbios_knl_Semaphore_pend__E(struct ti_sysbios_knl_Semaphore_Object *, unsigned int)() at Semaphore.c:208 0x0085F440     
  • RPMessage_send(unsigned short, unsigned int, unsigned int, void *, unsigned short)() at RPMessage.c:569 0x0085FA24     
  • sendMessage$26(char *, char *, unsigned int, enum rpmsg_ns_flags)() at NameMap.c:81 0x0086DC74     
  • NameMap_register(char *, char *, unsigned int)() at NameMap.c:95 0x008738B8     
  • ti_ipc_transports_TransportRpmsg_Instance_init__E(struct ti_ipc_transports_TransportRpmsg_Object *, unsigned short, struct ti_ipc_transports_TransportRpmsg_Params *, struct xdc_runtime_Error_Block *)() at TransportRpmsg.c:114 0x00869224     
  • ti_ipc_transports_TransportRpmsg_create(unsigned short, struct ti_ipc_transports_TransportRpmsg_Params *, struct xdc_runtime_Error_Block *)() at messageq_single_pe66.c:32,025 0x00870660     
  • ti_ipc_transports_TransportRpmsgSetup_attach__E(unsigned short, void *)() at TransportRpmsgSetup.c:72 0x0086DE96     
  • IpcMgr_ipcStartup() at IpcMgr.c:96 0x0086A660     
  • ti_sysbios_BIOS_startFunc__I() at messageq_single_pe66.c:4,450 0x00873EBC     
  • ti_sysbios_BIOS_start__E() at BIOS.c:115 0x00877118     


The problem seems to be that VirtQueue has no available buffers, so RPMessage blocks, which is not allowed inside BIOS_start.
ti/ipc/rpmsg/RPMessage.c:
Int RPMessage_send(...)

        do {
            token = VirtQueue_getAvailBuf(transport.virtQueue_toHost,
                    (Void **)&msg, &length);
        } while (token < 0 && Semaphore_pend(transport.semHandle_toHost,
                                             BIOS_WAIT_FOREVER));


ti/ipc/family/tci6638/VirtQueue.c:
Int16 VirtQueue_getAvailBuf(VirtQueue_Handle vq, Void **buf, Int *len)

    /* There's nothing available? */
    if (vq->last_avail_idx == vring->avail->idx) {
        head = (-1);
    }

  • Hi,

    I've notified the IPC experts. They will post their feedback directly here.

    Best Regards,
    Yordan
  • Hi Elron,

    When the DSP image is loaded from Linux, the Linux kernel remoteProc framework parses the system resources defined in the DSP's resource table, and allocates rpmsg vring buffers and trace buffer, and configures the DSP MMU. If you load the DSP image with CCS JTAG connection, this step will be skipped.

    In order to debug the DSP core using CCS, you first need to load the DSP image from Linux and then connect to the DSP and load only the symbols (and don't connect to the ARM).

    You may need to set a while loop so that you can attach before a certain spot in your code. For example, if you add the following to your code,

    {
    
    volatile int foo = 1;
    
    while(foo);
    
    }

    you can then connect to the core, load the symbols, add breakpoints, change "foo" to 0, and continue stepping through the code.

    The following app note details this method along with some other debugging techniques that you may be interested in.

    Debugging Tools and Techniques With IPC3.x