Command-Line Options for Global Optimization Settings for MPC5604 chip

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

Command-Line Options for Global Optimization Settings for MPC5604 chip

960 次查看
朱先生
Contributor III

Hi, all:

Our platform is MPC5604 chip. We use codewarrior IDE(Version is "5.9.0") to build our project. In build process, we found a problem.

 

1. Problem description

The code is shown below:

166941_166941.pngpastedImage_1.png

                                                                Fig.1   operating result 

In the code, variable named "local_A" is always equal to 1, the PC pointer can't jump into the branch.

But actually the judgement  condition is false, the PC pointer is still jump into the branch.  you can see the result in Fig.1.

 

 

2. Problem analysis

We analysis the assemble code and  found no error with the code. so we analysis the build  options.

at last, we found there is a parameter can lead to this problem. The parameter is "Global Optimization Settings".

166942_166942.pngpastedImage_8.png

                     Fig.2  Faster build option

If this Global Optimization Settings is set as Fig.2 or optimization level is less than 4, the problem will reappear.

 

166956_166956.pngpastedImage_10.png

                          Fig.3  smaller code size build option

Only this Global Optimization Settings is set as Fig.3. The problem  will never happen. 

 

3. Question

1)we don't know the mechanism. If we configure the optimization setting as Level4, does it lead other new problems?

2) why other levels lead this problem?

 

Thank you for your reply.

标签 (1)
标记 (1)
4 回复数

887 次查看
martin_kovar
NXP Employee
NXP Employee

Hi,

could you please share the code of the function, where variable local_A is declared or defined? I also do not see any operations with this variable (something like increment or another mathematical operation).

Regards,

Martin

0 项奖励
回复

887 次查看
朱先生
Contributor III

Hi, Martin:

The variable local_A is declared as global variable. The code is below:

pastedImage_1.png

There is no modification about this variable in our code. so the value of this variable is always initial  value "1".

In debug mode, the value of this variable is actually "1".

pastedImage_2.png

Thanks for your reply.

Regards,

Bryce

0 项奖励
回复

887 次查看
martin_kovar
NXP Employee
NXP Employee

Hi Bryce,

this behavior is strange. Could you please share your project? If it not possible for you to share you project in public, please submit a new case for NXP support and I will answer you. But without your project I am not able to tell you what is wrong.

https://community.nxp.com/docs/DOC-329745?sr=search&searchId=3ae873a3-b79a-4f29-9601-2a0fcf3bd94a&se... 

Regards,

Martin

0 项奖励
回复

887 次查看
朱先生
Contributor III

Dear Martin,

I create a new case. shown below:

pastedImage_1.png

Thanks for your help.