Important changes to forums and questions
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
7 years, 10 months ago.
Can I control the level of optimization of the compiler?
Basically what the title says.. Is this possible? In order to avoid over optimization??
3 Answers
7 years, 10 months ago.
This may helps.
http://infocenter.arm.com/help/topic/com.arm.doc.dui0472l/chr1359124984478.html
#pragma O0 // makes minimum optimization level.
Please note that mbed online compiler option is -O3 -Otime by default.
https://github.com/mbedmicro/mbed/blob/master/workspace_tools/toolchains/arm.py
7 years, 10 months ago.
I don't know if this is possible in the online compiler, but if you export to GCC ARM then you can control optimisations by editing the CC_FLAGS variable in the Makefile.
7 years, 10 months ago.
Hello,
Perhaps this isn't exactly what you are looking for but in some situations it could help:
By declaring a variable as volatile
one can prevent the compiler from optimizing the code associated with that variable.