how can i set the optimization level for a file?

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

how can i set the optimization level for a file?

Jump to solution
3,453 Views
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?

Labels (1)
0 Kudos
Reply
1 Solution
1,950 Views
BlackNight
NXP Employee
NXP Employee

Hi Matherine,

use the 'other compiler flags':

pastedImage_0.png

Erich

View solution in original post

0 Kudos
Reply
3 Replies
1,950 Views
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 Kudos
Reply
1,951 Views
BlackNight
NXP Employee
NXP Employee

Hi Matherine,

use the 'other compiler flags':

pastedImage_0.png

Erich

0 Kudos
Reply
1,950 Views
matherinewang
Contributor III

Thanks Erich, It works for me.

0 Kudos
Reply