Creating new project at free RTOS

crippler1 wrote on Sunday, March 08, 2015:

Hi

I have problem creating new project at win32 simulator,using eclipse.

I have defined to the eclipse , all the relevant paths of includes, and add the all relevant
source files as told at : http://www.freertos.org/Creating-a-new-FreeRTOS-project.html

I have lots of link errors, for example:

undefined reference prvTraceGetCurrentTaskHandle at task.c queue.c etc

Please help

rtel wrote on Sunday, March 08, 2015:

You have probably included definitions for the trace macros, but not included the FreeRTOS+Trace recorder source file.

Is "trcKernelPort.h" being included from FreeRTOSConfig.h?  The #include will probably be at the bottom of the source file if it is.  That is the header file that defines the trace macros, so if you comment out the inclusion of the header file then those errors should disappear.  

If you have any other build errors then post the compiler's output here.

Regards.

crippler1 wrote on Sunday, March 08, 2015:

The “trcKernelPort.h” file should not be included?

rtel wrote on Sunday, March 08, 2015:

If trcKernelPort.h is included then you must also include the
FreeRTOS+Trace recorder source files - otherwise you will get linker errors.

If you are creating a new project I would recommend not including
trcKernelPort.h, so commenting it out. Once you have your project
running you can always add in the trace recorder at a later time.

Regards.

crippler1 wrote on Sunday, March 08, 2015:

The link errors occurs , even when I include the FreeRTOS+Trace recorder source files.

the path is:

C:\FreeRTOS\FreeRTOS\Demo\WIN32-MingW\Trace_Recorder_Configuration

crippler1 wrote on Sunday, March 08, 2015:

I have new problem now:

I have written little test:

#include <stdio.h>

#include “FreeRTOS.h”
#include “task.h”
#include “queue.h”
#include “timers.h”

int main(void)
{
xTaskStartScheduler();
while(1);
return 0;
}

the compiler outputs:

undefined reference to `xTaskStartScheduler’ main.c ‪/FirstFreeRTOSPRoj‬ line 11 C/C++ Problem
as an error

and

implicit declaration of function ‘xTaskStartScheduler’ [-Wimplicit-function-declaration] as a warning

rtel wrote on Sunday, March 08, 2015:

The link errors occurs , even when I include the FreeRTOS+Trace recorder source files.

Generally when debugging or building I would be tempted to consolidate what I have, or remove functionality to get a clean building base from where to work - rather than add more files in when what I have is already not building.

undefined reference to `xTaskStartScheduler’ main.c ‪/FirstFreeRTOSPRoj‬ line 11 C/C++
Problem as an error

Ah good, sounds like you have made progress then. This one is easy to fix; The name of the function is vTaskStartScheduler() [note the v prefix, rather than the x prefix, because it is a void function].

Regards.

crippler1 wrote on Sunday, March 08, 2015:

Hi
Thanks for replying,

I changed it to, vTaskStartScheduler()

still have the error code

rtel wrote on Sunday, March 08, 2015:

What error code? Undefined reference to xTaskStartScheduler()?

Regards.

crippler1 wrote on Sunday, March 08, 2015:

No,

What error code? Undefined reference to vTaskStartScheduler()

undefined reference to `vTaskStartScheduler’ main.c ‪/FirstFreeRTOSPRoj‬ line 11 C/C++ m

crippler1 wrote on Sunday, March 08, 2015:

No,

Undefined reference to vTaskStartScheduler()

undefined reference to `vTaskStartScheduler’ main.c ‪/FirstFreeRTOSPRoj‬ line 11 C/C++ m

davedoors wrote on Sunday, March 08, 2015:

Why dont you start with the example in the download that is already building then just remove the code you dont want?

crippler1 wrote on Sunday, March 08, 2015:

Hi Dave, thanks for replying

Already done it, and it works.

But as a programmer, I need to know the problems and try to solve them, not
eliminate them.

crippler1 wrote on Sunday, March 08, 2015:

Hi guys

I assume you don’t have any solution for me?

crippler1 wrote on Sunday, March 08, 2015:

Hi guys

I solved the last problem, with the error Undefined reference to vTaskStartScheduler()

by adding the source files queue.c list.c task.c and port.c

But now, I get the old problem:

