How to use DSP instructions on Kinetis K66 MCU?

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

How to use DSP instructions on Kinetis K66 MCU?

947 Views
giova841
Contributor II

Hi everybody,

I have written a program on the K65 MCU which performs some controls and a few calculations. Looking at execution times I found out that the calculations performed were the instructions that took the most time.

These calculations are simple multiplications between float variables and I think that some micro-seconds for each multiplication is really too high, considering I have a 120 MHz clock! probably there is something missing in my code or there are some compiler options which I have not set properly so I am asking you:

  • is there any compiling options I can enable in order to use the math co-processro provided with the ARM -M4?
  • is there any libraryI can laod to use the "DSP Instructions" described in the ARM -M4 reference guide?

Cheers,

Giulio

Labels (1)
Tags (2)
0 Kudos
3 Replies

645 Views
mjbcswitzerland
Specialist V

Hi

Do you compiler for HW  FPU use?

These flags are needed by GCC:

-mfloat-abi=hard -mfpu=fpv4-sp-d16

Regards

Mark

645 Views
giova841
Contributor II

Yes, these are my compiler settings:

pastedImage_1.png

0 Kudos

645 Views
Hui_Ma
NXP TechSupport
NXP TechSupport

Hi

Besides to set the compiler, it also need to enable FPU with below code:

; Enable the floating point coprocessor
#if defined (_VFPv4_)
      MOVW r1,#60808              ; load CPACR            
      MOVT r1,#57344              ; (0xE000ED88) 
      LDR r0,[r1]
      ORR.W r0,r0,#VFPEnable      ; Enable FPU
      STR r0, [r1]                ; on CP10, CP11
      MOV.W r0,#R2N_Enable
      VMSR FPSCR, r0
#endif 


Wish it helps.

Have a great day,
Ma Hui
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos