how to add a task in freertos

cancel
Showing results for 
Search instead for 
Did you mean: 

how to add a task in freertos

464 Views
xiaolongyuan
Contributor II

i use the board frdm-kw36z i find the  freertos file fsl_os_abstraction_free_rtos.c this is the main function entrance as belows excerpt 

int main (void)
{
/* Initialize MCU clock */
hardware_init();
OSA_TaskCreate(OSA_TASK(startup_task), NULL);

vTaskStartScheduler();
return 0;
}

if i want to create another self define task how to add and make it works ,do i need to write  a similary  function 

OSA_TaskCreate(OSA_TASK(my_task), NULL);

and give some definition like this 

#ifndef gMainThreadStackSize_c
#define gMainThreadStackSize_c 1024
#endif
#ifndef gMainThreadPriority_c
#define gMainThreadPriority_c 7
#endif

than write a thread func in the realization of my_task. is it that right ,or some one give tips or demo on how to add a self define task.. thanks a lot!

Labels (1)
0 Kudos
1 Reply

277 Views
danielchen
NXP TechSupport
NXP TechSupport

Hi yuan:

xTaskCreate is an API to create a new task and add it to the list of tasks that are ready to run.

Please refer to below link and hello world demo for more details

This page describes the RTOS xTaskCreate() FreeRTOS API function which is part of the RTOS task cont... 

pastedImage_1.png

OSA_TaskCreate is a wrapper, it is also right to create a new task.

Regards

Daniel

0 Kudos