0

如何为每个函数在不同级别上切换编译器 (xc16) 的优化级别?

例如:

void _ISR _T1Interrupt    //compile with O0
{
.....
}

int_16_t main (void)         //compile with O2
{
.....
}
4

1 回答 1

0

我找到了解决方案:

__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
{
.....
}
于 2018-07-13T10:00:43.703 回答