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.

MessageQ Invalid queueId

Other Parts Discussed in Thread: TMS320C6657

Hi,

My platform is TMS320C6657. I try to send message form Core0 to Core1 by MessageQ after Core0 receive data through network. When I run the program, Core0 can open the queue and MessageQ_put is passed, while Core1 abort and print the message:

[C66xx_1] ti.sdo.ipc.MessageQ: line 441: assertion failure: A_invalidQueueId: Invalid queueId is used
xdc.runtime.Error.raise: terminating execution

I get queueId  form "status = MessageQ_open(queueName, &queueId)".

The IPC is 1.24.3.32, the MCSDK is 2.1.2.6, the major code as the follows:

Core0:

Int status;

/* Register this heap with MessageQ */
MessageQ_registerHeap((IHeap_Handle)SharedRegion_getHeap(0), HEAP_ID);

/* Open the 'next' remote message queue. Spin until it is ready. */
do {
status = MessageQ_open(queueName, &queueId);
}
while (status < 0);
printf("queueId = %d\n",queueId);

message = (Message *)MessageQ_alloc(HEAP_ID, sizeof(Message));
if (message == NULL) {
System_abort("MessageQ_alloc failed\n");
}
message->num[1] = i;
status = MessageQ_put(queueId, (MessageQ_Msg)message);
if (status < 0) {
System_abort("MessageQ_put failed\n");
}

Core1:

syncSemHandle = SyncSem_create(NULL, NULL);
MessageQ_Params_init(&messageQParams);
messageQParams.synchronizer = SyncSem_Handle_upCast(syncSemHandle);

/* Create a message queue. */
messageQ = MessageQ_create(queueName, &messageQParams);
if (messageQ == NULL) {
System_abort("MessageQ_create failed\n" );
}
Int status;

int i;

/* Get a message */

status = MessageQ_get(messageQ, (MessageQ_Msg *)&message, MessageQ_FOREVER);
if (status < 0) {
System_abort("MessageQ_get failed\n");
}

i = message->num[1];
// free the Message.
MessageQ_free((MessageQ_Msg)message);

