AnsweredAssumed Answered

Why same code runs at different speed by mbed and KDS?

Question asked by HAIZHOU LI on Dec 5, 2014
Latest reply on Dec 7, 2014 by HAIZHOU LI

Hello all,

 

I have a ballistics algorithm running in our current product.  We plan to put that piece code into K63 later.  Then I did a quick preliminary evaluation half year ago by "mbed" using FRDM-k64F board right after FTF. The speed is great, every computation cycle only takes about 2 ms.

 

Now I transplanted that piece of code into a bare metal program by KDS. Exact same code, every cycle takes about 20 ms. It is about 10 times slower. I also tried the "arm_math.h". There is no difference at all.

 

Then I run my mbed code again. It is still 2 ms. I changed the float variables to volatile just in case the optimization. I also change the variables during the loop to avoid any optimization.  It still holds 2 ms.  The time was measured by an oscilloscope by toggle a IO right before and right after the calculation.

 

When I compared the calculation results from both mbed and KDS, the output are exactly same.

 

the processor setup is :  -mcpu=cortex-m4 -mthumb -mfloat-abi=hard -mfpu=fpv4-sp-d16

 

Anyone could know what I missed or KDS missed compared to mbed?

 

Thanks a lot!

 

Haizhou

Outcomes