I’m using STM32 Cube IDE suite for STM32 development. This suite is based on Eclipse and GCC and it works quite well. In a recent project I was looking for some optimization I could apply on top of the basic existing settings to reduce the FLASH and RAM size.
In this post I want to share what I found and how it helped me.
Here is the situation : you have a function in an archive but you do not have the source code. And you would like to change the behavior of this function or intercept the call to this function.
This is possible with gcc and the -Wl,-wrap linker options. Thanks to this option you can create a new function starting by __wrap_ followed by the function name. This function will be called instead of the original one. In the function you can decide to call the original function by using its name starting by __real_