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.

Notify Assert for MessageQ on AM5728

Other Parts Discussed in Thread: AM5728, SYSBIOS

Starting to implement MessageQ on AM5728 DSP Core running TI-RTOS talking to Linux ARM.

XDCtools:  3.31.2.38

IPC: 3.41.0.08

SYS?BIOS: 6.45.0.19

am57xxPDK: 1.0.1

From previous discussions I know that this configuration behaves different since we are TI-RTOS
talking to Linux.  For example, SharedRegion is not used and IPC_Start is not called.

Instead, IpcMgr_ipcStartup() is called.  Normally this would be called from the .cfg file, like this:

xdc.useModule('ti.ipc.ipcmgr.IpcMgr');

var MultiProc = xdc.useModule('ti.sdo.utils.MultiProc');
MultiProc.setConfig(null, ["HOST", "IPU2", "IPU1", "DSP2", "DSP1"]);

var BIOS        = xdc.useModule('ti.sysbios.BIOS');
BIOS.addUserStartupFunction('&IpcMgr_ipcStartup');

However, as we want to be able to load the same DSP image onto either core, so we will be setting
the Processor ID in runtime later, so I am not calling IpcMgr_ipcStartup in the .cfg file.

Elsewhere in C code I do the following:

    if (corenum == 0) // FIXME Need a global define here
    {
        MultiProc_setLocalId(4); // index into array in .cfg file
    }
    else
    {
        MultiProc_setLocalId(3); // index into array in .cfg file
    }

    IpcMgr_ipcStartup(); // Start IPC now that we have set our ProcId

I think that works okay, but I never get to that code as I am getting an assert before I even get to main().

[      0.000] ti.sdo.ipc.Notify: line 729: assertion failure: A_invalidMultiProcId: Invalid MultiProc id

From what I can tell, Notify is complaining that the MultiprocId is not yet set.  This makes sense since
I have not yet called any of my C code.  The Notify Startup function ti_sdo_ipc_Notify_Module_startup__E
is being called before main() along with all the other module startup functions.

I did see that the setupNotify = false can used with Ipc but I am not using Ipc, I am using IpcMgr. 

Also, I've seen that Notify is Bios only, so I am questioning if Notify should be being used at all. 
I am not explicitly using it. 

Can you help me get past this Assert issue? 

One idea I had was to set a ProcId in the .cfg to DSP1 always, that would make Notify happy, then set it
again later to the correct value, but I am afraid what effect that is going to have on the various modules.

Here is some of my .cfg file for reference.  These line were taken from the DRA7xx Linux DSP example.

/*
 *  ======== IPC Configuration ========
 */
xdc.useModule('ti.ipc.ipcmgr.IpcMgr');


var MultiProc = xdc.useModule('ti.sdo.utils.MultiProc');
MultiProc.setConfig(null, ["HOST", "IPU2", "IPU1", "DSP2", "DSP1"]);

var BIOS        = xdc.useModule('ti.sysbios.BIOS');
/*BIOS.addUserStartupFunction('&IpcMgr_ipcStartup');  Not called here since we are using null above call in PhysicalMsgQ*/

<snipped out other stuff like ECM, Task, etc >

/* create a heap for MessageQ messages */
var HeapBuf = xdc.useModule('ti.sysbios.heaps.HeapBuf');
var params = new HeapBuf.Params;
params.align = 8;
params.blockSize = 512;
params.numBlocks = 256;
var msgHeap = HeapBuf.create(params);

var MessageQ  = xdc.useModule('ti.sdo.ipc.MessageQ');
MessageQ.registerHeapMeta(msgHeap, 0);

/* Setup MessageQ transport */
var VirtioSetup = xdc.useModule('ti.ipc.transports.TransportRpmsgSetup');
MessageQ.SetupTransportProxy = VirtioSetup;

/* Setup NameServer remote proxy */
var NameServer = xdc.useModule("ti.sdo.utils.NameServer");
var NsRemote = xdc.useModule("ti.ipc.namesrv.NameServerRemoteRpmsg");
NameServer.SetupProxy = NsRemote;

  • Hi Chris,

    You seem close.
    What you are trying to do in the C snippet above needs to be called early enough during start up, otherwise you get the behavior you see.
    Here are some suggestions:

    1. Capture the C snippet into some function, say startupHookForSettingProcId, that we will add to an early reset hook. Something like that in your cfg file would do the trick:

    /* register a startup first function*/
    var Startup = xdc.useModule('xdc.runtime.Startup');
    Startup.firstFxns.$add('&_startupHookForSettingProcId');

    2. In your startupHookForSettingProcId function you can refer to DNUM to determine the actual core you are running, so your C snippet can do something like:
    extern volatile cregister UInt DNUM;
    . . .
    if (DNUM== 0) // FIXME Need a global define here
    {
    MultiProc_setLocalId(4); // index into array in .cfg file
    }
    else
    {
    MultiProc_setLocalId(3); // index into array in .cfg file
    }

    3. Finally, you can call the IpcMgr_ipcStartup in your cfg file. That should be safe,

    See if this helps,
    Murat
  • Excellent answer. Implemented in like 5 minutes and it worked. Thanks!

    Not having used Sys/Bios before I'm not familiar with these tools (like firstFxns), so good to learn something too.