Suppose you have following main.c and it works properly
#include <stdio.h> // prototype declarations for I/O functions
#include "uart.h"
int main (void)
{
vUartInit();
printf ("Hello World\n");
for (;;);
}
and you want to make minimalistic FreeRTOS example on your processor.
You will need to do following.
/* Standard includes */
#include <stdio.h> // prototype declarations for I/O functions
/* Driver includes */
#include "uart.h"
/* Scheduler includes */
#include "FreeRTOS.h"
#include "task.h"
void prvTaskA (void* pvParameters)
{
(void) pvParameters; // Just to stop compiler warnings.
for (;;) {
vTaskDelay(500);
printf("Task A\n");
vTaskDelay(500);
}
}
void prvTaskB (void* pvParameters)
{
(void) pvParameters; // Just to stop compiler warnings.
for (;;) {
printf("Task B\n");
vTaskDelay(1000);
}
}
int main (void)
{
vUartInit();
xTaskCreate( prvTaskA, ( signed char * ) "TaskA", configMINIMAL_STACK_SIZE, NULL,
tskIDLE_PRIORITY, ( xTaskHandle * ) NULL );
xTaskCreate( prvTaskB, ( signed char * ) "TaskB", configMINIMAL_STACK_SIZE, NULL,
tskIDLE_PRIORITY, ( xTaskHandle * ) NULL );
vTaskStartScheduler();
//should never get here
printf("ERORR: vTaskStartScheduler returned!");
for (;;);
}
rd@radekdostal.com
+43 681 815 945 10
skype: radekdostal
www.mimo-domov.cz - Czech and Slovak people abroad