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.

TDA4VM: C66x Stack Size

Part Number: TDA4VM

Tool/software:

Hi,
I'm trying the create a simple c++ queue in the parent task and spawning a new task from the parent task and trying to access the values present in the queue (I signal the new task about new values using semaphoreP), but in the new task whenever I read the front value of the queue it is always null / 0.
I'm not sure is it something to do with any stack align issue when I create task for c66x core.
When I try printing the values of queue in the same parent task it is printing properly.

Stack buffer for parent task:
static uint8_t gTskStackMain[256*1024]
__attribute__ ((section(".custom_stack")))
__attribute__ ((aligned(1024))) //tried 8192 as well
    ;


stack buffer for child(New) task:

static uint8_t gTskStackCmdQue[64*1024]
__attribute__ ((section(".custom_stack")))
__attribute__ ((aligned(1024))) //tried 8192 as well
    ;


Similar issue I faced when I tested for C7x core and after aligning the task buffer to 8192 it started working.

Could someone lend light on this issue?

I tried without alignment and increasing the size of the buffers still same behavior.

For C7x core, same code is working with below configuration:

stack buffer for child(New) task:
static uint8_t gTskStackCmdQue[8*8192]
__attribute__ ((section(".bss:taskStackSection")))
__attribute__ ((aligned(8192)))
    ;

Stack buffer for parent task:
static uint8_t gTskStackMain[64*1024]
__attribute__ ((section(".bss:taskStackSection")))
__attribute__ ((aligned(8192)))
    ;

Details of the work env:

TDA4VM

FreeRTOS: Testing in c66x core

SDK:9.2

  • Hello Porselvan,

    Can we get more details on the project/end customer and the complete use case information here so that we can help prioritize this thread?

    Thanks.

  • Hi Praveen,

    We are working on developing a middleware which can be ported to different SoC's for an ASIAN OEM, its part of upcoming CES demo program.
    As part of that middleware, we are creating a IPC receiving class which will receive the message from different cores and post that ipc message to a listener queue and another listerner task will read the messages from that queue and process it in that core.
    This design we have tested for C7x core in TDA4 and its working perfectly, now when we port the same code for C6x its failing.

    We are currently blocked on this, and not sure how to proceed. Instead of blind debugging if some pointers on this issue anyone can point us, it will be helpful for us

  • We suggest you make us aware of the TI PSDK RTOS and its documentation as much as possible. We must delay looking into anything outside this due to other priority items and limited bandwidth. However, we will look into this next week and get back to you with feedback.

    Thanks.

  • Hi Praveen,

    thanks for the feedback, I’m using RTOS SDK internally to have this design ready, any feedback on this issue will be more helpful for us.

  • Hello Porselvan,

    Some basic quesiton -

    Are you saying that both parent and spawned task has to access the same C++ queue?

    Also where the parent task creating the C++ Queue? on the stack or on the heap?

    Are you saying that gTskStackMain and gTskStackCmdQue the "task stack memory" that used use by the parent and spawned task?

    Thanks.

  • Hi Praveen,

    Are you saying that both parent and spawned task has to access the same C++ queue?

    yes, I was able to access by passing this pointer as an argument to the task.

    /* code */


        taskParams.stack         = gTskStackCmdQue;
        taskParams.stacksize     = sizeof(gTskStackCmdQue);
        taskParams.arg0           = static_cast<void *>(this);

        taskHandle = TaskP_create(workerTask, &taskParams);

    So with the this pointer, I am able to access the that particular class instance queue using getter function.

    Also where the parent task creating the C++ Queue? on the stack or on the heap?

    Stack.

    /* code */

    //global variable

    static uint8_t gTskStackCmdQue[8*8192]
    __attribute__ ((section(".bss:taskStackSection")))
    __attribute__ ((aligned(8192)))
        ;

    //later in the class func

        taskParams.stack         = gTskStackCmdQue;
        taskHandle = TaskP_create(workerTask, &taskParams);

    Are you saying that gTskStackMain and gTskStackCmdQue the "task stack memory" that used use by the parent and spawned task?

    Yes right.,

    With the above design I was able to communicate in the C7x core without any issues, when I take the same code and compile it for C66x and test, I'm getting NULL / 0 when I access the queue. Similar issue I observed in C7x as well, later it got resolved when I aligned the parent and spawned stack task  as 8192 (__attribute__ ((aligned(8192)))) when I define the stack:

        static uint8_t gTskStackCmdQue.

    So is something like that any requirement is their for C66x? when the stack memory for the tasks has to be aligned in some particular value? or this issue is related to something else?

  • Hi Porselvan,

    Thanks for the details. We see that you are creating the stack for both the parent task and the spawned task, which are the same, which is a fundamental flaw. We suggest you have a separate stack for each task.

    We cannot comment on your question about why it worked on the C7x core. Suggest consulting other software experts in your organization for their feedback.

    Thanks.