cancel
Showing results for 
Search instead for 
Did you mean: 

Hello, I use Cube IDE, I would like to insert directives for the compiler into the code, for different optimization of parts of the code. How to do it?

ONadr.1
Senior III
 
1 ACCEPTED SOLUTION

Accepted Solutions
KnarfB
Principal III

The underlying compiler is gcc, so check the docs https://gcc.gnu.org/onlinedocs/gcc/Function-Specific-Option-Pragmas.html.

Basically, something like

#pragma GCC push_options
#pragma GCC optimize ("O0")
 
void my_function() {
...
}
 
#pragma GCC pop_options

will do the trick

hth

KnarfB

View solution in original post

2 REPLIES 2
KnarfB
Principal III

The underlying compiler is gcc, so check the docs https://gcc.gnu.org/onlinedocs/gcc/Function-Specific-Option-Pragmas.html.

Basically, something like

#pragma GCC push_options
#pragma GCC optimize ("O0")
 
void my_function() {
...
}
 
#pragma GCC pop_options

will do the trick

hth

KnarfB

ONadr.1
Senior III

Thanks a lot 😀