When I'm using MCUX IDE for RT1170 develop, I found most inline functions are actually not inlined, but invoked as a normal function. What went wrong? I can't find anywhere to configure such behavior in the compiler settings.
Such as "MC_PWM_UPDATE" function, it should be inlined, but it's treated as a NOT inline function:
static inline void MC_PWM_UPDATE(GMCLIB_3COOR_T_F16 *psDuty)
See attached project.
Hi @ErichStyger ,
This project has no optimization at all. So I think it should stick to C grammar. I can confirm that inline functions are invoked in the runtime. Do you know any macro or keywords that can make sure functions can be inlined in GCC? Thanks.
Hi @sutter_zhou ,
'inline' is just a hint for the compiler: if it is getting inline or not is depending on the compiler decision.
If you really want to have things inlined, you need to use a macro for the code.
Checking the map file if a symbol/function is there does not tell you if it is inlined or not: you need to check the actual calls, because if you take the address of an inlined function there will be both inlined and non-inlined versions.
And check your compiler/optimization settings: if you optimize for code size, the compiler likely will not inline as this in general increases the code size. If not already set: optimize for speed.
I hope this helps,
Erich