S12Z compiler CodeWarrior 10.7 compiler optimization and safety

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

S12Z compiler CodeWarrior 10.7 compiler optimization and safety

1,584件の閲覧回数
devauxt
Contributor I

Hello every one,

I am working on a S12Z controller in a automotive project with some safety requirements allocated to the controller (ASIL B).

As we are now facing a very high usage of the memory, in particular the ROM, we are considering switching ON the compiler optimization (up to level 2 – size over speed).

In the compiler manual (MCU_S12Z_Compiler.pdf), we can get a very limited amount of information concerning the optimization themselves.

Is there some recommendation whatsoever from NXP about the activation of compiler optimization, in particular in a safety context ? (do not activate at all ? / what to check or to do in addition if you activate ? / anything else ?)

Could anyone provide more details about the compiler optimizations ?

Basically from the compiler manual:

Sets a specific optimization level. The options for num are:
• 0 - Suppress all optimizations
• 1 - High Level Optimizations, Branch Optimization
• 2 - Constant Propagation, Copy Propagation, Dead Code Elimination, Register
Allocation, Peephole, Common Subexpression Elimination, Branch Tail Merge
• 3 - Constant Propagation, Copy Propagation, Dead Code Elimination, Register
Allocation, Peephole, Common Subexpression Elimination, Branch Tail Merge

And 

Specify the optimizations that you want the compiler to apply to the generated object code. The options available are as follows:
Off (default) - Disables optimizations. This setting is equivalent to specifying the -O0 command-line option. The compiler generates unoptimized, linear assembly-language code.
1 - The compiler performs all target-independent (that is, nonparallelized) optimizations, such as function inlining. This setting is equivalent to specifying the -O1 command-line option. The compiler omits all target-specific optimizations and generates linear assembly-language code.
2 - The compiler performs all optimizations (both targetindependent and target-specific). This setting is equivalent to specifying the -O2 command-line option. The compiler outputs optimized, non-linear, parallelized assembly-language code.
3 - The compiler performs all the level 2 optimizations, then the low-level optimizer performs global-algorithm register allocation. This setting is equivalent to specifying the -O3 command-line option. At this optimization level, the compiler generates code that is usually faster than the code generated from level 2 optimizations. By default, the optimization is disabled for S12Z Compiler.

 

Many thanks,

Regards.

Thomas.

0 件の賞賛
返信
1 返信

1,554件の閲覧回数
ZhangJennie
NXP TechSupport
NXP TechSupport

HI devauxt 

Please turn off compiler optimization if your project is safety requirement. 

the optimized code is not strictly equal to the original source code. I haven't see safety required design using optimization.

If I remember correct, NXP S12Z Core Self-Test Software  for safety, quality test code all turns of optimization.

https://www.nxp.com/products/processors-and-microcontrollers/additional-mpu-mcus-architectures/s12-m...

 

Have a nice day,

Jun Zhang

 

0 件の賞賛
返信