MPC 5744P Compile difference of different SD32 version

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

MPC 5744P Compile difference of different SD32 version

跳至解决方案
1,603 次查看
TerryDuPower
Contributor III

Dear supporters:

      I created two project with some code. One was created by S32 Design Studio for Power Architecture Version 2017.R1, Another was created by S32 DS 2.1.   After complied, It's strange they are different.

 S32 DS 2017.R1:

TerryDuPower_1-1650247101857.png

 

S32 DS 2.1:

TerryDuPower_0-1650246970941.png

I checked the propertity is same . Could you give me some help?

0 项奖励
回复
1 解答
1,478 次查看
TerryDuPower
Contributor III

Hi  stanish,

     Yes, It's caused by the compiler option  

-fstrict-volatile-bitfields

  

Thanks very much!

在原帖中查看解决方案

0 项奖励
回复
6 回复数
1,582 次查看
davidtosenovjan
NXP TechSupport
NXP TechSupport

Do you have the same linker file? Do you have same optimization configuration?

0 项奖励
回复
1,554 次查看
TerryDuPower
Contributor III

Yes,  two projects have same link file and same optimization configuration.

0 项奖励
回复
1,521 次查看
davidtosenovjan
NXP TechSupport
NXP TechSupport

Can you provide your project or reproducible code snippet? Thanks

0 项奖励
回复
1,514 次查看
TerryDuPower
Contributor III

This is the code:  

void Tim_Init(void)
{
//STM_0.CR.R = 0x00003103;
STM_0.CR.B.FRZ = 1; /*0:STM counter continues to run in debug mode*/
STM_0.CHANNEL[0].CMP.R = 1000; /*matches the STM_CNT register*/
STM_0.CR.B.CPS = 0x31; /*counter prescaler */
STM_0.CR.B.TEN = 1; /*Timer counter Enabled*/
STM_0.CHANNEL[0].CCR.B.CEN = 1; /* channel 0 enable */
STM_0.CHANNEL[0].CIR.B.CIF = 1; /* clear the flag */
}

Thanks!

0 项奖励
回复
1,491 次查看
stanish
NXP Employee
NXP Employee

Hello,

it seems the difference is caused by the compiler option:

-fstrict-volatile-bitfields

this causes the bitfield struct access (peripheral register) respects the declared datatype.

See se_stw vs. se_stb instruction

In a previous version of the compiler this option was enabled by default. Later compiler versions (starting with v1.2+) this option has to be enabled expicitly in compiler options.

 

stanish_0-1651137824153.png

 

hope it helps.

Stan

 

0 项奖励
回复
1,479 次查看
TerryDuPower
Contributor III

Hi  stanish,

     Yes, It's caused by the compiler option  

-fstrict-volatile-bitfields

  

Thanks very much!

0 项奖励
回复