fpu save an restore in isr

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

fpu save an restore in isr

572 Views
wernerdungs
Contributor I

I am using mqx 4.2 . I have an isr routine which uses float variables only to hold values. No math routines are called in the isr. It seems that the fpu is used even there is no math functions, only an assign to a float variable is used. Also other float variables that is used outside of the isr in a task are changed by the isr.

It seems that the fpu registers doesn't saved and restored in isr.

I suppose the mqx should save and restore the fpu registers if the fpu is enabled, but it doesn't.

How can I solve the problem ?

Why the fpu is used even there is only an assign to a float variable ? 

For example vf=*((float*) p);

best regards

Werner

0 Kudos
2 Replies

435 Views
danielchen
NXP TechSupport
NXP TechSupport

Hi Werner

I would like to suggest you check whether your MCU has FPU unit, what's the MCU's part number?

Please kindly refer to the following code

(mqx/source/psp/cortex_m/m4/boot.S)

#if MQXCFG_ENABLE_FP && PSP_HAS_FPU
        /* CPACR is located at address 0xE000ED88 */
        LDR.W   R0, =0xE000ED88
        /* Read CPACR */
        LDR     R1, [R0]
        /* Set bits 20-23 to enable CP10 and CP11 coprocessors */
        ORR     R1, R1, #(0xF << 20)
        /* Write back the modified value to the CPACR */
        STR     R1, [R0]
        /* turn off fpu register stacking in exception entry */

        ldr r0, =0xE000EF34     /* FPCCR */
        mov r1, #0
        str r1, [r0]
#endif

Set MQXCFG_ENABLE_FP to 1 , FP unit will be enabled and FP content will be stacked during context swithcing , did you enable the macro?


Have a great day,
Daniel

0 Kudos

435 Views
wernerdungs
Contributor I

Hi Daniel,

the mcu is MK64FN1MOV12

The fpu is enabled by setting MQXCFG_ENABLE_FP to 1

The fpu will be stacked at task switching, but it seems not with isr.

best regards

Werner

2017-09-18 8:39 GMT+02:00 Daniel Chen <admin@community.nxp.com>:

NXP Community

<https://community.freescale.com/resources/statics/1000/35400-NXP-Community-Email-banner-600x75.jpg>

You have been mentioned

by Daniel Chen

<https://community.nxp.com/people/danielchen@fsl?et=notification.mention> *in

Re: fpu save an restore in isr in NXP Community* - View Daniel Chen's

reference to you

<https://community.nxp.com/message/943803?commentID=943803&et=notification.mention#comment-943803>

0 Kudos