2017-09-20 07:57 AM
To people switching their code over to the Low-Level (LL) Driver libraries from HAL for improved performance:
Surprise!!!
You may not actually be getting much better performance.
So it turns out that 'inline' doesn't really mean 'inline' to GCC. Rather, it is more like a hint that GCC is free to ignore. And does ignore in the default setting without optimizations (-O0).
Basically, if you want the LL driver library functions to be inlined (and thus actually significantly improve the performance over HAL), you need to specify an optimization level (i.e. -O1, -O2, -O3, -Os, -Og). I recommend -Og for debug builds as it doesn't enable optimizations that break the ability to debug. It appears that any optimization level past -O0 will inline functions.
I only noticed this because I was switching all my direct register access code over to LL and looked at the disassembly window when I hit a breakpoint.
2017-09-20 08:18 AM