如何为每个函数部分切换编译器的优化级别?
How to switch the optimization level of the compiler partially for every function?
如何为每个函数切换不同级别的编译器 (xc16) 优化级别?
例如:
void _ISR _T1Interrupt //compile with O0
{
.....
}
int_16_t main (void) //compile with O2
{
.....
}
我找到了解决方案:
__attribute__((optimize("-O0")) //optimization for the next function is O0
void _ISR _T1Interrupt //compile with O0
{
.....
}
__attribute__((optimize("-O2")) //optimization for the next function is O2
int_16_t main (void) //compile with O2
{
.....
}
如何为每个函数切换不同级别的编译器 (xc16) 优化级别?
例如:
void _ISR _T1Interrupt //compile with O0
{
.....
}
int_16_t main (void) //compile with O2
{
.....
}
我找到了解决方案:
__attribute__((optimize("-O0")) //optimization for the next function is O0
void _ISR _T1Interrupt //compile with O0
{
.....
}
__attribute__((optimize("-O2")) //optimization for the next function is O2
int_16_t main (void) //compile with O2
{
.....
}