PSOC6 FPU modus toolbox

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
ravo
Level 5
Level 5
10 likes received 5 comments on blog 5 solutions authored

Dears,

I would like to test FPU in PSOC6 in modus toolbox 2.4 environment

I installed CMSIS DSP and set all variables in makefile (DEFINES, INCLUDES, LDLIBS as noted in another posts like https://community.infineon.com/t5/PSoC-6/How-to-use-ARM-CMSIS-DSP-lib-in-ModusToolbox2-4/m-p/342494 ...) when VFP_SELECT=hardfp all source codes compiles ok and project seems to run normally but I still think that FPU is not used... So I would like also test with "software emulated" and compare execution time.

But when I set makefile variable VFP_SELECT=softfp or to empty value (as default) But now I got compilation errors like this "ld.exe: failed to merge target specific data of file...":

Linking output file mtb-example-psoc6-lptimer.elf
c:/users/xxx/modustoolbox/tools_2.4/gcc/bin/../lib/gcc/arm-none-eabi/10.3.1/../../../../arm-none-eabi/bin/ld.exe: error: ../CMSIS/DSP//Lib/GCC/libarm_cortexM4lf_math.a(arm_sin_f32.o) uses VFP register arguments, C:/Users/xxxx/mtw/Low-Power_Timer/build/CY8CKIT-062-WIFI-BT/Debug/mtb-example-psoc6-lptimer.elf does not
c:/users/xxx/modustoolbox/tools_2.4/gcc/bin/../lib/gcc/arm-none-eabi/10.3.1/../../../../arm-none-eabi/bin/ld.exe: failed to merge target specific data of file ../CMSIS/DSP//Lib/GCC/libarm_cortexM4lf_math.a(arm_sin_f32.o)
c:/users/xxx/modustoolbox/tools_2.4/gcc/bin/../lib/gcc/arm-none-eabi/10.3.1/../../../../arm-none-eabi/bin/ld.exe: error: ../CMSIS/DSP//Lib/GCC/libarm_cortexM4lf_math.a(arm_cos_f32.o) uses VFP register arguments, C:/Users/xxx/mtw/Low-Power_Timer/build/CY8CKIT-062-WIFI-BT/Debug/mtb-example-psoc6-lptimer.elf does not
c:/users/xxx/modustoolbox/tools_2.4/gcc/bin/../lib/gcc/arm-none-eabi/10.3.1/../../../../arm-none-eabi/bin/ld.exe: failed to merge target specific data of file ../CMSIS/DSP//Lib/GCC/libarm_cortexM4lf_math.a(arm_cos_f32.o)
c:/users/xxx/modustoolbox/tools_2.4/gcc/bin/../lib/gcc/arm-none-eabi/10.3.1/../../../../arm-none-eabi/bin/ld.exe: error: ../CMSIS/DSP//Lib/GCC/libarm_cortexM4lf_math.a(arm_mult_f32.o) uses VFP register arguments, C:/Users/xxx/mtw/Low-Power_Timer/build/CY8CKIT-062-WIFI-BT/Debug/mtb-example-psoc6-lptimer.elf does not
c:/users/xxx/modustoolbox/tools_2.4/gcc/bin/../lib/gcc/arm-none-eabi/10.3.1/../../../../arm-none-eabi/bin/ld.exe: failed to merge target specific data of file ../CMSIS/DSP//Lib/GCC/libarm_cortexM4lf_math.a(arm_mult_f32.o)
c:/users/xxx/modustoolbox/tools_2.4/gcc/bin/../lib/gcc/arm-none-eabi/10.3.1/../../../../arm-none-eabi/bin/ld.exe: error: ../CMSIS/DSP//Lib/GCC/libarm_cortexM4lf_math.a(arm_add_f32.o) uses VFP register arguments, C:/Users/xxx/mtw/Low-Power_Timer/build/CY8CKIT-062-WIFI-BT/Debug/mtb-example-psoc6-lptimer.elf does not
c:/users/xxx/modustoolbox/tools_2.4/gcc/bin/../lib/gcc/arm-none-eabi/10.3.1/../../../../arm-none-eabi/bin/ld.exe: failed to merge target specific data of file ../CMSIS/DSP//Lib/GCC/libarm_cortexM4lf_math.a(arm_add_f32.o)
c:/users/xxx/modustoolbox/tools_2.4/gcc/bin/../lib/gcc/arm-none-eabi/10.3.1/../../../../arm-none-eabi/bin/ld.exe: error: ../CMSIS/DSP//Lib/GCC/libarm_cortexM4lf_math.a(arm_common_tables.o) uses VFP register arguments, C:/Users/xxx/mtw/Low-Power_Timer/build/CY8CKIT-062-WIFI-BT/Debug/mtb-example-psoc6-lptimer.elf does not
c:/users/xxx/modustoolbox/tools_2.4/gcc/bin/../lib/gcc/arm-none-eabi/10.3.1/../../../../arm-none-eabi/bin/ld.exe: failed to merge target specific data of file ../CMSIS/DSP//Lib/GCC/libarm_cortexM4lf_math.a(arm_common_tables.o)
collect2.exe: error: ld returned 1 exit status
make[1]: *** [../mtb_shared/core-make/release-v1.9.1/make/core/build.mk:529: C:/Users/xxx/mtw/Low-Power_Timer/build/CY8CKIT-062-WIFI-BT/Debug/mtb-example-psoc6-lptimer.elf] Error 1
make: *** [../mtb_shared/core-make/release-v1.9.1/make/core/main.mk:434: secondstage_build] Error 2
"C:/Users/xxx/ModusToolbox/tools_2.4/modus-shell/bin/make CY_MAKE_IDE=eclipse CY_MAKE_IDE_VERSION=2.4 CY_IDE_TOOLS_DIR=C:/Users/xxx/ModusToolbox/tools_2.4 -j12 all" terminated with exit code 2. Build might be incomplete.

What is going bed ? 

Best Regards

Radim

 

 

0 Likes
1 Solution
Rakshith
Moderator
Moderator
Moderator
250 likes received 1000 replies posted 750 replies posted

I believe you would have set the library path to the lf library in the makefile by changing LDLIBS. You will have to change the path of the library there.

This thread should provide the steps in detail - Install CMSIS DSP for CY8CPROTO-062-4343W on ModusToolbox v2.1.0 on Windows (Still)

Thanks and Regards,
Rakshith M B

View solution in original post

7 Replies
Rakshith
Moderator
Moderator
Moderator
250 likes received 1000 replies posted 750 replies posted

Hi Radim, 

The library libarm_cortexM4lf_math.a requires an FPU. The l here stands for little-endian and the f stands for the availability of an FPU. You probably are getting the errors because of the same. Can you please try libarm_cortexM4l_math.a and let me know if that works?

Thanks and Regards,
Rakshith M B
0 Likes
ravo
Level 5
Level 5
10 likes received 5 comments on blog 5 solutions authored

Dear Rakshith ,

How can I change to use libarm_cortexM4l_math.a instead of libarm_cortexM4lf_math.a ?

In folder ...\mtw\CMSIS\DSP\Lib\GCC folder I have both compiled versions.

Thanks in advance for your help...

Regards

Radim

0 Likes
Rakshith
Moderator
Moderator
Moderator
250 likes received 1000 replies posted 750 replies posted

I believe you would have set the library path to the lf library in the makefile by changing LDLIBS. You will have to change the path of the library there.

This thread should provide the steps in detail - Install CMSIS DSP for CY8CPROTO-062-4343W on ModusToolbox v2.1.0 on Windows (Still)

Thanks and Regards,
Rakshith M B
ravo
Level 5
Level 5
10 likes received 5 comments on blog 5 solutions authored

Dear Rakshith,

thanks for mention LDLIBS.  I had to be blind... After changing its value, it has been compiled without problems. So I can compile project  with HARDFP or SOFTFP value in VFP_SELECT variable.

VFP_SELECT=hardfp & LDLIBS=$(DSP_DIR)/Lib/GCC/libarm_cortexM4lf_math.a

VFP_SELECT=softfp & LDLIBS=$(DSP_DIR)/Lib/GCC/libarm_cortexM4lf_math.a

Now for both variants the project compiled without error. But when I compare execution time - it is still same.

for(i=0; i< blockSize; i++)
{
cosOutput = arm_cos_f32(testInput_f32[i]);
sinOutput = arm_sin_f32(testInput_f32[i]);
arm_mult_f32(&cosOutput, &cosOutput, &cosSquareOutput, 1);
arm_mult_f32(&sinOutput, &sinOutput, &sinSquareOutput, 1);
arm_add_f32(&cosSquareOutput, &sinSquareOutput, &testOutput, 1);
/* absolute value of difference between ref and test */
diff = fabsf(testRefOutput_f32 - testOutput);

}

Maybe I am still doing something in wrong way.

Radim

0 Likes
AlenAn14
Moderator
Moderator
Moderator
500 replies posted 100 solutions authored 250 replies posted

Hi @ravo ,

Can you please let me know how you are performing this performance analysis on your end?

Also can you please share your project here (from where you shared the above snippet) so we can test the same on our end.

Warm Regards
Alen

ravo
Level 5
Level 5
10 likes received 5 comments on blog 5 solutions authored

Dear Alen, 

For time measurement I am using simultaneously counter and GPIO pin toggle to verify on scope.

event1_cnt = cyhal_lptimer_read(&lptimer_obj);
cyhal_gpio_write(CYBSP_USER_LED2, CYBSP_LED_STATE_ON);

{ executed code}

event2_cnt = cyhal_lptimer_read(&lptimer_obj);
cyhal_gpio_write(CYBSP_USER_LED2, CYBSP_LED_STATE_OFF);

timegap = (event2_cnt - event1_cnt) / (lptimer_obj_info.frequency_hz/1000);

/* Print the timegap value */
printf("\r\nFPU math functions take = %.3f sec\r\n",(double) timegap / 1000);

Now I think that it is working now. The mistake was on my side - the blockSize has value 32. So the problem was that the running time was similar for both softfp and hardfp variants. If I change cycle counts for example to 100 000 counts then the time differences could be measured.

Best Regards for answers and ideas to corrections.

Radim

 

0 Likes
AlenAn14
Moderator
Moderator
Moderator
500 replies posted 100 solutions authored 250 replies posted

Hi @ravo ,

Glad your query is resolved!
Please feel free to post any queries or issues you may have on Infineon products in the community and we will be happy to help.

Thanks and Regards,
Alen
Cypress Semiconductor Corporation
An Infineon Technologies Company

0 Likes