Life.augmented
Skip to main content
Go Search
  

STM32 Evaluation Tools

Modify settings and columns
STM32 Discovery Kit, STM32 Nucleo, STM32 Eval Board
Share Discussion
  
View: 
Post
Started: 10/15/2012 10:55 AM
capasso.ornella
  Posts : 73
DSP libraries
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

Tags: DSP libraries
Posted: 10/15/2012 11:57 AM
capasso.ornella
  Posts : 73



Posted: 10/15/2012 12:01 PM
fm
  Posts : 1011

After my understanding, ARMCM4.h is a generic core include file from ARM.
Replace the reference with "stm32f4xx.h" (if you build for the M4), or add a version that includes this file.

See this for reference:
https://bitbucket.org/.../cmsis-v3/.../ARMCM4.h
Posted: 10/15/2012 12:26 PM
capasso.ornella
  Posts : 73
does not work ... I think you have made your instructions but it does not work ... can you tell me step by step what should I do??

Edited: 10/15/2012 12:53 PM
fm
  Posts : 1011
If you look at the contents of this ARMCM4.h, it defines just the same things as the stm32xxx.h files - only less. It is the ARM version for a generic M4 core, and thus should match the STM32F4xx, LPC45xx, LM4Fxxx and others.
I believe ST should have removed all references to this file before releasing the F4 firmware library, because their version (stm32f4xx.h) is a superset of this file.

If you build for an stm32f4, just remove the line
#include "ARMCM4.h"
and replace it with
#include "stm32f4xx.h"
or create your own version of ARMCM4.h, which only includes stm32f4xx.h.

I had built a project with some DSP lib files some weeks ago, and succeeded this way.

Edit:
Looking at your picture, you probably just need to remove the include.
The other file ("stm32f4xx.h") should already be pulled in by former includes.

From: capasso.ornella
Posted: Monday, October 15, 2012 12:26 PM
Subject: DSP libraries

does not work ... I think you have made your instructions but it does not work ... can you tell me step by step what should I do??


From: fm
Posted: Monday, October 15, 2012 12:01 PM
Subject: DSP libraries


After my understanding, ARMCM4.h is a generic core include file from ARM.
Replace the reference with "stm32f4xx.h" (if you build for the M4), or add a version that includes this file.

See this for reference:
https://bitbucket.org/.../cmsis-v3/.../ARMCM4.h

From: capasso.ornella
Posted: Monday, October 15, 2012 10:55 AM
Subject: DSP libraries

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
Posted: 10/15/2012 2:04 PM
capasso.ornella
  Posts : 73
I tried to replace with ARMCM4.H STM32F4xx.h but I get many errors when I try to use the mathematical functions or control as the pid...




Posted: 10/15/2012 2:20 PM
fm
  Posts : 1011
I tried to replace with ARMCM4.H STM32F4xx.h but I get many errors...

If the file stm32f4xx.h is already included, remove ARMCM4.h, i.e. the include.
"Invalid redeclaration ..." is a typical error when including a header file twice.

Posted: 10/15/2012 3:24 PM
capasso.ornella
  Posts : 73
gives me error for all types defined as  __IO uint32_t 
for example IO uint32_t  take me back to a mistake
but unit32_t don't return an error message...
I can not fix .... :-( Help me....
Edited: 10/15/2012 4:05 PM
clive1
  Posts : 8727
You need to look at the first error, subsequent ones often come as a result if it trying to recover/restart.

The include file you want is in \Keil\ARM\Device\ARM\ARMCM4\Include

You NEED to ensure that you project has Include pathing set up correctly so that it can find the files requested.
Options -> C/C++ -> Include Paths
Posted: 10/15/2012 4:20 PM
capasso.ornella
  Posts : 73
clive, as always, I thank you! :-) I've included the file but I have new errors, I think there are conflicts, you may help me for this new problem?


Posted: 10/15/2012 4:41 PM
clive1
  Posts : 8727
system_armcm4.c and startup_armcm4.s are duplicative of files provided by ST, remove them from the project.

Posted: 10/15/2012 4:42 PM
capasso.ornella
  Posts : 73
but mostly just add functions pid gives me these error ...
please give me a hand


Posted: 10/15/2012 5:20 PM
fm
  Posts : 1011
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: 10/15/2012 5:22 PM
clive1
  Posts : 8727
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.
Posted: 10/15/2012 6:05 PM
capasso.ornella
  Posts : 73
I just want to use the functions pid ...
how do I define the file ARM_MATH_CM4 in the project?
Posted: 10/15/2012 6:38 PM
clive1
  Posts : 8727
#define ARM_MATH_CM4
#include <arm_math.h>

or

Add it into the project
Settings -> C/C++ -> Preprocessor Symbols -> Define
Edited: 10/15/2012 8:38 PM
capasso.ornella
  Posts : 73
I "solved" in this way:

#include "stm32f4_discovery.h"
#include <stdio.h>
#include <main.h>
#include <arm_math.h>
#include <arm_pid_reset_f32.c>
#include <arm_pid_init_f32.c>

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

From: clive1
Posted: Monday, October 15, 2012 6:38 PM
Subject: DSP libraries

#define ARM_MATH_CM4
#include <arm_math.h>

or

Add it into the project
Settings -> C/C++ -> Preprocessor Symbols -> Define
Edited: 10/15/2012 9:05 PM
clive1
  Posts : 8727
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.
Posted: 10/15/2012 9:46 PM
capasso.ornella
  Posts : 73
:-D pity that I do not have the tools here with me! I have to wait until tomorrow morning ....
Posted: 10/16/2012 11:50 AM
capasso.ornella
  Posts : 73
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.
Posted: 10/16/2012 12:17 PM
fm
  Posts : 1011
If it is easier for you, try to use the precompiled libs in .../Libraries/CMSIS/Lib/ARM/
They are built with the Keil compiler, so linking in should not be a problem.

I had no success doing this with Crossworks, so I used the source code for my project.
Posted: 10/16/2012 2:47 PM
capasso.ornella
  Posts : 73
thanks, I'll try in this way, if I succeed, I will describe the procedure in a post :-)

Browse Private Forums

NOTE: these forums are exclusive for users of this Extranet!)