Hi,
I have one question about pragma in mcuxpresso
I want to prevent some lines in my source code from compiler optimization.
Which pragma should I use?
You can try : _attribute__((optimize("O4")))
#if ((defined __GNUC__) && (CPU_CORE == ARM_CORTEX_M))
#define SIZE_OPTIMIZATION __attribute__((optimize("O4")))
#else
#define SIZE_OPTIMIZATION
#endif
void SIZE_OPTIMIZATION testFun(void)
{
uint16_t i=0,j=0;
for(i=0;i<100;i++)
{
j=i+1;
PRINTF("j=%d",&j);
}
}
Wish it helps you!
If you still have questions about it, please kindly let me know.
Kerry
-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!
- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------