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.

MSP432E411Y-BGAEVM: TI RTOS CCS stack usage issues.

Part Number: MSP432E411Y-BGAEVM

I see that CCS has a stack usage window available when debugging. When hovering over any task, it seems to say "x out of 6108 bytes used" although my tasks are created with different stack sizes (e.g. 2048 bytes).

I have also created 2 CAN handling threads that use the same thread function.

/* Initialize the attributes structure with default values */
pthread_attr_init(&can0Attrs);

/* Set priority, detach state, and stack size attributes */
priParam.sched_priority = 1;
retc = pthread_attr_setschedparam(&can0Attrs, &priParam);
retc |= pthread_attr_setdetachstate(&can0Attrs, PTHREAD_CREATE_DETACHED);
retc |= pthread_attr_setstacksize(&can0Attrs, THREADSTACKSIZE * 2);
if (retc != 0)
{
    /* failed to set attributes */
    while (1) {}
}

static uint16_t can0Bus = 0;
retc = pthread_create(&canThread0, &can0Attrs, canThreadFn, (void *)&can0Bus);
if (retc != 0)
{
    /* pthread_create() failed */
    while (1) {}
}

/* Initialize the attributes structure with default values */
pthread_attr_init(&can1Attrs);

/* Set priority, detach state, and stack size attributes */
priParam.sched_priority = 1;
retc = pthread_attr_setschedparam(&can1Attrs, &priParam);
retc |= pthread_attr_setdetachstate(&can1Attrs, PTHREAD_CREATE_DETACHED);
retc |= pthread_attr_setstacksize(&can1Attrs, THREADSTACKSIZE * 2);
if (retc != 0)
{
    /* failed to set attributes */
    while (1) {}
}

static uint16_t can1Bus = 1;
retc = pthread_create(&canThread1, &can1Attrs, canThreadFn, (void *)&can1Bus);
if (retc != 0)
{
    /* pthread_create() failed */
    while (1) {}
}

This seems to work as expected, but the stack usage window only has a single entry for the function name "canThreadFn" - not one for each thread.

The usage it lists also seems too high - it currently shows 1540 whereas calling Task_stat(Task_self(), &statbuf); and printing statbuf.used in my thread function reports 1176.

TIA

Jim