Arun Kumar

FreeRTOS component quiries and information

Discussion created by Arun Kumar on Apr 14, 2016
Latest reply on Apr 15, 2016 by Richard Barry

Hello all,

I have until now done all my projects without using any RTOS.As of now i am taking some baby steps into the world of RTOS.

I have chosen the FreeRTOS components in code-warrior to get started.

After some reading and a little tinkering i got a sample program working and running.

I have a few questions regarding the way the RTOS works....

 

I am currently using the MK60FN1MOVLQF15 micro controller.

I have setup two tasks which blinks 2 separate LEDs.

Here's the task creation code

 

[code]

void CreateTasks(void) {

    if (FRTOS1_xTaskCreate(

            led_blink1Task,  /* pointer to the task */

            "led_blink1", /* task name for kernel awareness debugging */

            configMINIMAL_STACK_SIZE + 0, /* task stack size */

            (void*)NULL, /* optional task startup argument */

            tskIDLE_PRIORITY + 0,  /* initial priority */

            (xTaskHandle*)NULL /* optional task handle to create */

    ) != pdPASS) {

        /*lint -e527 */

        for(;;){}; /* error! probably out of memory */

        /*lint +e527 */

    }

    if (FRTOS1_xTaskCreate(

            led_blink2Task,  /* pointer to the task */

            "led_blink2", /* task name for kernel awareness debugging */

            configMINIMAL_STACK_SIZE + 0, /* task stack size */

            (void*)NULL, /* optional task startup argument */

            tskIDLE_PRIORITY + 0,  /* initial priority */

            (xTaskHandle*)NULL /* optional task handle to create */

    ) != pdPASS) {

        /*lint -e527 */

        for(;;){}; /* error! probably out of memory */

        /*lint +e527 */

    }

}

[/code]

 

Both leds are blinking as per the task.

Now if i change the task priority (tskIDLE_PRIORITY + 0,  /* initial priority */) from 0 to 1,of the second task,then only this task is being executed.

Why is this happening,will there ever be a case when the task with priority 0 will be executed?

 

Also each task uses a lot of HEAP size(2048 bytes),is this normal?

If i want to add more tasks i need to add 2048 bytes for every additional task or else i get stuck inside the FRTOS1_vApplicationMallocFailedHook() event.

So for two tasks i had to assign 4048 bytes into the HEAP stack.Is this normal?

 

Thanks for all you help

Arun

Outcomes