Not applicable
May 15, 2013
02:07 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
May 15, 2013
02:07 AM
I tried it but it seems to be undefined. What is the name of such a function in Dave3/XMC4500 please?
Thanks!
Thanks!
- Tags:
- IFX
7 Replies
Not applicable
May 15, 2013
02:11 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
May 15, 2013
02:11 AM
Hi BMS,
The sqrt function is available under DSP_Lib in the CMSIS folder.
If you go to C:\DAVE-3.1\CMSIS\DSP_Lib\Source\FastMathFunctions\ you should able to find the source file for sqrt function.
The sqrt function is available under DSP_Lib in the CMSIS folder.
If you go to C:\DAVE-3.1\CMSIS\DSP_Lib\Source\FastMathFunctions\ you should able to find the source file for sqrt function.
Not applicable
May 15, 2013
11:03 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
May 15, 2013
11:03 AM
Thank you very much Jackson! However, when I tried to use the arm_sqrt_q15 function, I encountered the following error.
C:\DAVE-3.1\CMSIS\Include\arm_math.h:268:20: fatal error: ARMCM4.h: No such file or directory
I searched in the DAVE-3.1 folder but couldn't find this header file.
Thanks!
C:\DAVE-3.1\CMSIS\Include\arm_math.h:268:20: fatal error: ARMCM4.h: No such file or directory
I searched in the DAVE-3.1 folder but couldn't find this header file.
Thanks!
Not applicable
May 16, 2013
02:00 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
May 16, 2013
02:00 AM
Hi BMS,
What you need to do is to add "ARM_MATH_CM4" in the preprocessor, which is in Project -> Active Project Properties -> C/C++ Build -> Setting -> ARM-GCC C Compiler.
Once you added this, you should be able to run the arm_math.
This way, you are using the math functionality provided by ARM CMSIS.
There is another way to get the sqrt function which is much easier and I should have told you previously.
In DAVE3, it is already include newlib library where math functionality is included.
You can find more information here: http://sourceware.org/newlib/libm.html
Therefore what you need to do is
and you can use the function
What you need to do is to add "ARM_MATH_CM4" in the preprocessor, which is in Project -> Active Project Properties -> C/C++ Build -> Setting -> ARM-GCC C Compiler.
Once you added this, you should be able to run the arm_math.
This way, you are using the math functionality provided by ARM CMSIS.
There is another way to get the sqrt function which is much easier and I should have told you previously.
In DAVE3, it is already include newlib library where math functionality is included.
You can find more information here: http://sourceware.org/newlib/libm.html
Therefore what you need to do is
#include "math.h"
and you can use the function
double sqrt(double x);
float sqrtf(float x);
Not applicable
May 16, 2013
02:53 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
May 16, 2013
02:53 AM
Thank you so much Jackson for the clear explanation. It works.
Cheers
Cheers
Jul 05, 2013
08:29 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Jul 05, 2013
08:29 AM
I have included "math.h" as you noted like this:
But there is a build error:
What is wrong?
#include//Declarations from DAVE3 Code Generation (includes SFR declaration)
#include "math.h"
int main(void)
{
// status_t status; // Declaration of return variable for DAVE3 APIs (toggle comment if required)
DAVE_Init(); // Initialization of DAVE Apps
while(1)
{
float a = 1.0f;
float b = 3.14f;
for(long i = 0; i < 1000000; i++) {
a = sqrtf(a + b);
}
if(a > 0)
IO004_TogglePin(IO004_Handle0);
}
return 0;
}
But there is a build error:
Main.o: In function `main':
C:\Development\Dave\performance\Release/../Main.c:28: undefined reference to `sqrtf'
collect2: ld returned 1 exit status
make: *** [performance.elf] Error 1
**** Build Finished ****
What is wrong?
Not applicable
Jul 08, 2013
12:37 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Jul 08, 2013
12:37 AM
Hi,
What you need to do is to add "m" in Libraries.
Go to Project -> Active Project Properties -> C/C++ Build -> Settings -> ARM-GCC C Linker, add "m" in the Libraries (-l)
Best regards,
Sophia
What you need to do is to add "m" in Libraries.
Go to Project -> Active Project Properties -> C/C++ Build -> Settings -> ARM-GCC C Linker, add "m" in the Libraries (-l)
Best regards,
Sophia
Jul 08, 2013
05:26 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Jul 08, 2013
05:26 AM
Thanks! It works!