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.

Multiple images, static messages, messageQ, IPC.

I'm working on a C6678 multi-core DSP with multiple .out files.

I'm trying to use the MessageQ to communicate with another core.  I can do this using the heap:

Msg_DSPCommandResponse_t * msg2;
msg2 = &(the_Msg_DSPCommandResponse[0]);
//MessageQ_staticMsgInit(&(msg2->header), sizeof(Msg_DSPCommandResponse_t));
msg2 = (Msg_DSPCommandResponse_t *) MessageQ_alloc(HEAPID, sizeof(Msg_DSPCommandResponse_t));
if (msg2 == NULL) {
System_abort("MessageQ_alloc failed\n");
}
MessageQ_setMsgId(msg2, 0);
status = MessageQ_put(hapticsQ, (MessageQ_Msg) msg2);
if (status < 0) {
System_abort("MessageQ_put had a failure/error\n");
}

But rather than using the heap, how would I go about messageQ allocation without a heap using static messages?

Thanks in advance.

  • When I attempt to use a static message, I get the follow error when I MessageQ_put:

    [TMS320C66x_1] ti.sdo.ipc.transports.TransportShm: line 388: assertion failure: A_regionInvalid: Region is invalid
    [TMS320C66x_1] xdc.runtime.Error.raise: terminating execution

  • Gary:

    First off, when you say static, do you mean static allocation of the messageQ using the cfg file?  If that's the case could you attach your cfg file?

    With respect to your question, I believe that the heap is necessary due to the need for contiguous memory.  However, it certainly can do static allocation. 

    It looks like you're using shared memory to communciate between multiple cores, is that correct?  If this is the case, I believe your heap should be allocated in MSMC or DDR3. 

    For more information, look within the folder \ipc_U_ZZ_YY_XX\docs\doxygen\html\_message_q_8h.html

    -John

  • John,

    When I said static, I meant static allocation of MessageQ messages as described in section 2.3.4.2 'MessageQ Allocation Without a Heap' of the IPC_Users_Guide.  I have a single core example that demonstrates this, but I'm not sure if it's possible on multiple cores.  In addition, I am interested in static allocation of the MessageQ using the cfg file, but I have not done this yet and I'm looking for an example.

    I am indeed using shared memory to communicate between multiple cores.  My cfg file is closely based on image_processing_evm6678l demo.

    Thank you,

    Gary

  • Gary:

    We consoluted someone on the IPC team and have learned the following.  The STATICMSG feature came about for copy transports (where messages are being copied between cores).  It looks like the IPC User’s Guide made an attempt to document the feature, but with several warnings:

                  “transport may internally call MessageQ_free() and encounter an error.   If MessageQ_free() is called on a statically allocated message, it asserts that the heapId of   the message is not MessageQ_STATICMSG”

    The memory for a “static” message can be allocated on the stack, in a global message variable, or by calling malloc(), and then doing MessageQ_staticMsgInit() to initialize the msg header.  For example:

    {

        MessageQ_Msg msg;

        Char  buffer[128];

        msg = (MessageQ_Msg)buffer;

        MessageQ_staticMsgInit(msg, sizeof(buffer));

        […]

    }

       Since MessageQ_staticMsgInit() does not allocate any memory, there would be no memory issues by doing that multiple times (unless the client calls malloc(), in which case he should call free() for every malloc().

    However, the bottom line is that we do not recommend using static messages because the shared memory transport does not support it.

     

    -John