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.

RTOS/LAUNCHXL-CC26X2R1: Setting the size of queue in ti rtos

Part Number: LAUNCHXL-CC26X2R1

Tool/software: TI-RTOS

Hello,

I am using TI RTOS in my project on the cc2652 board. In TI RTOS is there an option to set the size of the Queue To ensure that only a certain number of elements get stored into the queue.

The need for this is to avoid the condition where the queue memory gets filled and the program tries to enqueue another element .

I do understand that the TI RTOS auto heap feature allocates the rest of the remaining RAM for heap. But in the extreme case if the queue runs out of memory and then we try to enqueue again, what happens?

I mean ,what would happen in such a case, where the created queue in TI RTOS gets filled and the program tries to load another element ? Would the program halt its execution completely ?

Regards,

Shyam

  • Hi,

    As far as I know, there is no possibility to limit the queue size at creation.

    However you can verify how much elements are already in the queue before adding an element to it. This can be done by keeping track of the number of elements in the queue (by increasing and decreasing a variable every time you add or remove an element from the queue) or by counting the number of elements in the queue before adding an element to it (take the queue from the beginning and looping while not reaching the tail of the queue).

     

    I cannot answer on the specific behavior of the device if it runs out of stack. The only thing I can say is “it will not be cool”. In fact, the device will continue writing in the stack and potentially erase some data… sometimes you are lucky and you don’t notice it but more often you get some very strange errors. Usually, this type of error is hard to debug without using the ROV. (Note: you can use the ROV to see the heap and stack consumption and adjust their size in consequence)

     

    I hope this will help,

    Best regards,