AnsweredAssumed Answered

__inline functions for Coldfire V1 / CW 6.3.2

Question asked by Doug Paulsen on May 28, 2014
Latest reply on Jun 5, 2014 by Jorge_Gonzalez



I am having trouble understanding how the keyword "__inline" works in CW 6.3 and plain ol' C language for Coldfire processors.


It seems that functions declared __inline within a file and "called" from elsewhere within that same file are at least compiling okay.  When the function declared in-lined resides in one file and is "called" from multiple other files, the linker is unable to figure it out (I get a Link Error : Undefined "<function name>").


Am I doing anything obviously wrong, or is this just the way in-lining works?  I have function prototypes with the the "__inline" keyword, but it looks as though in-lining only works within a single file.


Thanks for any suggestions to get around this apparent limitation.


....just thinking - free association type thoughts, but perhaps the way around this is to put the __inline declared functions in a single dotH file and then include that dotH file in all files where the in-lined functions are referenced?  That seems reasonable, but I hope I don't have to explain the confusing code to anyone.... 


All this effort is, by the way, to eliminate (as near as possible) and function calls from within ISRs.  I'm not aware how CodeWarrior works, but IAR documentation warns that function calls from within interrupts are not only time consuming, but the IAR compiler also cannot guarantee any extra registers used in the called functions will be saved upon ISR entry.  Consequently, all this effort to inline common code rather than make it function calls.  Bother!