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