0% found this document useful (0 votes)
24 views

Radek Dostál 4 You: Freertos 6.1.0 Minimal Example

If you have following main.c and it works properly #include / / prototype declarations for I / O functions #include "uart.h" if you want to make minimalistic FreeRTOS example on your processor you will need to do following.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
24 views

Radek Dostál 4 You: Freertos 6.1.0 Minimal Example

If you have following main.c and it works properly #include / / prototype declarations for I / O functions #include "uart.h" if you want to make minimalistic FreeRTOS example on your processor you will need to do following.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Radek Dostl 4 you

FreeRTOS 6.1.0 minimal example


Mon, 11/08/2010 - 18:18 | dasty
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.
1. Link following sources to your project
=> FreeRTOS/Source/list.c
=> FreeRTOS/Source/queue.c
=> FreeRTOS/Source/tasks.c
=> FreeRTOS/Source/portable/MemMang/heap_YOUR_HEAP.c
=> FreeRTOS/Source/portable/YOUR_PORT/port.c
=> FreeRTOS/Source/portable/YOUR_PORT/portASM.s
2. Copy FreeRTOSConfig.h from closest demo example to your include path
3. Add following directories to you include path
=> FreeRTOS\Source\include
4. You may need to change Startup.S to the one from closest demo example, if threads are not starting
5. Modify your main.c to contain:
/* 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 );
Contact information
[email protected]
+43 681 815 945 10
skype: radekdostal
Blog CV Projects Contact
www.mi mo-domov.cz - Czech and Sl ovak peopl e abroad
xTaskCreate( prvTaskB, ( signed char * ) "TaskB", configMINIMAL_STACK_SIZE, NULL,
tskIDLE_PRIORITY, ( xTaskHandle * ) NULL );
vTaskStartScheduler();
//should never get here
printf("ERORR: vTaskStartScheduler returned!");
for (;;);
}
Add new comment
Copyright 2008 Radek Dostl. All Rights Reserved.

You might also like