Avoid one special routine optimization

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

Avoid one special routine optimization

跳至解决方案
1,712 次查看
fanziyu
Contributor IV

S32K144

S32 Design for Arm 2.2

Optimization Level (-O1)

After the Hall signal A is detected by the input capture function, it waits for about 6us before going to collect Hall signal B. I used a FOR loop to produce this 6us, so how do I prevent the compiler from optimizing away this FOR loop?

for(i=0; i<65535;i++)

{...}

0 项奖励
回复
1 解答
1,684 次查看
davidtosenovjan
NXP TechSupport
NXP TechSupport

Yes, I have found it in certain presentation used following way:

davidtosenovjan_0-1704446616111.png

 

在原帖中查看解决方案

0 项奖励
回复
2 回复数
1,685 次查看
davidtosenovjan
NXP TechSupport
NXP TechSupport

Yes, I have found it in certain presentation used following way:

davidtosenovjan_0-1704446616111.png

 

0 项奖励
回复
1,702 次查看
fanziyu
Contributor IV

fanziyu_0-1704420071476.png

This method works well in S32K144 S32DS, is it theoretically applicable?

0 项奖励
回复