Quality RTOS & Embedded Software

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




Loading

Compiling FreeRTOS with WinAVR and Eclipse

Posted by OK on September 26, 2008
Hello,

I am trying to compile Demo FreeRTOS application with WinAVR and eclipse IDE. These things have happened ....
1) First it was refusing to compile at all.
2) Then, I have included following definition at the command line ..
-DGCC_MEGA_AVR
So then finally it could compile all source files
But ....

It gave errors in the linking step, saying, almost all RTOS related functions are undefined !!

What to do ? How to make it link ?

------------------------------------------------------------------------
This is the entire eclipseworkspace that I am using for compiling my code, you
can download it for testing :
http://rapidshare.com/files/148556548/EclipseWorkSpace.rar.html
------------------------------------------------------------------------

Here are the linker's error messages :
Building target: AVR_RTOS_TRY.elf
Invoking: AVR C Linker
avr-gcc -Wl,-Map,AVR_RTOS_TRY.map -s -mmcu=atmega32 -o"AVR_RTOS_TRY.elf" ./main.o ./regtest.o ./serial/serial.o ./ParTest/ParTest.o ./FreeRTOS/Source/croutine.o ./FreeRTOS/Source/list.o ./FreeRTOS/Source/queue.o ./FreeRTOS/Source/tasks.o ./FreeRTOS/Source/portable/GCC/ATMega323/port.o ./FreeRTOS/Demo/Common/Minimal/AltBlckQ.o ./FreeRTOS/Demo/Common/Minimal/AltBlock.o ./FreeRTOS/Demo/Common/Minimal/AltPollQ.o ./FreeRTOS/Demo/Common/Minimal/AltQTest.o ./FreeRTOS/Demo/Common/Minimal/BlockQ.o ./FreeRTOS/Demo/Common/Minimal/GenQTest.o ./FreeRTOS/Demo/Common/Minimal/PollQ.o ./FreeRTOS/Demo/Common/Minimal/QPeek.o ./FreeRTOS/Demo/Common/Minimal/blocktim.o ./FreeRTOS/Demo/Common/Minimal/comtest.o ./FreeRTOS/Demo/Common/Minimal/countsem.o ./FreeRTOS/Demo/Common/Minimal/crflash.o ./FreeRTOS/Demo/Common/Minimal/crhook.o ./FreeRTOS/Demo/Common/Minimal/death.o ./FreeRTOS/Demo/Common/Minimal/dynamic.o ./FreeRTOS/Demo/Common/Minimal/flash.o ./FreeRTOS/Demo/Common/Minimal/flop.o ./FreeRTOS/Demo/Common/Minimal/integer.o ./FreeRTOS/Demo/Common/Minimal/recmutex.o ./FreeRTOS/Demo/Common/Minimal/semtest.o

./FreeRTOS/Source/croutine.o: In function `xCoRoutineCreate':
croutine.c:(.text+0x2ae): undefined reference to `pvPortMalloc'
./FreeRTOS/Source/queue.o: In function `vQueueDelete':
queue.c:(.text+0x2fe): undefined reference to `vPortFree'
queue.c:(.text+0x304): undefined reference to `vPortFree'
./FreeRTOS/Source/queue.o: In function `xQueueCreate':

.... and so on ... lots of such errors. All errors of the type "undefined reference to xxx"
------------------------------------------------------------------------


Please help.

Thanks.



RE: Compiling FreeRTOS with WinAVR and Eclipse

Posted by Jesper Matthiesen on September 26, 2008
It seems like you haven't included the FreeRTOS source code into the build, but only the include files.. therefore, the FreeRTOS don't get compiled and hence you have missing object files..

either use the "create /link folder" feature under "source location" and filter out all files not related to the port you are using, or copy the needed port+generic files into your project..

nb. i didn't look at your workspace files..

cheers

RE: Compiling FreeRTOS with WinAVR and Eclipse

Posted by OK on September 27, 2008
Thank you for reply.

Please have a look at workspace files. I have copied all necessary files to my trial project directly preserving the directory structure of RTOS. All RTOS's core files, namely , croutine.c,list.c,task.c,queue.c and ".O" files are being generated for the same. If you look at linked command line posted in the earlier post ... it clearly include all ".o" files. Still its not linking.

Also I am getting many warnings like ...
../FreeRTOS/Demo/Common/Minimal/AltBlckQ.c:300: warning: array subscript has type 'char'
../FreeRTOS/Source/croutine.c:316: warning: dereferencing type-punned pointer will break strict-aliasing rules

