Quality RTOS & Embedded Software

 Real time embedded FreeRTOS RSS feed 
Quick Start Supported MCUs PDF Books Trace Tools Ecosystem TCP & FAT


problem when using a task

Posted by karimaaissaoui on 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", configMINIMALSTACKSIZE, NULL, 1, NULL );




void MyTask1(void* pvParameters) { while(1) { PTP=0x00; vTaskDelay(2000);




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

Best Regards.

FreeRTOSV9 microcontroller : HCS12P64 codeWarrior V5.9.0

[ Back to the top ]    [ About FreeRTOS ]    [ Sitemap ]    [ ]

Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.

Latest News

FreeRTOS kernel V10 is available for immediate download. Now MIT licensed.

FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

IAR Partner

Microchip Premier RTOS Partner

RTOS partner of NXP for all NXP ARM microcontrollers

STMicro RTOS partner supporting ARM7, ARM Cortex-M3, ARM Cortex-M4 and ARM Cortex-M0

Texas Instruments MCU Developer Network RTOS partner for ARM and MSP430 microcontrollers

OpenRTOS and SafeRTOS