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.

Extend RTOS-IPC example results in error

Other Parts Discussed in Thread: SYSBIOS

Hi at all,
I try to modify the IPC DEMO Example for the F28M35H52C1. The Demo it self, works fine. But when I add a new Variable to the "TempMsg Struct" and try to read or write the Variable the System stuck and I get this message:

ti.sysbios.heaps.HeapBuf: line 125: assertion failure: HeapBuf_create's bufSize parameter is invalid (too small)
xdc.runtime.Error.raise: terminating execution

I use CCS 6.0.1.00040 und TI RTOS 1.21.0.09

This is the struct

typedef struct TempMsg {
    MessageQ_MsgHeader hdr;
    float temperatureF;
    float temperatureC;
    float test;
} TempMsg;

and with ((TempMsg *)msg)->testvar = test;  I Try to write a Value, from M3 to C28

  • Can you increase BIOS.heapSize? It looks like you just ran out of memory when demo.c is trying to create the MessageQ heap.

  • Hi Tom, I already increased the BIOS heapsize from 0x5FC0 to  0x6FC0 and to 0x8FC0;

    Unfortunately the error remains the same.

  • In demo.c, can you check to see that the hbparams.bufSize, hbparams.blockSize, hbparams.numBlocks are correct.

    You're seeing an error because the bufSize is smaller than numBlocks * blockSize.

  • Hello.

    I am facing the exact same problem. 

    Whenever I try to add more variables in my typedef struct I don't know how to set the numBlocks and the BIOS.heapSize. I have tried to increase both but it seems like I am doing something wrong.

    I have the following in my code:

    typedef struct TempMsg2 {
        MessageQ_MsgHeader hdr;
        Float msga;
        Float msgb;
        Float msgc;
        Float msgd;
        Float msge;
        Float msgf;
        Float msgg;
    } TempMsg2;


    numBlocks = 10;

    BIOS.heapSize = 0x8FC0;

    
    

    Tom Kopriva.

    Can you explain how to set the values for those parameters in a generic way (numBlocks  and BIOS.heapSize)?

     

    Thank you.

     

     

     

     

     

     

     

     

     

     

  • Hi and sorry for my late reply 
    I have solved the problem and I was able to determine the cause.

     

    These two lines of code are there

    blockSize = sizeof(TempMsg);

    buf = Memory_alloc(0, numBlocks * blockSize, 0, NULL);

    siezeOf (TempMsg) is the Problem, I changed it to a fix Value like

     blockSize = 64;

     

    and and everything works. But I still do not know why sizeof (TempMsg) calculated the wrong value.

    I have made the changes naturally in both projects (M3 C28). At the cfg-files I have changed nothing.

  • Hello.

    I have been able to understand it a bit better. 

    Under the sys/bios user guide I found the following in chapter 6

    "The blocksize needs to be a multiple of the worst-case structure alignment size. And bufSize should be equal to blockSize * numBlocks. The worst-case structure alignment is target dependent. On C6x and ARM devices, this value is 8. The base address of the buffer should also be aligned to this same size."

    Thus, the only thing you should do is increase the numBlocks in order to be a multiple of the worst-case structure alignment size of the device block, in my case,  8.

    For instante, 2, 4, 8, 16, 32, 64 and so on.

    I hope it helps.