AnsweredAssumed Answered

Problem with code geting optimized out

Question asked by David Pfaltzgraff on Jul 5, 2015
Latest reply on Jul 6, 2015 by David Pfaltzgraff

I am trying to debug an SPI implementation and found that in the pin_mux_SPI() routine where the code is:

 

     /* PORTD_PCR4 */

     PORT_HAL_SetMuxMode(PORTD,4u,kPortMuxAlt7);

     /* PORTD_PCR5 */

     PORT_HAL_SetMuxMode(PORTD,5u,kPortMuxAlt7);

     /* PORTD_PCR6 */

     PORT_HAL_SetMuxMode(PORTD,6u,kPortMuxAlt7);

     /* PORTD_PCR7 */

     PORT_HAL_SetMuxMode(PORTD,7u,kPortMuxAlt7);

 

Only the first PORT_HAL_SetMuXMode insatance is executed. It appears that the remaining lines get optimized out. I tested this by setting the optimization level to None and all the lines get executed.

 

Is there a setting that would allow me to say "Don't optimize this section"?

 

More importantly, can the compiler be fixed?

 

My environment is for the FRDM-K22F board and KDS version 3.0.0 with KSDK version 1.2.0 running on Windows 7.

 

Thanks

Outcomes