Avoid one special routine optimization

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

Avoid one special routine optimization

Jump to solution
314 Views
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 Kudos
1 Solution
286 Views
davidtosenovjan
NXP TechSupport
NXP TechSupport

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

davidtosenovjan_0-1704446616111.png

 

View solution in original post

0 Kudos
2 Replies
287 Views
davidtosenovjan
NXP TechSupport
NXP TechSupport

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

davidtosenovjan_0-1704446616111.png

 

0 Kudos
304 Views
fanziyu
Contributor IV

fanziyu_0-1704420071476.png

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

0 Kudos