Viewing tasks

cancel
Showing results for 
Search instead for 
Did you mean: 

Viewing tasks

267 Views
Teckna
Contributor V

I'm working with Codewarrior 10.2, MQX 3.8 and a custom board based on K60N512; my application runs several tasks, but in the debug window in CW, I see only three tasks, the idle task and two of my running tasks (the only two ones that have the

MQX_AUTO_START_TASK attribute set in the task template list). The application is running correctly, all the launched tasks are working, but if I hit the break button, no task stack other than the two ones above is displayed in the debug view.

 

Is there some limitation on the displayed tasks? What can I do to display everything correctly?

 

Many thanks

Teckna

Labels (1)
0 Kudos
2 Replies

18 Views
Teckna
Contributor V

Hi everyone,

 

I made some investigation:

 

Every task creation following the _mem_extend instruction seems to allocate the task stack in the external memory, even if there is enough space in the internal memory.

 

I created a new simple project with a single source file with this code (extracted):

TASK_TEMPLATE_STRUCT MQX_template_list[] = { /*  Task number, Entry point, Stack, Pri, String, Auto? */   {MAIN_TASK,   Main_task,   1500,  9,   "main",   MQX_TIME_SLICE_TASK | MQX_AUTO_START_TASK},   {SECOND_TASK, Second_task, 1500,  9,   "second", MQX_TIME_SLICE_TASK},   {THIRD_TASK,  Third_task,  1500,  9,   "third",  MQX_TIME_SLICE_TASK},   {0,           0,           0,     0,   0,        0,                 }};/*TASK*-----------------------------------------------------* * Task Name    : Main_task* Comments     :*    This task prints " Hello World "**END*-----------------------------------------------------*/void Main_task(uint_32 initial_data){ printf("\n Hello World \n");  _mem_extend( BSP_EXTERNAL_MRAM_RAM_BASE, BSP_EXTERNAL_MRAM_RAM_SIZE ); _task_create( 0, SECOND_TASK, 0); _task_create( 0, THIRD_TASK, 0); return;}void Second_task(uint_32 initial_data){ uint_32 num2; num2 = 0; while( 1 ) {  printf( "Cycle %d\n", num2++ );  _time_delay( 1 ); }}void Third_task(uint_32 initial_data){ uint_32 num3; num3 = 0; while( 1 ) {  printf( "Cycle %d\n", num3++ );  _time_delay( 1 ); }}

In this situation both tasks stacks are placed in the external memory and no task is displayed in the debug view.

If the _mem_extend function call is placed between the two task creations, the Second_task stack is placed in the internal memory and the Third_task stack is placed in the external memory and only Second_task task is displayed in the debug view

If the _mem_extend function call is placed after the two task creations, both tasks stacks are placed in the internal memory and both tasks are displayed in the debug view.

 

If the two stacks can fit in the internal memory and the memory is free, why are they allocated in the external memory? All the space remaining in the internal memory seems to be wasted.

Is there a way to display in the debug view the tasks that are allocated in the external memory?

 

Many thanks

Teckna

 

0 Kudos

18 Views
Teckna
Contributor V

I forgot to mention (if it's important) that in one of the two auto starting tasks, the very first instruction is:

_mem_extend( BSP_EXTERNAL_MRAM_RAM_BASE, BSP_EXTERNAL_MRAM_RAM_SIZE );

 because the internal RAM is non enough to allocate the stacks for the subsequent created tasks.

 

Many thanks

Teckna

0 Kudos