2012-10-15 01:55 AM
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 directoryTarget not created #dsp-libraries2012-10-15 07:41 AM
system_armcm4.c and startup_armcm4.s are duplicative of files provided by ST, remove them from the project.
2012-10-15 07:42 AM
but mostly just add functions pid gives me these error ...
please give me a hand2012-10-15 08:20 AM
Your file
arm_pid_init_f32.c
pulls inarm_math.h
. Inarm_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 filecore_cm4.h
is coming with the DSP_Lib, so there shouldn't be a problem.2012-10-15 08:22 AM
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.
2012-10-15 09:05 AM
I just want to use the functions pid ...
how do I define the file ARM_MATH_CM4 in the project?2012-10-15 09:38 AM
#define ARM_MATH_CM4
#include <arm_math.h> or Add it into the project Settings -> C/C++ -> Preprocessor Symbols -> Define2012-10-15 11:36 AM
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
2012-10-15 12:04 PM
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.sReset_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.
2012-10-15 12:46 PM
:D pity that I do not have the tools here with me! I have to wait until tomorrow morning ....
2012-10-16 02:50 AM
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.