Optimizations in IAR¶
Project-Wide Optimizations¶
Project Options → C/C++ Compiler → Optimizations
Project-level optimization setting in IAR¶
Single-File Optimizations¶
Right-click on the file in the Workspace pane.
Choose Options.
Check Override inherited Settings.
Choose the optimization level.
Single-Function Optimizations¶
Warning
Pragmas are very specific to the toolchain, and may lead to non-reusable code. Be careful where you use these.
Use #pragma optimize=none before the function definition to deoptimize the entire function, that is, as follows.
Function-level optimization setting in IAR¶
#pragma optimize=none
static void myFunction(int number)
{
// ...
return yourFunction(other_number);
}