This pragma instructs the compiler to perform optimizations to reduce image size at the expense of a possible increase in execution time. [img][/img]Usage
This pragma enables you to assign optimization goals to individual functions.
[img][/img]Restriction
The pragma must be placed outside the function.
#pragma Onum
ARM Compiler toolchain v4.1 for µVision Compiler Reference
This pragma instructs the compiler to perform optimizations to reduce execution time at the expense of a possible increase in image size. [img][/img]Usage
This pragma enables you to assign optimization goals to individual functions.
[img][/img]Restriction
The pragma must be placed outside the function.
#pragma push
ARM Compiler toolchain v4.1 for µVision Compiler Reference
对某个变量加关键字volatile或者对某个文件单独设置优化等级!
1 选中文件
2 设置优化登记
#pragma push
#pragma XXXXXXX
#pragma pop
你这样的话对整个工程都不进行优化了!
楼主试一下:
#undef levelxx
function()
{
...
}
#define levelxx
我已经说了对某个单独的文件设置优化等级不是对整个工程,如果需要可以将不优化的函数都放在这个文件里。
多谢
3Q
多谢,能否再解释一句
参考手册(compiler user guide)吧:
#pragma Ospace
#pragma Ospace
This pragma instructs the compiler to perform optimizations to reduce image size at the expense of a possible increase in execution time.
[img][/img]Usage
This pragma enables you to assign optimization goals to individual functions.
[img][/img]Restriction
The pragma must be placed outside the function.
#pragma Onum
#pragma Onum
This pragma changes the optimization level.
[img][/img]Syntax
#pragma OnumWhere:
numis the new optimization level.
The value of num is 0, 1, 2 or 3.
[img][/img]Usage
This pragma enables you to assign optimization levels to individual functions.
[img][/img]Restriction
The pragma must be placed outside the function.
#pragma Otime
#pragma Otime
This pragma instructs the compiler to perform optimizations to reduce execution time at the expense of a possible increase in image size.
[img][/img]Usage
This pragma enables you to assign optimization goals to individual functions.
[img][/img]Restriction
The pragma must be placed outside the function.
#pragma push
#pragma push
This pragma saves the current pragma state.
#pragma pop
#pragma pop
This pragma restores the previously saved pragma state.
明白了,非常感谢啊