Quality RTOS & Embedded Software

 Real time embedded FreeRTOS RSS feed 
Quick Start Supported MCUs PDF Books Trace Tools Ecosystem TCP & FAT




Loading

Creating new project at free RTOS

Posted by crippler1 on March 8, 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


Creating new project at free RTOS

Posted by rtel on March 8, 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.

Creating new project at free RTOS

Posted by crippler1 on March 8, 2015

The "trcKernelPort.h" file should not be included?


Creating new project at free RTOS

Posted by rtel on March 8, 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.


Creating new project at free RTOS

Posted by crippler1 on March 8, 2015

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

the path is:

C:FreeRTOSFreeRTOSDemoWIN32-MingWTraceRecorderConfiguration


Creating new project at free RTOS

Posted by crippler1 on March 8, 2015

I have new problem now:

I have written little test:

include
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


Creating new project at free RTOS

Posted by rtel on March 8, 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.


Creating new project at free RTOS

Posted by crippler1 on March 8, 2015

Hi Thanks for replying,

I changed it to, vTaskStartScheduler()

still have the error code


Creating new project at free RTOS

Posted by rtel on March 8, 2015

What error code? Undefined reference to xTaskStartScheduler()?

Regards.


Creating new project at free RTOS

Posted by crippler1 on March 8, 2015

No,

What error code? Undefined reference to vTaskStartScheduler()

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


Creating new project at free RTOS

Posted by crippler1 on March 8, 2015

No,

Undefined reference to vTaskStartScheduler()

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


Creating new project at free RTOS

Posted by davedoors on March 8, 2015

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


Creating new project at free RTOS

Posted by crippler1 on March 8, 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.


Creating new project at free RTOS

Posted by crippler1 on March 8, 2015

Hi guys

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


Creating new project at free RTOS

Posted by crippler1 on March 8, 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 toprvTraceGetCurrentTaskHandle' 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 tovAssertCalled' 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 toprvTraceGetCurrentTaskHandle' tasks.c ‪/FirstFreeRTOSPRoj‬ line 876 C/C++ Problem undefined reference to prvTraceGetCurrentTaskHandle' queue.c ‪/FirstFreeRTOSPRoj‬ line 1016 C/C++ Problem undefined reference toprvTraceGetCurrentTaskHandle' queue.c ‪/FirstFreeRTOSPRoj‬ line 928 C/C++ Problem

and more and more

please help


Creating new project at free RTOS

Posted by tlafleur on March 8, 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...


Creating new project at free RTOS

Posted by crippler1 on March 8, 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).


Creating new project at free RTOS

Posted by rtel on March 8, 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.


Creating new project at free RTOS

Posted by crippler1 on March 9, 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


Creating new project at free RTOS

Posted by rtel on March 9, 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.


Creating new project at free RTOS

Posted by crippler1 on March 9, 2015

Thanks for replying

Unfortuenatley that's not help. I just want to create new project, and I always get link errors, when I get over one error, I get 10 more.

It's a shame that creating new project is so complicating.

I hope that in real embedded circuits it is not the same.


Creating new project at free RTOS

Posted by rtel on March 9, 2015

There is no difference between using the Windows port and a real embedded target.

1) Start with a working project that builds and runs in your environment.

2) Add in the very few FreeRTOS source files as per the instructions on the web, along with a minimal FreeRTOSConfig.h file. Ensure the FreeRTOS include path and the path to FreeRTOSConfig.h is in the compiler's include path. Start with something simple, not something that is taken from an example that is described as "comprehensive" in the documentation, as you have done. Read the documentation so you know how to strip back FreeRTOSConfig.h.

3) Ensure the application still builds.

4) Start using the API you have just made available in your application.

I think most of your problems are C compiling and linking problems, not FreeRTOS problems. For example, if I were doing this and got a linker problem telling me vAssertCalled() was not defined I would have taken the following steps.

1) grep'ed the directory to see where vAssertCalled() was used, and noticed it was called by the configASSERT() macro.

2) Searched the FreeRTOS website or googled configASSERT() and seen it was optional and defined by the user not FreeRTOS, so just removed the definition or commented it out for later.

3) Re-compiled and seen that the linker error no longer happened, and moved on to investigate the next linker error.

I would have expected it to take me about 5 minutes to take the above corrective steps.

Your linker errors are nothing to do with FreeRTOS per se.

Regards.


Creating new project at free RTOS

Posted by crippler1 on March 9, 2015

Hi

I really don't know what to do anymore

I tried everything you told me, still nothing

please see the attached file

test.c is the main file

Thanks

Attachments

FreeRTOS.bmp (7016430 bytes)

Creating new project at free RTOS

Posted by rtel on March 9, 2015

Try

  • removing all the header file inclusions other than FreeRTOS.h and task.h

  • removing the source files that start trc

If that does not work, clean out all the intermediary files (object files and the like), zip up your project (should not be more than a few K of code) and attach the project to a post.

Regards.


Creating new project at free RTOS

Posted by crippler1 on March 9, 2015

Hi

I have attached my project

thanks

Attachments

Test.zip (83798 bytes)

Creating new project at free RTOS

Posted by rtel on March 9, 2015

The project you attached does not include any header files.


Creating new project at free RTOS

Posted by crippler1 on March 9, 2015

Hi

I have kept to analyze, until I got link errors of win API functions, so after checking I have noticed that the the linker of win32 winmm was not defined for the project, after defining the problem was solved.


[ Back to the top ]    [ About FreeRTOS ]    [ Sitemap ]    [ ]




Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.

Latest News

FreeRTOS kernel V10 is available for immediate download. Now MIT licensed.


FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

IAR Partner

Microchip Premier RTOS Partner

RTOS partner of NXP for all NXP ARM microcontrollers

STMicro RTOS partner supporting ARM7, ARM Cortex-M3, ARM Cortex-M4 and ARM Cortex-M0

Texas Instruments MCU Developer Network RTOS partner for ARM and MSP430 microcontrollers

OpenRTOS and SafeRTOS