__inline, ARM7 and IAR compiler

mikej42 wrote on Tuesday, December 11, 2007:

Hello All

I am using the IAR ewarm (4.42a) with freeRTOS 4.5.0 at present, and am looking into using some __inline functions.

I find that portmacro.h for the IAR compiler and at91sam7s includes #define inline in Compiler specifics, so that I still don’t get inlining even with #define __inline inline added.

If I comment out the #define in portmacros.h the compiler objects to two basic functions:vTaskSwitchContext and vTaskIncrementSwitch, both apparently because they are declared as __inline in the header file, and defined in the source file the same way, which the IAR compiler doesn’t seem able to cope with.

To keep rolling on I have commented out the __inline tags, but this doesn’t seem the correct way forward.

Do these functions need to be __inline? Is inlining significant in gaining speed of operation?

Any thoughts welcomed

Mike Newsome

Hitek Power Ltd, England

rtel wrote on Tuesday, December 11, 2007:

The inline thing is a legacy from one of the first ports and is a PITA now.  It should be removed.

The #define in portmacro.h is to prevent the problem you are finding when you comment it out.  The order in which the include files are listed should be such that the #define does not effect other include files (it comes after), but will your own code.  The library files provided by atmel make heavy use of inlines, but these should work correctly the way things are at the moment.


mikej42 wrote on Tuesday, December 11, 2007:

Thanks, Richard

I wanted to make use if a bit of inlining for speed, and was starting to play around with it.

I have commented out the bits in question while I play, and will decide later!

While I understand the concept of in line code, it seems that IAR at least _may_ not inline it, and in this case would put a copy of the function in every module that calls it!

There is also a #pragma inline, but I feel the keyword is more useful - it can be #defined away!

Many thanks

Mike Newsome