Description Resource Path Location Type
undefined reference to prvTraceGetCurrentTaskHandle' queue.c ‪/FirstFreeRTOSPRoj‬ line 1502 C/C++ Problem undefined reference to prvTraceGetCurrentTaskHandle’ queue.c ‪/FirstFreeRTOSPRoj‬ line 1396 C/C++ Problem
more undefined references to vAssertCalled' follow port.c ‪/FirstFreeRTOSPRoj‬ line 514 C/C++ Problem more undefined references to vAssertCalled’ follow queue.c ‪/FirstFreeRTOSPRoj‬ line 620 C/C++ Problem
more undefined references to vAssertCalled' follow queue.c ‪/FirstFreeRTOSPRoj‬ line 1729 C/C++ Problem undefined reference to prvTraceGetCurrentTaskHandle’ tasks.c ‪/FirstFreeRTOSPRoj‬ line 876 C/C++ Problem
undefined reference to prvTraceGetCurrentTaskHandle' queue.c ‪/FirstFreeRTOSPRoj‬ line 1016 C/C++ Problem undefined reference to prvTraceGetCurrentTaskHandle’ queue.c ‪/FirstFreeRTOSPRoj‬ line 928 C/C++ Problem

and more and more

please help

tlafleur wrote on Sunday, March 08, 2015:

Look at the project that works and see what files and configuration it uses
and compare it to your new project…
This is all very basic setup of the IDE your using and NOT directly related
to FreeRTOS issues…
Make sure the FreeRTOSconfig.h is set with the correct option for your
development…
Make sure you have the correct port.c file for your processor…
Make sure the IDE knows the path to all of the .h and .c files…
Search the forum, you will most likely find solutions to all of your
questions…
The issue you have are very easy to solve. Just look!, then you will
understand…

good luck…

crippler1 wrote on Sunday, March 08, 2015:

Hi guys

I solved the problem

it seems that in win32 simulator

there are some functions defined at main.c
that some source files defined them as external function.

Therefore when creating new project, at the main file these functions
have to appear(and defined correctly).

rtel wrote on Sunday, March 08, 2015:

I assume you don’t have any solution for me?

We can’t offer solutions if we don’t know what the problem is. For
example…

I solved the last problem, with the error Undefined reference to
vTaskStartScheduler()
by adding the source files queue.c list.c task.c and port.c

As your first post referenced a documentation page that tells you to add
these files
(http://www.freertos.org/Creating-a-new-FreeRTOS-project.html), it would
not occur to a responder on the forum that in fact you had not included
the files - but were trying to call functions in them - hence they would
not offer that as a potential solution.

it seems that in win32 simulator
there are some functions defined at main.c
that some source files defined them as external function.
Therefore when creating new project, at the main file these functions
have to appear(and defined correctly).

…except that is not the case. The Windows port has no more
dependencies than any other port. It looks like your FreeRTOSConfig.h
file is defining macros that call functions that are not part of the
FreeRTOS code - that does not mean you have to define the functions to
use the Windows port - just that you have to define any function that
you actually try calling. In particular in this case I think your
configASSERT() function is calling vAssertCalled(). configASSERT() is
an application definition, it is not defined by FreeRTOS.

Regards.

crippler1 wrote on Monday, March 09, 2015:

Hi thanks for replying,

three questions:

1)What about all the hook functions and demonstration functions at main.c and main_full.c
do I really need them?
2)It seems that there are other source files that I need to add in addition to what
http://www.freertos.org/Creating-a-new-FreeRTOS-project.html tells, like BlockQ.c
Can you explain me what are those files?

3)Which free RTOS files has external dependencies of application functions created on main.c
and main_full.c?

Thanks

rtel wrote on Monday, March 09, 2015:

1)What about all the hook functions and demonstration functions at
main.c and main_full.c do I really need them?

http://www.freertos.org/a00016.html

2)It seems that there are other source files that I need to add in
addition to what
http://www.freertos.org/Creating-a-new-FreeRTOS-project.html tells,

I don’t think so. Your C compiler will need other functions, like
main(), but FreeRTOS doesn’t.

like
BlockQ.c
Can you explain me what are those files?

Read the documentation page for the port you are using, and
http://www.freertos.org/a00102.html

3)Which free RTOS files has external dependencies of application
functions created on main.c
and main_full.c?

None. main.c and main_full.c are not FreeRTOS files, they are just
entry points into a demo application that uses FreeRTOS.

Regards.