Errors compiling on Ubuntu Linux

aarc240 wrote on Monday, June 23, 2008:

Anyone care to comment on what the original intent was here?

In file included from … /Source/include/FreeRTOS.h:66,
                 from main.c:10:
… /Source/include/portable.h:252: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token

252:  portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE *pxTopOfStack, pdTASK_CODE pxCode, void *pvParameters );

… /Source/include/portable.h:265: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘xPortStartScheduler’

265:  portBASE_TYPE xPortStartScheduler( void );

In file included from main.c:10:
… /Source/include/FreeRTOS.h:71: error: expected declaration specifiers or ‘…’ before ‘*’ token
… /Source/include/FreeRTOS.h:71: warning: type defaults to ‘int’ in declaration of ‘portBASE_TYPE’
… /Source/include/FreeRTOS.h:71: error: ‘portBASE_TYPE’ declared as function returning a function

71:   typedef portBASE_TYPE (*pdTASK_HOOK_CODE)( void * );

The files in question all come from FreeRTOS v5.0.2, processor type AVRMega323, originally for WinAVR GCC.

New environment is Ubuntu Linux v8.04 latest stable, gcc-avr v 1:4.2.2-1, built on Code::Blocks v8.02 IDE.

Include directories are defined in Code::Blocks, not the makefile (which gets ignored / over-ridden by the IDE).

btw, no attempt has been made to use the distribution directory structure - it’s just too messy!

rtel wrote on Monday, June 23, 2008:

Did you define GCC_MEGA_AVR?  As per the provided makefile, -DGCC_MEGA_AVR.  If using Linux you may find some include files have incorrect capitalization.

>btw, no attempt has been made to use the distribution directory
>structure - it’s just too messy!

If you can come up with an alternative that allows 17 different architectures (plus their many derivatives) to all build the same code, while keeping all hardware specific code separate, and keeping any application specific code clear of the core source code - then I’m all ears :0)


davedoors wrote on Monday, June 23, 2008:

did you see ?

aarc240 wrote on Tuesday, June 24, 2008:

Fixed thanks, Richard.

Using my test area:
I didn’t have GCC_MEGA_AVR defined so added it, tried again.
No diff, so I had a ‘fiddle’ with the makefile to confirm my suspicion that it couldn’t be using the makefile at all.
Tracked down and changed that option in C::B, tried again and all appeared good.
Apparently the default compiler / linker options in C::B are close enough that it nearly works!
Removing -D GCC_MEGA_AVR doesn’t upset anything, I’ve yet to track down why but I suspect gcc-avr 4.2.2 doesn’t require it. Doesn’t appear to do any harm either way so it can stay in.

Now using the demo area:
OK, create a new C::B project in the demo directory, using both supplied demo makefile and main.c files and try again.
Created exactly the same output files as in the test area so the world is good again.

Next, I will have to put in the time to build some test apps to try on the hardware but I’m satisfied that it is functional.

The only modification to the demo makefile (so far!) is at line 384 where

clean: begin clean_list finished end

needed to be changed to

cleanall: begin clean_list finished end

as C::B expects to find ‘cleanall’ and I haven’t found any way of changing that.
Of course, it would be equally valid to simply add the ‘cleanall’ line as ‘clean’ would be ignored by C::B and ‘cleanall’ would be ignored by WinAVR.

FreeRTOS appears to build fine on Ubuntu 8.04 and gcc-avr 4.2.2 and using Code::Blocks v8.02 provides a nice IDE.
Maintenance of the application requires a small change to the makefile.

No errors found so far for case in filenames etc but I’ll tell you if / when I hit one.

No criticism re the directory structure, for what you have to deal with it’s probably the best I’ve ever seen.
At one point I wasn’t sure that errors weren’t occurring because of the sloppy Windows traits inherited with WinAVR and it just made it hard until I’d got a handle on the real problem!