Do I miss something?

  • Hi,

    I see nothing wrong, but if you look at line 441 of MessageQ.c you see that this comes from a MessageQ_put, can you show where you do this in core 1? Also, check the value of queueId used in MessageQ_put in core1, if it's the first queue created in core0 it should be 0.

    Regards

    J

  • Dear Johannes,

    Actually I have no  MessageQ_put in Core1. I can show you my code.

    Core0 main.c:2402.main.c

    Core0 .cfg:0160.client.cfg

    Core1 main.c:4606.main.c

    Core1 .cfg:1680.bench_qmss.cfg

  • Dear Johannes,

    This is my whole project. 

    Core0:2474.final_1.rar

    Core1:8360.final_2.rar

  • Hi,

    Did anybody meet the same problem before? I am blocked and have no idea to solve it. Could it be wrong in .cfg files?

  • Yuxin Yuan,

    This example demonstrating how to use the IPC over Shared Memory (Circ) transport as well as its performance.

    pdk_C6657_1_1_2_6\packages\ti\transport\ipc\examples\shmIpcBenchmark

    How to run this example, see the ReadMe.txt file.

    • Group Core 0 and Core 1 in CCS.
    • Connect to both cores via the group.
    • Run the program in CCS on both cores simultaneously.
  • Dear Pubesh ,

    Thank you for your replying! I used "pdk_C6657_1_1_2_6\packages\ti\transport\ipc\examples\qmssIpcBenchmark" as a reference. This example run successfully in my platform. However, when I divided this example into two part and loaded them to corresponding cores, it failed. 

    I combined NDK and IPC in core0, and deleted some codes which I thought unnecessary, so I worried if I made mistakes in deleting the codes or combining NDK and IPC. Could you spend some time checking my project?

  • Yuxin Yuan,

    Thanks for the clarification, I will do code look on your project. Meantime you can find the test code for NDK and IPC implemented on Image processing demo code. Find the below path,

    mcsdk_2_01_02_06\demos\image_processing\ipc\evmc6657l

  • Dear Pubesh,

    I am so glad to hear that you will help me! Thank you very much!

    I will learn the example as you suggested. Looking forward to your reply!

  • The Core1 program aborts after running the following codes :

    xdc_Int ti_sysbios_syncs_SyncSem_wait__E( ti_sysbios_syncs_SyncSem_Handle __inst, xdc_UInt timeout, xdc_runtime_Error_Block* eb ) 
    {
    return ti_sysbios_syncs_SyncSem_wait__F((void*)__inst, timeout, eb);
    }

    what does it mean?

  • Yuxin Yuan,

    How you tested this code? did you simpley load the .out file and run?

    Can you do step by step using CCS debug, find where is it come out.

  • Pubesh,

    I loaded the evmc6657l.gel file first, and then did Global_Default_Setup. I found the NDK program can't operate normally without these steps.

    The Core1 program aborts after running the following codes :

    xdc_Int ti_sysbios_syncs_SyncSem_wait__E( ti_sysbios_syncs_SyncSem_Handle __inst, xdc_UInt timeout, xdc_runtime_Error_Block* eb ) 
    {
    return ti_sysbios_syncs_SyncSem_wait__F((void*)__inst, timeout, eb);
    }

     

  • Hi,

    I'm getting some weird link problem and I couldn't build your project. But I see that in the original TI bench code there's MessageQ_registerHeap that registers the MessageQ with the heap of SharedRegion and this is missing in your code. Besides this, I don't know if creating NDK stuff in main instead of inside a Task can lead to some kind of problem.

    Regards

  • Hi,

    Thank you for you testing! actually I do MessageQ_registerHeap in Core0 before MessageQ_open and MessageQ_alloc like this:

    Int status;
    /* Register this heap with MessageQ */
    MessageQ_registerHeap((IHeap_Handle)SharedRegion_getHeap(0), HEAP_ID);

    /* Open the 'next' remote message queue. Spin until it is ready. */
    do {
    status = MessageQ_open(queueName, &queueId);
    }
    while (status < 0);
    printf("queueId = %d\n",queueId);

    message = (Message *)MessageQ_alloc(HEAP_ID, sizeof(Message));
    if (message == NULL) {
    System_abort("MessageQ_alloc failed\n");
    }

    Besides, do you mean I should try to create NDK in main? Can you tell me how to do it? Thank you!

  • Dear Johannes ,

    I try to do socket create in main ,but it aborts and print:

    00000.000 Illegal priority call to llEnter()
    00000.000 Illegal call to llExit()
    00000.000 Illegal priority call to llEnter()
    00000.000 Illegal call to llExit()
    failed socket create (-1)

    Does it mean NDK stuff can't create in main?

     

  • Hi,

    I'm not sure, gotta check it in NDK user's guide. But as it enters in NDK kernel functions, that uses task with high priority, it might not work. But this is just a guess, I'm not sure about it.

    Regards

  • Dear Johannes,

    I'll keep my previous configuration temporarily. Would you like to take a look at my previous questions? As I said, I have MessageQ_registerHeap in my codes, and the MessageQ_get jumps to the following codes and aborts:

    xdc_Int ti_sysbios_syncs_SyncSem_wait__E( ti_sysbios_syncs_SyncSem_Handle __inst, xdc_UInt timeout, xdc_runtime_Error_Block* eb ) 
    {
    return ti_sysbios_syncs_SyncSem_wait__F((void*)__inst, timeout, eb);
    }

    Do you know what are possible causes of this? Thank you very much!

  • yuxin yuan said:

    Thank you for you testing! actually I do MessageQ_registerHeap in Core0 before MessageQ_open and MessageQ_alloc like this:

    I believe you need to do MessageQ_registerHeap() on any core that calls MessageQ_alloc() or MessageQ_free().  So I would suggest adding the same MessageQ_registerHeap() call to Core1 as you have in Core0.

    Regards,

    - Rob

     

  • Dear Robert ,

    I add MessageQ_registerHeap in Core1 as your suggestion, but the problem remains. I doubt if the problem happens because MessageQ_get wait for too long. Can you tell me about the MessageQ's waiting Mechanism?

    Hope for your reply!

  • Please help me check my cfg files! Thanks! I have no knowledge about it....

    core0: 7558.client.cfg

    core1:2275.bench_qmss.cfg 

  • Yuxin Yuan,

    Can you add the below sequence after the MultiProc.setConfig(procName, procNameList); in the both .cfg file.

    /* Synchronize all processors (this will be done in Ipc_start) */
    Ipc.procSync = Ipc.ProcSync_ALL;

    Refer the Image processing demo used IPC in master as well as slave project 's .cfg files. This files have the IPC sample code

  • Pubesh ,

    Hi! I add the code you suggested but it doesn't work. Then I try to use  Image processing demo's cfg files, and these errors come out:

    core0:

    The three identifiers are used in systemInit.

    core1:

    How can I correct them?

    Besides, I notice that the  Image processing demo doesn't have communicate between the two cores.Should I add anything? Beg your patient answer!

  • Hi,

    The errors in core 0 mean that it's trying to load an undefined symbol. I don't know exactly where it's defined, but it must be defined in a file located in a directory called src or common in the demo directory. But as you're using a cfg file of a different project, maybe you don't need those identifiers.

    The errors in core 1 mean that there's some problem with the memory sections used, check your memory definitions in platform. Probably the cfg is trying to place some sections in a memory that doesn't exist in your platform, just check the names that cfg uses and the ones you have in your platform. Demos generally use a specific platform with a specific memory map.

    Regards

  • yuxin yuan said:

    Please help me check my cfg files! Thanks! I have no knowledge about it....

    I'll try, although there are many configuration elements in your .cfg files that I'm not familiar with...

    yuxin yuan said:

    /*
    ** If you are using RTSC configuration with NDK 2.2 and above, this is done by default, else
    ** register hooks so that the stack can track all Task creation
    Task.common$.namedInstance  =   true;
    Task.addHookSet ({ registerFxn: '&NDK_hookInit', createFxn: '&NDK_hookCreate', });

    /* Enable BIOS Task Scheduler */

    It appears that the above Task.addHookSet is commented out, but in a way that makes me think that it's unintentional.  The Task.common$.namedInstance is also commented out, but the same setting is achieved in line 65.

    var procName = null;
    ...
    var MultiProc = xdc.useModule('ti.sdo.utils.MultiProc');
    MultiProc.setConfig(procName, procNameList);

    procName is null, which is OK if your C code sets the "self" during runtime with a call to MultiProc_setLocalId(), but the above .cfg code makes it appear as if you intend to set it statically here.

    /* use IPC over QMSS */
    MessageQ.SetupTransportProxy = xdc.useModule(Settings.getMessageQSetupDelegate());
    var TransportQmssSetup = xdc.useModule('ti.transport.ipc.qmss.transports.TransportQmssSetup');
    MessageQ.SetupTransportProxy = TransportQmssSetup;

    MessageQ.SetupTransportProxy is being set and then set again.  Which one do you actually want to use?

    yuxin yuan said:
    core1:[View:http://e2e.ti.com/cfs-file.ashx/__key/communityserver-discussions-components-files/355/2275.bench_5F00_qmss.cfg

    Some of the same issues as above, stated again here...

    var procName = null;
    ...
    var MultiProc = xdc.useModule('ti.sdo.utils.MultiProc');
    MultiProc.setConfig(procName, procNameList);

    procName is null, which is OK if your C code sets the "self" during runtime with a call to MultiProc_setLocalId(), but the above .cfg code makes it appear as if you intend to set it statically here.

    /* use IPC over QMSS */
    MessageQ.SetupTransportProxy = xdc.useModule(Settings.getMessageQSetupDelegate());
    var TransportQmssSetup = xdc.useModule('ti.transport.ipc.qmss.transports.TransportQmssSetup');
    MessageQ.SetupTransportProxy = TransportQmssSetup;

    MessageQ.SetupTransportProxy is being set and then set again.  Which one do you actually want to use?

    Regards,

    - Rob

  • yuxin yuan said:

    Hi! I add the code you suggested but it doesn't work. Then I try to use  Image processing demo's cfg files, and these errors come out:

    core0:

    The three identifiers are used in systemInit.

    The above identifiers are defined by your .cfg files (that you include in a subsequent post), using the Program.global statement.  I'm guessing that the demo .cfg file to which you switched doesn't have these.

    I'm assuming that the core1 problems of section placement is also due to using a demo .cfg file that's not appropriate for your application.

    While there might be elements in the demo .cfg that would help you out, you can't just take a .cfg from one application and use it for a different applicaion.

    Regards,

    - Rob

  • yuxin yuan said:

    I add MessageQ_registerHeap in Core1 as your suggestion, but the problem remains. I doubt if the problem happens because MessageQ_get wait for too long. Can you tell me about the MessageQ's waiting Mechanism?

    One of your previous posts has shown this mechanism...

    xdc_Int ti_sysbios_syncs_SyncSem_wait__E( ti_sysbios_syncs_SyncSem_Handle __inst, xdc_UInt timeout, xdc_runtime_Error_Block* eb ) 
    {
    return ti_sysbios_syncs_SyncSem_wait__F((void*)__inst, timeout, eb);
    }

    In that post you stated that your application enters this function when calling MessageQ_get() and then aborts.  The abort should have dropped a message in your Log.  Can you use the ROV tool to inspect your Log contents and post the results here?

    Regards,

    - Rob

  • Dear Robert ,

    Thanks a lot! I don't know how to use the ROV tool.... The program aborts with the message that shown in the console:

    [C66xx_1] ti.sdo.ipc.MessageQ: line 441: assertion failure: A_invalidQueueId: Invalid queueId is used
    xdc.runtime.Error.raise: terminating execution

    The .cfg files are the copy from the .cfg files in mcsdk_2_01_02_06\examples\ndk\client\evmc6657l and pdk_C6657_1_1_2_6\packages\ti\transport\ipc\examples\qmssIpcBenchmark, and they worked in previous projects. Since the codes are the copy of these projects, my project can be compiled, but I don't know if the files are wrong.

    Where can I learn how to write the .cfg file?

  • yuxin yuan said:

    Thanks a lot! I don't know how to use the ROV tool.... The program aborts with the message that shown in the console:

    [C66xx_1] ti.sdo.ipc.MessageQ: line 441: assertion failure: A_invalidQueueId: Invalid queueId is used
    xdc.runtime.Error.raise: terminating execution

    So, your program must be getting past the Sync wait and returning to MessageQ_get(), where it discovers the bad queueId.

    EDIT: As noted before, the above assertion is coming from MessageQ_put(), which you don't directly call in your application.  However, the transports generally will call MessageQ_put(), which is where your assertion on Core 1 must be happening.

    Getting back to your original post, you have this:
    message = (Message *)MessageQ_alloc(HEAP_ID, sizeof(Message));
    if (message == NULL) {
    System_abort("MessageQ_alloc failed\n");
    }
    message->num[1] = i;

    Can you show me the definition of the type "Message"?

    EDIT: I found the definition of your Message type, in the C files you included earlier.  It looks fine, so please ignore the above question.

    I ask because it needs to have its first element be a MessageQ_MsgHeader, and I worry that it doesn't have this and you're overwriting the header with the message->num[1] = i; statement.

    yuxin yuan said:

    Where can I learn how to write the .cfg file?

    This link will take you to a wiki page about a TI-RTOS workshop.  You could take the workshop if you desire, but this page contains lots of good links, including one to online tutorial videos: http://processors.wiki.ti.com/index.php/Introduction_to_the_TI-RTOS_Kernel_Workshop

    Chapter 4 contains project and config file writing help.

    Here is the general TI-RTOS wiki page: http://processors.wiki.ti.com/index.php/TI-RTOS

    Regards,

    - Rob