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.

Multiproc_self() always returns 0



Hi,

I am using IPC in a sample project for EVMK2H. But I am experiencing strange behavior of Multiproc_self() function. it always returns 0. My code is as:

/*
 *  ======== taskFxn ========
 */
Void taskFxn(UArg a0, UArg a1)
{

    UInt16 coreID = MultiProc_self();

    	System_printf("enter taskFxn() by Core %d\n", coreID);



    System_printf("exit taskFxn()\n");

    System_flush(); /* force SysMin output to console */
}

/*
 *  ======== main ========
 */
Int main()
{ 
    Task_Handle task;
    Error_Block eb;
    Int status;

    System_printf("enter main()\n");

    Error_init(&eb);
    status = Ipc_start();
    if (status < 0)
    {
        System_abort("Ipc_start failed\n");
    }

    task = Task_create(taskFxn, NULL, &eb);
    if (task == NULL)
    {
        System_printf("Task_create() failed!\n");
        BIOS_exit(0);
    }



    BIOS_start();    /* does not return */
    return(0);
}

when I load .out using linux utility mpmcl on dsp0,dsp1,dsp2,dsp3. I always get coreID = 0

Regards

  • Hi Rao Munzir,
    Have you tried this example through CCS and got the expected COREID no on all the cores?
    processors.wiki.ti.com/.../MultiProc_Module
  • I get right ID using DNUM but why can't I get it right with MultiProc_self();.
  • 
    

    I just checked in my .cfg file. There was issue as I didn't set MultiProc.setConfig(). I set this with syntax

    var Ipc = xdc.useModule('ti.sdo.ipc.Ipc');
    Ipc.procSync = Ipc.ProcSync_ALL;
    Ipc.sr0MemorySetup = true;
    
    var MultiProc = xdc.useModule('ti.sdo.utils.MultiProc');
    var procNameAry = [ "CORE0", "CORE1", "CORE2", "CORE3", "CORE4", "CORE5",
            "CORE6", "CORE7","HOST" ];
    MultiProc.setConfig(null, procNameAry);

    But after doing that Ipc_start() hangs i.e doesn't return.

    then I removed 

    //Ipc.procSync = Ipc.ProcSync_ALL;


    after that I get  VirtQueue_init(): MultiProc_self already set!. Even Main is not executed

  • Rao,

    In the cfg file, add appropriate modules to use the function, Multiproc_self() below.

    I have tested this function independently in using one of the K2H examples and able to get the core ID promptly.

    In *.cfg
    ================================
    /* IPC */
    var MultiProc = xdc.useModule('ti.sdo.utils.MultiProc');
    xdc.useModule('ti.sdo.ipc.Ipc');

    MultiProc.setConfig(null, ["CORE0", "CORE1", "CORE2", "CORE3",
    "CORE4", "CORE5", "CORE6", "CORE7"]);

    ================================
    In app.c

    int main(void)
    {
    uint16_t CoreID = 0;

    CoreID = MultiProc_self();
    printf("CoreID is %d\n",CoreID);

    /* Start BIOS */
    BIOS_start();
    return (0);
    }