cancel
Showing results for 
Search instead for 
Did you mean: 

DSP libraries

orn
Associate II
Posted on October 15, 2012 at 10:55

I need to use DSP libraries such as  BasicMathFunctions, but I have a lot of error messages, you might describe the procedure to include these libraries??

error messages like:

.. \ main.c (18): error: ♯ 5: can not open source input file ''ARMCM4.h'': No such file or directory

Target not created

#dsp-libraries
21 REPLIES 21
Posted on October 15, 2012 at 16:41

system_armcm4.c and startup_armcm4.s are duplicative of files provided by ST, remove them from the project.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
orn
Associate II
Posted on October 15, 2012 at 16:42

but mostly just add functions pid gives me these error ...

please give me a hand

0690X00000603FNQAY.jpg

frankmeyer9
Associate II
Posted on October 15, 2012 at 17:20

Your file

arm_pid_init_f32.c

pulls in

arm_math.h

.

In

arm_math.h

, you find this:

...

#define __CMSIS_GENERIC              /* disable NVIC and Systick functions */

#if defined (ARM_MATH_CM4)

  #include ''core_cm4.h''

#elif defined (ARM_MATH_CM3)

  #include ''core_cm3.h''

#elif defined (ARM_MATH_CM0)

  #include ''core_cm0.h''

#else

#include ''ARMCM4.h''

#warning ''Define either ARM_MATH_CM4 OR ARM_MATH_CM3...By Default building on ARM_MATH_CM4.....''

#endif

...

So, just add the define ARM_MATH_CM4 to your project settings.

The file

core_cm4.h

is coming with the DSP_Lib, so there shouldn't be a problem.

Posted on October 15, 2012 at 17:22

Do you have the define ARM_MATH_CM4 set for the project?

* <
b
>Using the Library</
b
>
*
* The library installer contains prebuilt versions of the libraries in the <
code
>Lib</
code
> folder.
* - arm_cortexM4lf_math.lib (Little endian and Floating Point Unit on Cortex-M4)
* - arm_cortexM4bf_math.lib (Big endian and Floating Point Unit on Cortex-M4)
* - arm_cortexM4l_math.lib (Little endian on Cortex-M4)
* - arm_cortexM4b_math.lib (Big endian on Cortex-M4)
* - arm_cortexM3l_math.lib (Little endian on Cortex-M3)
* - arm_cortexM3b_math.lib (Big endian on Cortex-M3)
* - arm_cortexM0l_math.lib (Little endian on Cortex-M0)
* - arm_cortexM0b_math.lib (Big endian on Cortex-M3)
*
* The library functions are declared in the public file <
code
>arm_math.h</
code
> which is placed in the <
code
>Include</
code
> folder.
* Simply include this file and link the appropriate library in the application and begin calling the library functions. The Library supports single
* public header file <
code
> arm_math.h</
code
> for Cortex-M4/M3/M0 with little endian and big endian. Same header file will be used for floating point unit(FPU) variants.
* Define the appropriate pre processor MACRO ARM_MATH_CM4 or ARM_MATH_CM3 or
* ARM_MATH_CM0 depending on the target processor in the application.
*
* <
b
>Examples</
b
>
*
* The library ships with a number of examples which demonstrate how to use the library functions.
*

Your supposed to pull in the library file to your project (the .lib file), not the source for it. I presume you just want to use the functions within the library? If you want to compile the DSP library source you'll want to review the project files.
Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
orn
Associate II
Posted on October 15, 2012 at 18:05

I just want to use the functions pid ...

how do I define the file ARM_MATH_CM4 in the project?

Posted on October 15, 2012 at 18:38

#define ARM_MATH_CM4

#include <arm_math.h>

or

Add it into the project

Settings -> C/C++ -> Preprocessor Symbols -> Define
Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
orn
Associate II
Posted on October 15, 2012 at 20:36

I ''solved'' in this way:

#include ''stm32f4_discovery.h''
#include <
stdio.h
>
#include <
main.h
>
#include <
arm_math.h
>
#include <
arm_pid_reset_fc
>
#include <
arm_pid_init_fc
>

I do not know if it works, because it does not give me errors when it compiles, but crashes when microcontollore must perform operations on float ..... for example this operation blocksthe program:

A0 = Kp + Ki + Kd;
//where Ao, Ki, Kd and Kp are declared or float or float32_t

to operate on a float must include something? I do not understand why it crashes ...do you have any thoughts on this?? I know I am repetitive, but thanks and thanks again!!!!clive :D
Posted on October 15, 2012 at 21:04

to operate on a float must include something? I do not understand why it crashes ...do you have any thoughts on this??

Well there are a couple of things to review. Options -> Target ->Floating Point Hardware -> Use FPU Enabling the FPU in hardware Either in startup_stm32f4xx.s

Reset_Handler PROC
EXPORT Reset_Handler [WEAK]
IMPORT SystemInit
IMPORT __main
;FPU settings
LDR R0, =0xE000ED88 ; Enable CP10,CP11
LDR R1,[R0]
ORR R1,R1,#(0xF << 20)
STR R1,[R0]
LDR R0, =SystemInit
BLX R0
LDR R0, =__main
BX R0
ENDP

Or system_stm32f4xx.c, SystemInit()

void SystemInit(void)
{
/* FPU settings ------------------------------------------------------------*/
#if (__FPU_PRESENT == 1) && (__FPU_USED == 1)
SCB->CPACR |= ((3UL << 
10
*2)|(3UL << 11*2)); /* set CP10 and CP11 Full Access */
#endif
/* Reset the RCC clock configuration to the default reset state ------------*/
/* Set HSION bit */
RCC->CR |= (uint32_t)0x00000001;

To confine the problem step through the code to identify the failure point, or install a Hard Fault Handler which can assist you in identifying the instructions which are faulting. Joseph Yiu has published an example in his book, and on the forum.
Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
orn
Associate II
Posted on October 15, 2012 at 21:46

:D pity that I do not have the tools here with me! I have to wait until tomorrow morning ....

orn
Associate II
Posted on October 16, 2012 at 11:50

I can now work with floats! :D I hope to solve the network pid, I'm looking at the examples of the DSP library! I'm trying to ''take'' my project in an example of the DSP Library, but I always have problems with header files STM32F4xx.he ARMCM4.h

if I find a solution I will place in the forum.