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 maximum size of message

Hi there,

Ive tried out the MessageQ mechanism on my c6x chip using SYSLINK and succeeded in sending messages over from sys/bios to linux.
However, it seems that the maximum size of the message I can send over is 512 Bytes.
I've created my message as followed:

typedef struct MyData{
    int data0[64];
    int data1[64];
    int data2[64];
    int data3[64];
    int data4[64];
    int reserve0[8];
    int reserve0[8];
}

typedef struct MyMsg{
    MessageQ_MsgHeader    header;
    MyData                                  data;
} MyMsg;

typedef MyMsg *MyMsgPointer;

in my config file i have declared a larger heap size for my message:

Program.global.HEAP_MSGSIZE = 5504

Now I can perfectly transmit and receive these messages from sys/bios to linux, however, when I try to write the message to file, it only writes 512 Bytes instead of 1376 Bytes, which I would assume it should write.

what I do on the linux side is:

MyMsgPointer message = NULL;
status = MessageQ_get(messageQ, (MessageQ_Msg*) &message, MessageQ_FOREVER):
put_data_to_file("test.txt", message, sizeof(MyMsg));

This last function is my own function which uses fopen and fwrite to write a message to a file.
This function works perfectly, also on the above mentioned data structure, so that should not be the problem.

Any ideas anyone?

  • Hi Jonathan,

    How are you allocating the message on the DSP side?  Does your MyMsg structure on the DSP side
    match the one on the Linux side?  In your put_data_to_file() function, can you confirm that the number
    of bytes passed in is 1376?

    Also, what version of Syslink are you using, and what platform are you building for?

    Best regards,

        Janet

  • Hi Janet, 

    The MyMsg structure is the same on both the SyS/Bios and the Linux side. 
    I build the application for the EVM C6678 platform.

    Im using the syslink 02.00.00.68_beta1 that came with the c6x-linux package from http://linux-c6x.org, I used the release 2.0.
    For this, i have followed all the steps at http://linux-c6x.org/wiki/index.php/Linux-c6x_2.0_Release.

    To build the sys/bios application i have used the same IPC and BIOS versions as the above mentioned c6x-linux project uses. 

    Thank you for your help!

  • Hi Jonathan,

    I see from the version information you provided, that you have a C6x Linux version of Syslink, which I am
    unfamiliar with.  So I will pass on your request for help on this to the appropriate people.

    Best regards,

        Janet

  • Hi, Johathan,

    I changed the HEAP_MSGSIZE to 2048 and dump the msg after MessageQ_get() receives the msg and verifies the msg through MessageQApp_readPattern() in the sample program. The msgSize in the header file shows 0x800, and the buffer shows 2K bytes filled with pattern. The syslink can transmit more than 512 bytes as you described. I think it is something else. Could you just dump the msg on the console instead of to a file and verify the received msg is correct?

    Rex

  • Hi Rex,
    Thank you for your reply. However, the HEAP_MSGSIZE is not defined in bytes, but in 2 bits. This can be seen by the example as is. The HEAP_MSGSIZE was specified at 128, whereas the MessageQ_Header contains 8 * 32 bit ints = 32 bytes = 256 bits.

    MessageQ_MgsHeader{
       Bits32 reserved0

       Bits32 reserved1
       Bits32 msgSize
       Bits16 flags
       Bits16 msgId
       Bits16 dstId
       Bits16 dstProc
       Bits16 replyId
       Bits16 replyProc
       Bits16 srcProc
       Bits16 heapId
       Bits16 seqNum
       Bits16 reserved
    }


    So setting the HEAP_MSGSIZE to 2048 will go right, according to my statement of a maximum of 512 bytes (4096 bits = HEAP_MSGSIZE of 2048), but anything larger does not work. Can you maybe verify this by running the same example but now with a HEAP_MSGSIZE of 4096 ?
    Thanks in advance!

  • Hi, Jonathan,

    I don't quite follow your bits/bytes conversion.  The MsgHeader is 32 bytes long. The HEAP_MSGSIZE defines the payload size in bytes. I changed HEAP_MSGSIZE to 4096 and dumped the msg it receives. The msgSize in the header shows 0x1000. I attached my output from the sample test, messageq_app_test_8_core.sh for your reference. The payload will be filled from 0x01 to 0xff and wraps around. I printed extra 16 bytes at the end of the message. The logs shows the first msg received and the beginning of the 2nd message before the console was disconneccted.

    Rex

    3404.syslink_output.txt

  • Hi Rex,

    Im sorry for the confusion, I was indeed wrong. I was firstly assuming that the HEAP_MSGSIZE was specified in such a way that it could contain the MsgHeader and nothing more, so that was mistake 1. The second mistake was that I thought that my message was not received at the linux side. I was again wrong.

    There seemed to be a problem in using fopen, fwrite etc to directly copy my message into a file.
    When I first copied the data of my message into another data segment, all went right:

    // This goes wrong:

    MessageQ_get(messageQ, (MessageQ_Msg*) &my_message, MessageQ_FOREVER);
    put_data_into_file("test", my_message, sizeof(MyMsg);

    // This goes right:

    MessageQ_get(messageQ, (MessageQ_Msg*) &my_message, MessageQ_FOREVER);
    memcpy(&data, &(my_message->data), sizeof(data));
    put_data_into_file("test", &data, sizeof(data));

    The put_data_into_file routine looks as follows:

    int put_data_into_file(const char *p_name, void *p_buffer_addr, size_t size)
    {

       File *fd;
       int nb = 0;
       fd = fopen(p_name, "wb");
       if (fd != NULL)
       {
            nb = fwrite(p_buffer_addr, size, 1 , fd);
        }
        fclose(fd);
        return nb;
    }

    Any clues why the first method goes wrong and the second goes right?

  • Hi Jonathan,

    I have followed all the steps at http://linux-c6x.org/wiki/index.php/Linux-c6x_2.0_Release to build my linux-c6x. And there is a syslink dir in /projects . I see a install_guide.pdf , did i install it follow this pdf ? It seems that no step is mentioned for C6678 ,how did i make the install?

    And  do you have any suggessions about how to creat CCS project for linux-c6x syslink?

    Thanks a lot!

  • Hi, Guohua,

    Please refer to the "Syslink for C6x" wiki page under "Software Ecosystem Features" in linux-c6x.org for the Syslink demo. To create CCS project, please refer to the CCS Getting Started Guide, http://processors.wiki.ti.com/index.php/CCSv5_Getting_Started_Guide.

    Rex