Getting started with FreeRTOS and Windows using simulation??

Status
Not open for further replies.

xpress_embedo

Advanced Member level 4
Joined
Jul 5, 2011
Messages
1,154
Helped
161
Reputation
396
Reaction score
189
Trophy points
1,353
Location
India
embeddedlaboratory.blogspot.in
Activity points
10,591
Hello!! I want to start learning real time operating system and for that i am using FreeRTOSV8.1.2
I found on FreeRTOS website that we can test, freertos basic concepts such as tasks, queues etc on windows using MINGW Compiler integrated in Eclipse.

So i Downloaded ECLIPSE LUNA from internet and import the "WIN32-MingW" Demo Project in eclipse.
And then build it.
The project gets compiled properly but when i tried to debug i am getting this error.



The main file is as follow:-


Code C - [expand]
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
int main( void )
{
    /* Initialise the trace recorder and create the label used to post user
    events to the trace recording on each tick interrupt. */
    vTraceInitTraceData();
    xTickTraceUserEvent = xTraceOpenLabel( "tick" );
 
    /* Start the trace recording - the recording is written to a file if
    configASSERT() is called. */
    printf( "\r\nTrace started.  Hit a key to dump trace file to disk (does not work from Eclipse console).\r\n" );
    fflush( stdout );
    uiTraceStart();
 
    /* The mainCREATE_SIMPLE_BLINKY_DEMO_ONLY setting is described at the top
    of this file. */
    #if ( mainCREATE_SIMPLE_BLINKY_DEMO_ONLY == 1 )
    {
        main_blinky();
    }
    #else
    {
        main_full();
    }
    #endif
 
    return 0;
}




As there is this statement, i get
printf( "\r\nTrace started. Hit a key to dump trace file to disk (does not work from Eclipse console).\r\n" );

I get this statement on console, and after that i get the error shown above in the image.

This project is really complex for me to understand, can any one tell how i can start a project from basics, where i just create a two tasks and run them.
Something like getting started project for FreeRTOS.
 

I have no idea why you would get that error - I have never seen that happen before. I would suggest removing any console IO as a starting point (the printf and fflush and kbhit calls) as Eclipse does not handle those well at all on Windows hosts. You could also try using the Visual Studio version as you can use the free visual studio version - follow the links on the documentation page.

> This project is really complex for me to understand, can any one tell
> how i can start a project from basics, where i just create a two tasks
> and run them.

I'm sure you will have read the instructions on the documentation page for the demo you are using, and the instructions in the comments at the top of main.c which tells you how to use the code and links to the documentation page, so must have just missed the fact that setting mainCREATE_SIMPLE_BLINKY_DEMO_ONLY to 1 at the top of main.c builds a very simple demo that only that only creates two tasks in a very simple way - especially for beginners.

A question in return. FreeRTOS is one of the best supported small operating systems there is because not only is it a free product but the authors, developers and maintainers (not to mention other users) provide a direct and free support service, so why are you asking this question here?
 
Thanks Sir, you are Richard Barry from Real Time Engineer's that's great.
And i will ask other question on FreeRTOS forum.

Apart from the this i installed Visual Basic Express Edition and run the demo with it and it works perfectly.
 

Sorry, I was talking about Visual Studio Express Edition 2012.
(NOTE:- I am using Visual Studio 2012 and FreeRTOS version 8.1.2)
I opened the demo project in that and it works properly in Visual Studio which is using Visual C++ compiler.
But as i already told, the demo project is very complicated for me as trace feature is also used and i don't know, what is that.
So read anatomy of FreeRTOS from their website and then created a new project by using FreeRTOS Source files, i had done most of the things but i am getting errors.

My main code is as follow:-

Code C - [expand]
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#include <stdio.h>
#include <stdlib.h>
#include <conio.h>
 
/* FreeRTOS kernel includes. */
#include "FreeRTOS.h"
#include "task.h"
 
void vTask1( void *pvParameters )
{
    const char *pcTaskName = "Task 1 is running\r\n";
    volatile unsigned long ul;
    /* As per most tasks, this task is implemented in an infinite loop. */
    for( ;; )
    {
        /* Print out the name of this task. */
        vPrintString( pcTaskName );
        /* Delay for a period. */
        for( ul = 0; ul < mainDELAY_LOOP_COUNT; ul++ )
        {
        }
    }
}
 
void vTask2( void *pvParameters )
{
    const char *pcTaskName = "Task 2 is running\r\n";
    volatile unsigned long ul;
    /* As per most tasks, this task is implemented in an infinite loop. */
    for( ;; )
    {
        /* Print out the name of this task. */
        vPrintString( pcTaskName );
        /* Delay for a period. */
        for( ul = 0; ul < mainDELAY_LOOP_COUNT; ul++ )
        {
        }
    }
}
int main()
{
    // Create Task 1
    xTaskCreate( vTask1, "Task 1", 1000, NULL, 1, NULL);
    // Create Task 2
    xTaskCreate( vTask2, "Task 2", 1000, NULL, 1, NULL );
    // Start Scheduler
    vTaskStartScheduler();
    while(1);
    return 0;
}



I am getting lots of error, like vPrintString identifier not found and mainDELAY_LOOP_COUNT not found, then i thought that it might be possible that vPrintString is not available in newer version of FreeRTOS and i checked the demo they had used simple printf, by replacing these things i am not getting error related to vPrintString, but still there are some 12 errors related to task.c file.
Please someone check and help to get started.
(I had asked the similar question of freertos forums also)
Thanks in advance.
I just want to learn FreeRTOS and move into the world of RTOS
View attachment TaskTest.zip
 

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…