how can i set the optimization level for a file?

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

how can i set the optimization level for a file?

跳至解决方案
3,493 次查看
matherinewang
Contributor III

Hi all,

In the KDS, i can set the project optimization level as -O0  -O1 -O2 or - O3.

But i want to modify the optimization level for one file in this project, i right click the file, select properties->c/c++ build->setting, but no optimization level here.

How an i set the optimization for a file, is it already support in KDS?

标签 (1)
0 项奖励
回复
1 解答
1,990 次查看
BlackNight
NXP Employee
NXP Employee

Hi Matherine,

use the 'other compiler flags':

pastedImage_0.png

Erich

在原帖中查看解决方案

0 项奖励
回复
3 回复数
1,990 次查看
tharonhall
Contributor IV

I have used the following #pragma using GCC ARM in Atmel Studio and I am hoping to re-use the technique with my KDS development:

//------------------------------------------------------------------------

//------  Set optimization level for this module  ------------------------

//------  Overrides global settings  -------------------------------------

//------------------------------------------------------------------------

//Values are 0 for no optimization, to 3 for most. "s" is for size

#pragma GCC optimize ("Os")

There is more than one way to express this to GCC, but this is the form I have been using successfully for some time now.

BTW - I am looking for feedback as to the difference between the "Cross ARM Compiler" in KDS and the "GNU ARM Compiler" - Difference between the "Cross ARM C++ Compiler" and the "GNU ARM C++ Compiler"?

0 项奖励
回复
1,991 次查看
BlackNight
NXP Employee
NXP Employee

Hi Matherine,

use the 'other compiler flags':

pastedImage_0.png

Erich

0 项奖励
回复
1,990 次查看
matherinewang
Contributor III

Thanks Erich, It works for me.

0 项奖励
回复