There are several ways to set partial optimization.
(1) set individual file optimization:
Right click on one file, then set its optimization
Attachment:
1.png [ 16.25 KiB | Viewed 9762 times ]
Attachment:
2.png [ 77.89 KiB | Viewed 9361 times ]
Attachment:
3.png [ 7.38 KiB | Viewed 9361 times ]
Example:
Attachment:
demo-int-set-os.zip [128.8 KiB]
Downloaded 938 times
(2)
Syntax:
http://gcc.gnu.org/onlinedocs/gcc/Funct ... agmas.html#pragma GCC push_options
#pragma GCC optimize ("O0") // code ...
#pragma GCC pop_optionsReference: (Chinese page)
viewtopic.php?f=16&t=225&p=296 Example:
Attachment:
demo-int-pragma.zip [128.9 KiB]
Downloaded 998 times
(3)
Optimize single function to specific optimization level.
In the following code, it is set as -Os.
void
__attribute__ ((optimize("Os"))) __cpu_init()
{
unsigned int tmp;
/* turn on BTB */
tmp = 0x0;
__nds32__mtsr(tmp, NDS32_SR_MISC_CTL);
/* Set PSW INTL to 0 */
tmp = __nds32__mfsr(NDS32_SR_PSW);
tmp = tmp & 0xfffffff9;
/* ....*/
return;
}