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.

Are Queue elements placed on heap or system stack?

Other Parts Discussed in Thread: OMAPL138, SYSBIOS

My target is an OMAPL138

Tools:

CCS version = 5.1.0

TI compiler = 7.3.1

SYSBIOS = 6.33.1.25

XDCtools = 3.23.0.32

Code snippets

#include <ti/sysbios/BIOS.h>

#include <ti/sysbios/knl/Queue.h>

Queue_Handle m_dataQueHandle;

typedef struct

{

Queue_Elem _elem;

uint32_t timeStamp;

uint16_t stepNumber;

uint16_t numberOfDataSamples;

int32_t acValue[500];

int32_t dcValue[500];

uint16_t lightIntensity[500];

}detectorDataType;

void myInitFunction()

{

m_dataQueHandle = Queue_create(NULL, NULL);

}

void mySwiFxn()

{

detectorDataType foo;

/** enqueue test data **/

int i;

foo.timeStamp = 1;

foo.stepNumber = 1;

foo.numberOfDataSamples = 1;

for (i = 0; i < 500; i++)

{

foo.acValue[i] = i;

foo.dcValue[i] = i;

foo.lightIntensity[i] = i;

}

Queue_put(m_dataQueHandle, &foo._elem);

void myProcessingFxn()

{

detectorDataType* foo2;

foo2 = Queue_get(m_dataQueHandle);

}

Here is what I'm seeing.  During mySwiFxn() I try to put foo into the queue.  I can see the contents of foo on the system stack, which I would expect.  I assume the call to Queue_put() will copy the contents of foo to the heap, but I suspect this is not happening.  Later when myProcessingFxn() calls Queue_get(), foo2 points to the system stack where foo from mySwiFxn resided.  That looks like incorrect behavior to me.

I assumed the queue will allocate and free memory from the heap, is this correct?

Thanks in advance for your help!