What does it mean ?

RE: Compiling FreeRTOS with WinAVR and Eclipse

Posted by Jesper Matthiesen on September 28, 2008
hmm... maybe i misunderstood you when you said "lots of such errors".. are those errors all concerning the same 3 function names? because then it's probably because you need to include one of the "heap_x.c" files from the "memmang" folder..

read this for more info: http://www.freertos.org/a00111.html

cheers..

RE: Compiling FreeRTOS with WinAVR and Eclipse

Posted by OK on September 29, 2008
I GOT IT !!! However solution is problematic ...

This was the situation ...
- Demo was getting compiled but was not able to link.
- It was giving errors ...
undefined reference to "xQueueAltGenericSend"
undefined reference to "xQueueAltGenericReceive"
undefined reference to "vTaskPrioritySet"
undefined reference to "xQueueCreateMutex"
undefined reference to "uxTaskPriorityGet"
undefined reference to "xQueueTakeMutexRecursive"
undefined reference to "xQueueGiveMutexRecursive"

This is what I found ...
- Code got linked after adding/changing following DEFINITIONs in FreeRTOSconfig.h

//Changed from ZERO to 1
#define INCLUDE_vTaskPrioritySet1
#define INCLUDE_uxTaskPriorityGet1

//Added these things ...
#define configUSE_MUTEXES1
#define configUSE_COUNTING_SEMAPHORES1
#define configUSE_RECURSIVE_MUTEXES1
#define configUSE_ALTERNATIVE_API 1

- This means linker tries to put codes for all the functions which are declared in the RTOS header files, even though these functions are not used anywhere in the DEMO code, thereby making huge hex file, which runs out of the available flash memory.


Thus, is there any command line switch to the linker, which will make linker skip all those functions which are not used in the demo files ?????










RE: Compiling FreeRTOS with WinAVR and Eclipse

Posted by Jesper Matthiesen on September 29, 2008
The linker does *not* include code just because you have the function prototypes included, but by setting all those "configXXX" to 1, you include all sorts of stuff you don't need.. instead of just including everything with your head under your arm, you should think about what you are doing and only include the stuff you need..

For instance you don't need to include the ALTernative API, if you only use the full API..

regarding having the linker exclude stuff you don't need, you can make the compiler put each function in its own section and then have the linker ignore unreferenced sections, but this is only a solution to your symptoms, not the actual problem..

cheers..


RE: Compiling FreeRTOS with WinAVR and Eclipse

Posted by OK on September 29, 2008
Yes thats correct.


Got it .... !!

I have created new project in eclipse and included only those files in the compilation which were needed (I referred makefile provided with the demo). Though it is problematic process in eclipse to add only necessary files to workspace, as we have to create link to every required file(source files of RTOS) in the filesystem.

After that it got compiled and linked successfully !!! Hurrryeee !

Is there any other automatic way to tell this to eclipse ? Like, say in VC, it is sufficient to include the file by writing #include and it gets compiled automatically.


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




Copyright (C) 2004-2010 Richard Barry. Copyright (C) 2010-2016 Real Time Engineers Ltd.
Any and all data, files, source code, html content and documentation included in the FreeRTOSTM distribution or available on this site are the exclusive property of Real Time Engineers Ltd.. See the files license.txt (included in the distribution) and this copyright notice for more information. FreeRTOSTM and FreeRTOS.orgTM are trade marks of Real Time Engineers Ltd.

Latest News:

FreeRTOS V9.0.0 is now available for download.


Free TCP/IP and file system demos for the RTOS


Sponsored Links

⇓ Now With No Code Size Limit! ⇓
⇑ Free Download Without Registering ⇑


FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

Renesas Electronics Gold Alliance RTOS Partner.jpg

Microchip Premier RTOS Partner

RTOS partner of NXP for all NXP ARM microcontrollers

Atmel RTOS partner supporting ARM Cortex-M3 and AVR32 microcontrollers

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

Xilinx Microblaze and Zynq partner

Silicon Labs low power RTOS partner

Altera RTOS partner for Nios II and Cortex-A9 SoC

Freescale Alliance RTOS Member supporting ARM and ColdFire microcontrollers

Infineon ARM Cortex-M microcontrollers

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

Cypress RTOS partner supporting ARM Cortex-M3

Fujitsu RTOS partner supporting ARM Cortex-M3 and FM3

Microsemi (previously Actel) RTOS partner supporting ARM Cortex-M3

Atollic Partner

IAR Partner

Keil ARM Partner

Embedded Artists