Setting the optimization on a single source file.

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

Setting the optimization on a single source file.

Jump to solution
1,412 Views
MTBer
Contributor I
I would like to find out how to set the optimization of a single source file in my project for speed and leave the rest the same as it currently stands (size). 
 
I have searched through this forum and help files and already spend hours on this.  Searched all the settings in the IDE etc.  I'm dying here
 
It's for an HCS12XE device and Codewarrior version 4.6.  Hope this is enough info.
 
Then, off the topic, my email address changed a few years back, but are still forwarded to my new address.  One day soon, the alias will be killed and then I won't be able to log into this forum anymore.  Does anyone know how to change this email address?
 
Thanks in advance for all you great answers,
MTBer
Labels (1)
Tags (1)
0 Kudos
1 Solution
421 Views
CrasyCat
Specialist III
Hello
 
Well this can work for single functions as well.
 
Just enclose the function (or functions) you want to optimize for execution time between the 2 pragmas.
 
Option is activated with pragma OPTION ADD and desactivated with pragma OPTION DEL.
 
So you can decide whether you want to use it for 1 function, a set of functions or the whole module :smileywink:
 
CrasyCat

View solution in original post

0 Kudos
3 Replies
421 Views
CrasyCat
Specialist III
Hello
 
In order to activate a compiler option for a single module you can use the pragma OPTION.
 
Put following line before the implementation of the first function in the module
#pragma OPTION ADD OptimizeTime "-Ot"
 
Place following line at the end of the module
 
#pragma OPTION DEL OptimizeTime
 
In order to get your email address changed you need to submit a Service Request with Categorie = Web and Topic = Email Address Change

Click here to submit a service request.
CrasyCat
421 Views
MTBer
Contributor I
Hi CrasyCat,
 
Thanks a lot for your response.  I have tried it, but unfortunately my code jump from 10k to 40k for this source file and now I am struggling to make it fit.
 
This will only work down to a function level or can I use it inside a function as well?
 
Thanks again,
MTBer
0 Kudos
422 Views
CrasyCat
Specialist III
Hello
 
Well this can work for single functions as well.
 
Just enclose the function (or functions) you want to optimize for execution time between the 2 pragmas.
 
Option is activated with pragma OPTION ADD and desactivated with pragma OPTION DEL.
 
So you can decide whether you want to use it for 1 function, a set of functions or the whole module :smileywink:
 
CrasyCat
0 Kudos