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.

question about "MessageQ allocation and Heaps"

Other Parts Discussed in Thread: OMAPL138, OMAP-L138

Hi, everyone. I am developing my OMAPL138 board and trying to enable communication between ARM and DSP. However I don't quite understand in the relationship between the message's size and the heap that should be allocated to on the ARM side.

Let me make an example for it. If I want to send a message defined as below:

    typedef struct {
    MessageQ_MsgHeader reserved;
    float my_data[9];
    } App_Msg;

From the size of my message, how should I set the size and number of the heap which will be allocated to the message then?

That is to say. When I use the API:

     HeapBufMP_Params_init(&heapParams);

Based on my message, how should I set the two parameters:

    heapParams.blockSize 

    heapParams.numBlocks 


Is there anyone having an idea? Please share with me. Thank you very much!

  • You can set the blockSize so that it is large enough to hold one of your messages.  The numBlocks should be greater than or equal to the number of messages you allocate.  What product are you using, and what version?

    Best regards,

        Janet

  • Hi, Janet

    Thank you for answer.

    I am using mscdk_1_01_00_02, CCSv5 and syslink_2_21_01_05 to develop OMAP-L138.

    As your answer, I think I should first confirm the size of App_Msg. So there are two question I face.

    1. When I calculate the size, should the message header be included?

    2. When I calculate the size, naturally I will use sizeof() function. So the return value is how many bytes the data take. However, according to the API Guide, the size should be carried out in MAU ( memory allocation unit). So what is the relationship between byte with MAU.

    After confirming the size, I just should set the block number 1, because there is only one message. Is that right?

    Thank you for your answer. I am l looking forward to your reply.

    janet said:

    You can set the blockSize so that it is large enough to hold one of your messages.  The numBlocks should be greater than or equal to the number of messages you allocate.  What product are you using, and what version?

    Best regards,

        Janet

  • Hi Chengyang,

    Yes, you should include the message header in the size of the message.  The sizeof() will return the number of minimum addressable units (MAUs).  I think of a byte as always being 8 bits.  For the OMAP L138, both DSP and Arm, a MAU is the same size as a byte, 8 bits.  However, for some architectures, eg, C28, the MAU is 16 bits, so sizeof(char) returns 1, although the char is 2 bytes.

    If you are only allocating once from your HeapBuf heap, then one block should be sufficient.

    Best regards,

        Janet