problem when using a task

karimaaissaoui wrote on Tuesday, April 12, 2016:

Hello everyone,
CodeWarrior provides the ability to run code either directrly into the target or using a simulation mode.
In the normal case, when we use a task, the infinite loop used at the end of the main function should not to be executed once the “vTaskStartSchedular()” is called, the task should start and should remain always in the infinite loop function called by the task, but when we execute step by step, we never get to this function, the code gets stuck in the endless loop of main code and does not come out.
When we execute the code ported in the microcontroller step by step, to identify where the program crashes.

Here are the results we found:
To create the task, memory allocation variables for the stack and TCB (task control block), always take Null, so the memory allocation is not performed, and thereafter the program remains in the infinite loop of the main.
In the simulation mode, the allocation of memory blocks are done, and we get to enter the function used by the task, and remains in there.
Normally we should have the same results, since the simulation mode create a similar working environment, as the environment of the card.
Please find below the code that was used.

void MyTask1(void* pvParameters);

void main(void)

DDRP = 0x0F;


xTaskCreate( MyTask1,   ( signed char * ) "MyTask1", configMINIMAL_STACK_SIZE, NULL, 1, NULL );




 void MyTask1(void* pvParameters)



We would like to have your opinion about this problem. We thank you.

Best Regards.

FreeRTOSV9 microcontroller : HCS12P64 codeWarrior V5.9.0