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/TM4C1294KCPDT: Global array as a stack for a task in TI-RTOS

Part Number: TM4C1294KCPDT


Tool/software: TI-RTOS

Dear SupportTeam,

While creating a task in TI-RTOS, with some assumption w.r.t. max stack needed for that task, we declare global array of x size and pass it to Task_Params stack member. This global array will be located in .bss section.

As per my understanding, in this case, we would be consuming device RAM even if we don't start the task while code is actually running also even after task is terminated that section of RAM can't be used by any other function/task. Is this correct?

Thanks & Regards

Abhijit

  • If you create the task in the .cfg file, the stack will be placed in .bss. You cannot delete a statically created task, so the stack remains around. Note if you supplied the stack, you can manage the memory as needed.

    If you create (or construct) the task during runtime (via Task_create or Task_construct) and
    - you don't supply the the stack, it is allocated out of a heap
    - you supply the stack, it is where ever you had the stack.

    If you delete a runtime created task and did supply the stack on the create (or Task_construct), it's up to you to manage the memory (e.g. re-use it for something else)

    If you delete a runtime created task and don't supply the stack on the create (or Task_construct), Task_delete (or Task_destruct) will free the stack (that was allocated in the Task_create or Task_construct).

    Regarding a task that terminates (e.g. fails out of the entry function or calls Task_exit), please look at Task_deleteTerminatedTasks to see what action is taken.

    Please look at this for more details on the different types of allocations: processors.wiki.ti.com/.../TI-RTOS_Object_Creation_Comparison

    Todd
  • Thank you Todd for your response