infineon4engineers Facebook

infineon@google+ Google+

infineon@linkedin linkedin

infineon4engi@twitter twitter

infineon@youtube youtube

+ Reply to Thread
Results 1 to 10 of 10

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

  1. #1
    Advanced Advanced sophia is on a distinguished road
    Join Date
    Nov 2011
    Posts
    678
    Points
    2190

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

    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
    Click image for larger version

Name:	CompilerSetting_FPU.jpg
Views:	168
Size:	151.6 KB
ID:	236
    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)
    Click image for larger version

Name:	LinkerSetting_FPU.jpg
Views:	139
Size:	157.1 KB
ID:	237
    3) Add "#include <arm_math.h>" 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)
    Click image for larger version

Name:	LinkerSetting.jpg
Views:	100
Size:	162.1 KB
ID:	238
    2) Add "#include <math.h>" in main.c
    Refer to web-page (http://sourceware.org/newlib/libm.html) for the available math functions provided by newlib library.
    Last edited by sophia; Oct 16th, 2014 at 11:34 PM.

  2. #2
    Advanced Advanced sophia is on a distinguished road
    Join Date
    Nov 2011
    Posts
    678
    Points
    2190
    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).

  3. #3
    Advanced Advanced sophia is on a distinguished road
    Join Date
    Nov 2011
    Posts
    678
    Points
    2190
    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

  4. #4

    Path typo

    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.

    Quote Originally Posted by sophia View Post
    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

  5. #5
    Advanced Advanced sophia is on a distinguished road
    Join Date
    Nov 2011
    Posts
    678
    Points
    2190
    Hi George,

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

    Best regards,
    Sophia

  6. #6
    Beginner Beginner Dexter is on a distinguished road
    Join Date
    Jun 2014
    Posts
    2
    Points
    50

    The similar problem at M0 (XMC1100)

    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)

  7. #7
    Advanced Advanced Daryl Neo is on a distinguished road
    Join Date
    Nov 2011
    Location
    Singapore
    Posts
    373
    Points
    3468.75
    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

  8. #8
    Beginner Beginner Dexter is on a distinguished road
    Join Date
    Jun 2014
    Posts
    2
    Points
    50

    now it works , thx

    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

  9. #9
    Beginner Beginner Leistungselektroniker is on a distinguished road
    Join Date
    Jan 2015
    Location
    Germany
    Posts
    4
    Points
    55
    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\CMS IS\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\CMS IS\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
    Last edited by Leistungselektroniker; Aug 9th, 2016 at 09:24 AM.

  10. #10
    Beginner Beginner hessman is on a distinguished road
    Join Date
    May 2018
    Location
    manila
    Posts
    4
    Points
    80
    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

+ Reply to Thread

Tags for this Thread

Disclaimer

All content and materials on this site are provided “as is“. Infineon makes no warranties or representations with regard to this content and these materials of any kind, whether express or implied, including without limitation, warranties or representations of merchantability, fitness for a particular purpose, title and non-infringement of any third party intellectual property right. No license, whether express or implied, is granted by Infineon. Use of the information on this site may require a license from a third party, or a license from Infineon.


Infineon accepts no liability for the content and materials on this site being accurate, complete or up- to-date or for the contents of external links. Infineon distances itself expressly from the contents of the linked pages, over the structure of which Infineon has no control.


Content on this site may contain or be subject to specific guidelines or limitations on use. All postings and use of the content on this site are subject to the Usage Terms of the site; third parties using this content agree to abide by any limitations or guidelines and to comply with the Usage Terms of this site. Infineon reserves the right to make corrections, deletions, modifications, enhancements, improvements and other changes to the content and materials, its products, programs and services at any time or to move or discontinue any content, products, programs, or services without notice.