k64f  fpu and dsp defines for mqx

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

k64f  fpu and dsp defines for mqx

1,268 Views
rqbh
Contributor III

Should we add the " #define MQXCFG_ENABLE_DSP   1" in user_config.h  and add(modify) "#define PSP_HAS_FPU  1" in kinetis.h ?

when we do use hard fpu.

Labels (1)
0 Kudos
9 Replies

616 Views
ivadorazinova
NXP Employee
NXP Employee

Kevin,

for definition macros, please visit sites Freescale MQX™ RTOS for Kinetis SDK (BE|Freescale

and download SDK User´s Guide for Kinetis, MQX RTOS.

In the document you have definition of macro MQXCFG_ENABLE_FP (e.g.) on page 146.

Exactly

MQXCFG_ENABLE_FP

Default value depends on the MQXCFG_MEM_COPY_NEON. If

MQXCFG_MEM_COPY_NEON is set, default value is 1. Otherwise, default value is

0.

If it is set, enables FPU support in MQX RTOS. Scheduler stores and restores the FPU

context and provides API for float point support in tasks and interrupts.

mqx_doc.png

0 Kudos

616 Views
qinchenghu
Contributor I

hi,iva,

   in my project,the K60F120 is used,in MQX ,i have add some  define in the user_conf.h.

#define MQXCFG_ENABLE_FP                1

#define MQX_INCLUDE_FLOATING_POINT_IO   1

#define MQXCFG_ENABLE_DSP 1

and the PSP_HAS_FPU is defined in kinetis.h defaultly.

based this MQX config, i do some test for the fpu function.the code is :

_time_get (&time_rtc);
printf("unsigned calculate starrting:the second is:%d,the ms is:%d \n",time_rtc.SECONDS,time_rtc.MILLISECONDS);
for(i=0;i<CAL_TIMES;i++)
{
result1 = oper1*oper2;
result2 = oper3/result1;
}
_time_get (&time_rtc);
printf("unsigned calculate ending:the second is:%d,the ms is:%d \n",time_rtc.SECONDS,time_rtc.MILLISECONDS);;

where the CAL_TIMES is 100000; the oper data is unsigned int or float defined in the test program

in the MQX_template_list,i define the task between  MQX_AUTO_START_TASK|MQX_FLOATING_POINT_TASK|MQX_DSP_TASK and  MQX_AUTO_START_TASK,

in the two different tast set, result is almost same,the time gap is about 20ms.

now my question is :

1,is my test program can call the FPU to work?if not,how to change it?

2,in my test,the FPU is working? if it is working,it have no usage for float calculate?

0 Kudos

616 Views
ivadorazinova
NXP Employee
NXP Employee

Hi qin chenghu,

so, if is FPU activated is decided according to settings in the compiler.

If FPU is working you recognize according to disassembling the code and look at the special instructions for the FPU.

Through the macros is FPU switch on and there is also switch on saving FPU context with task switching.

DSP macros should have any effect for ColdFire but for Kinetis not very.

Best Regards,

Iva

0 Kudos

616 Views
qinchenghu
Contributor I


thank Iva!       i have check the program,the PSP_HAS_FPU and MQXCFG_ENABLE_FP are  be setting,but in the disassembling code,i cant find the FPU instrucstions. do you have some in reference to enable the K60 FPU in the KEIL compiler?

0 Kudos

616 Views
ivadorazinova
NXP Employee
NXP Employee

Dear qin chenghu,


please, can you attach your whole project?

It looks you have not correctly set FPU.

I will test it on my side.


Best Regards,

Iva

0 Kudos

616 Views
rqbh
Contributor III

Thank you Iva, but look into the code of mqx, when the code to check if the FPU register should be saved, it to check PSP_HAS_FPU macro too,

there must be both true for PSP_HAS_FPU and MQXCFG_ENABLE_FPU macro , but , in the kinetis.h file , no PSP_HAS_FPU define for K64F mcu,

it goes to default value "0", so , the FPU register never be saved .

0 Kudos

616 Views
ivadorazinova
NXP Employee
NXP Employee

Hi Kevin.

Have you solved your problem with FPU?

Best Regards,

Iva

0 Kudos

616 Views
ivadorazinova
NXP Employee
NXP Employee

Yes,


try to rewrite the kinetis.h,

go to row 240 and change the value.

#define PSP_HAS_FPU                             1

You can use as temporary workaround. It should be fixed in next release.

0 Kudos

616 Views
ivadorazinova
NXP Employee
NXP Employee

Hi Kevin.

The macro #define MQXCFG_ENABLE_DSP you can add. It should be set in user_config.h.

Secondly you mentioned macro #define PSP_HAS_FPU, try to use macro MQXCFG_ENABLE_FP.  If the macro is "1", shedular saves FPU registers when task switching.

Iva

0 Kudos