DAVE TIP of the day: Things need to do when use math functions

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

cross mob
Not applicable
If the math function is from CMSIS DSP library, the math library is under C:\DAVE-3.1\CMSIS\Lib\GCC.
1) Go to Project -> Active Project Properties -> C/C++ Build -> Settings -> ARM-GCC C Compiler, add "__FPU_PRESENT" (when FPU is required) & "ARM_MATH_CM4" in the Preprocessor
198.attach
2) Go to Project -> Active Project Properties -> C/C++ Build -> Settings -> ARM-GCC C Linker,
2a) Add "arm_cortexM4_mathL_1" & "arm_cortexM4_mathL_2" in the Libraries (-l)
2b) Add ""${eclipse_home}/../CMSIS/Lib/GCC"" in the Libraries search path (-L)
199.attach
3) Add "#include " in main.c

If the math function is from newlib library, the math library is under C:\DAVE-3.1\CMSIS\Infineon\Lib.
1) Go to Project -> Active Project Properties -> C/C++ Build -> Settings -> ARM-GCC C Linker, add "m" in the Libraries (-l)
200.attach
2) Add "#include " in main.c
Refer to web-page (http://sourceware.org/newlib/libm.html) for the available math functions provided by newlib library.
0 Likes
9 Replies
Not applicable
DSP library update:
Pls take a note that the DSP libraries libarm_cortexM4_mathL_2.a & libarm_cortexM4_mathL_1.a can only be used in earlier DAVE versions (v3.1.6 or earlier).
Instead the libarm_cortexM4lf_math.a should be used for newer DAVE versions (v3.1.8 or later). They are located in the same folder (eg. C:\DAVE-3.1.10\CMSIS\Lib\GCC).
0 Likes
Not applicable
arm_sqrt_f32 (float32_t in, float32_t *pOut) does not belong to ARM DSP library, it is defined as an inline function in arm_math.h.
All functions belong to DSP library can be found under C:\DAVE-3.1.10\CMSIS\DSP_Lib\Source
0 Likes
Not applicable
Hi there Sophia,

Thanks for the effort and tips on including CMSIS DSP.
You have made a small typo that cost me some hours of frustration.

sophia wrote:

2b) Add ""${eclipse_home}/.../CMSIS/Lib/GCC"" in the Libraries search path (-L)


As you can see, you have inserted 3*dots /.../ between the path slashes where it should have been 2*dots /../

Regards,
George
0 Likes
Not applicable
Hi George,

Thank you very much for the feedback.
Instead of typing, you can copy and edit the existing path…

Best regards,
Sophia
0 Likes
Not applicable
hi,

I got a similar problem at the smaler xmc, i don't know which -I path or somthing other i should set, to compile successfuly.
" undefined reference to `arm_pid_init_q31' "

thank in advance
( i know the thread is very old, but the problem is the same in a other way)
0 Likes
Not applicable
HI.

It is now easier in DAVE4. You can add the DAVE APP "CMSIS_DSP" to your DAVE CE project.
This APP provides the CMSIS DSP software library, a suite of common signal processing functions for use on Cortex-M processor based devices.

Regards,
Daryl
0 Likes
Not applicable
Hi Daryl Neo,

Thank's for this hint.
But I used the false version of Dave (4.0.0), because there isn't any DSP app.
With the lastest Dave it work's

regards,
Dexter
0 Likes
User9654
Level 1
Level 1
Hi,

I updated this reply due the progress I made; it might be useful for others too:

How can the DSP-Math-library be used in DAVE4 with a pure XMCLib-project (no apps)?

1. Define "__FPU_PRESENT" and "ARM_MATH_CM4" like described by sophia above.

2. In my installation, the path in "ARM-GCC C Compiler"->"Directories" has to be set to "${DEVICE_FILE_LOCATION}\pack\2.1.14\Libraries\CMSIS\Include",
this is the location of the arm_math.h-file.
The number "2.1.14" might be different in other installations and seems to be dependant on the library version
(is there maybe a better link than ""${DEVICE_FILE_LOCATION}\pack\x.x.x"?).
${DEVICE_FILE_LOCATION} is a link to the Infineon-"D_LibraryStore_4.1"-folder in my user-directory and was already defined in my DAVE installation.

3. Insert "arm_cortexM4lf_math" in the "-l"-section of "ARM-GCC C Linker->Libraries", do NOT use "libarm_cortexM4lf_math.a" (the correct filename)!

4. Tell the linker the path to this lib: Insert "${DEVICE_FILE_LOCATION}\pack\2.1.14\Libraries\CMSIS\Lib\GCC" in the library search path window ("-L")

5. To use the library, I had to set the floation point options to "Full hardware floating point" in the "Miscellaneous"-sections of the C-Compiler, the Assembler and the Linker.
It did not work with "softfp".

I tested this Configuration using the arm_sin_f32- and the arm_rfft_f32-functions on a RELAX-Board.
The arm_rfft_f32-function needed approx. 69k cycles for a 1024-point-fft (I hope a measured this right...).

I would be gratefull, when someone takes his/her time to verify this.

Greetings

Leistungselektroniker
0 Likes
User15030
Level 1
Level 1
Hi,


i need give infineon xmc DSP library to DAVE studio but i dont no how. Please send me a step-by-step guide to how to do it.

thansk Jiri
0 Likes