0

How can I switch the optimization level of my compiler (xc16) on a different level for each function?

for example:

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

int_16_t main (void)         //compile with O2
{
.....
}
Mike
  • 4,041
  • 6
  • 20
  • 37

1 Answers1

0

I find the solution:

__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
{
.....
}
Mike
  • 4,041
  • 6
  • 20
  • 37