cancel
Showing results for 
Search instead for 
Did you mean: 

CMSIS DSP compilation error & Struct Initialization

bluewaters213
Associate III
Posted on March 09, 2013 at 22:15

Hello,

I am  trying to implementing PID in Systick Interrupt handler.I get this error after compilation in Keil MDK '' C:\Keil\ARM\CMSIS\Include\arm_math.h(268): error:  &sharp5: cannot open source input file ''ARMCM4.h'': No such file or directory''. I added arm_cortexM3l_math.lib to my Project List but no Luck.I need help in this aspect.Also, I think I have a problem with Initailizing Kp, Ki & Kd '' arm_pid_instance_q15 '' struct.Please can someone tell me if  my inialization is correct and if I did the right thing on CMSIS PID.

-------------------------  

/**

   * @brief Instance structure for the Q15 PID Control.

   */

  typedef struct

  {

    q15_t A0;    /**< The derived gain, A0 = Kp + Ki + Kd . */

&sharpifdef ARM_MATH_CM0

    q15_t A1;

    q15_t A2;

&sharpelse

    q31_t A1;           /**< The derived gain A1 = -Kp - 2Kd | Kd.*/

&sharpendif

    q15_t state[3];       /**< The state array of length 3. */

    q15_t Kp;           /**< The proportional gain. */

    q15_t Ki;           /**< The integral gain. */

    q15_t Kd;           /**< The derivative gain. */

  } arm_pid_instance_q15;

------------------

MY CODE WITH COMPILATION ERROR

------------------

&sharpinclude ''stm32f10x.h''

&sharpinclude ''arm_math.h''

int main(void)

 {

    uint16_t SpeedError,CorrectedSpeed;    /* Variable that holds error*/

  uint_16 resetStateFlag = 0;

    

      RCC->APB2ENR |= RCC_APB2ENR_AFIOEN | RCC_APB2ENR_IOPBEN;

        //PB0 & PB1 =>Alt Function Push Pull O/P | PB6-PB7 Alt Function Open Drain

    GPIOB->CRL = 0xFF4444AA;

    GPIOB->CRH = 0x44441111;    //Configure PB8-PB11 as Output (Push Pull)

      GPIOB->ODR = 0x00000000;

    

    arm_pid_instance_q15 S;  /* PID S Instance Structure*/

  S.Kp = 2300;             /* Change the member Kp of S to have the value of 2300 */

  S.Ki = 150;              /* Change the member Ki of S to have the value of 150 */

  S.Kd = 0                 /* Change the member Kd of S to have the value of 0 */

    

    arm_pid_reset_q15(&S);   /*resets the state buffer to zeros*/   

  arm_pid_init_q15 = {&S, resetStateFlag}; /* Initialize A0 & A1 from Kp, Ki & Kd */

    

    if (SysTick_Config(SystemCoreClock / 1000))

      {

      /* Capture error */

        while(1);

        }

      while(1)

        {

       

        }

 }

Regards

Slim

void SysTick_Handler(void)

 {    

  CorrectedSpeed = __STATIC_INLINE q15_t arm_pid_q15(&S,SpeedError); /*PID out processed output sample*/   

 }

#cmsis
9 REPLIES 9
Posted on March 09, 2013 at 22:27

The error is not about adding library files, you need to set up the ''Include Paths'' for the project to point at the assorted directories you have include files stored in related to the project. If the inclusion isn't required you might also want to consider if you have the right defines for the project too.

0690X00000604z0QAA.png
Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
yutang_98
Associate II
Posted on September 29, 2013 at 23:20

Dear Sir:

Please give me help.

I use IAR 6,60.1.5104 and try to run arm_fft_bin_example_f32.c  

I copy arm_fft_bin_example_f32.c  and arm_fft_bin_data.c  under C:\...\STM32F4xx_DSP_StdPeriph_Lib_V1.1.0\Project\testfft\

and copy EWARM to same directory and add C compiler->Preprocess-> Additional include directories as

$PROJ_DIR$\..\

$PROJ_DIR$\..\..\..\Libraries\STM32F4xx_StdPeriph_Driver\inc

$PROJ_DIR$\..\..\..\Utilities\STM32_EVAL\Common

$PROJ_DIR$\..\..\..\Libraries\CMSIS\Device\ST\STM32F4xx\Include

$PROJ_DIR$\..\..\..\Libraries\CMSIS\Include

''Defined symbols'' as

USE_STDPERIPH_DRIVER

STM32F427X

USE_STM324x7I_EVAL

When I ''rebuild all'' it give me an error as following

arm_fft_bin_data.c  

Fatal Error[Pe1696]: cannot open source file ''ARMCM4.h'' C:\aKopin\0VC\STM32F4xx_DSP_StdPeriph_Lib_V1.1.0y\Libraries\CMSIS\Include\arm_math.h 269 

            searched: ''C:\aKopin\0VC\STM32F4xx_DSP_StdPeriph_Lib_V1.1.0y\Libraries\CMSIS\Include\'' 

            searched: ''C:\aKopin\0VC\STM32F4xx_DSP_StdPeriph_Lib_V1.1.0y\Project\testfft\'' 

            searched: ''C:\aKopin\0VC\STM32F4xx_DSP_StdPeriph_Lib_V1.1.0y\Project\testfft\EWARM\..\'' 

            searched: ''C:\aKopin\0VC\STM32F4xx_DSP_StdPeriph_Lib_V1.1.0y\Project\testfft\EWARM\..\..\..\Libraries\STM32F4xx_StdPeriph_Driver\inc\'' 

            searched: ''C:\aKopin\0VC\STM32F4xx_DSP_StdPeriph_Lib_V1.1.0y\Project\testfft\EWARM\..\..\..\Utilities\STM32_EVAL\Common\'' 

            searched: ''C:\aKopin\0VC\STM32F4xx_DSP_StdPeriph_Lib_V1.1.0y\Project\testfft\EWARM\..\..\..\Libraries\CMSIS\Device\ST\STM32F4xx\Include\'' 

            searched: ''C:\aKopin\0VC\STM32F4xx_DSP_StdPeriph_Lib_V1.1.0y\Project\testfft\EWARM\..\..\..\Libraries\CMSIS\Include\'' 

            searched: ''C:\Program Files (x86)\IAR Systems\Embedded Workbench 6.5\arm\CMSIS\Include\'' 

            searched: ''C:\Program Files (x86)\IAR Systems\Embedded Workbench 6.5\arm\inc\'' 

            searched: ''C:\Program Files (x86)\IAR Systems\Embedded Workbench 6.5\arm\inc\c\'' 

Error while running C/C++ Compiler 

arm_fft_bin_example_f32.c  

Fatal Error[Pe1696]: cannot open source file ''ARMCM4.h'' C:\aKopin\0VC\STM32F4xx_DSP_StdPeriph_Lib_V1.1.0y\Libraries\CMSIS\Include\arm_math.h 269 

            searched: ''C:\aKopin\0VC\STM32F4xx_DSP_StdPeriph_Lib_V1.1.0y\Libraries\CMSIS\Include\'' 

            searched: ''C:\aKopin\0VC\STM32F4xx_DSP_StdPeriph_Lib_V1.1.0y\Project\testfft\'' 

            searched: ''C:\aKopin\0VC\STM32F4xx_DSP_StdPeriph_Lib_V1.1.0y\Project\testfft\EWARM\..\'' 

            searched: ''C:\aKopin\0VC\STM32F4xx_DSP_StdPeriph_Lib_V1.1.0y\Project\testfft\EWARM\..\..\..\Libraries\STM32F4xx_StdPeriph_Driver\inc\'' 

            searched: ''C:\aKopin\0VC\STM32F4xx_DSP_StdPeriph_Lib_V1.1.0y\Project\testfft\EWARM\..\..\..\Utilities\STM32_EVAL\Common\'' 

            searched: ''C:\aKopin\0VC\STM32F4xx_DSP_StdPeriph_Lib_V1.1.0y\Project\testfft\EWARM\..\..\..\Libraries\CMSIS\Device\ST\STM32F4xx\Include\'' 

            searched: ''C:\aKopin\0VC\STM32F4xx_DSP_StdPeriph_Lib_V1.1.0y\Project\testfft\EWARM\..\..\..\Libraries\CMSIS\Include\'' 

            searched: ''C:\Program Files (x86)\IAR Systems\Embedded Workbench 6.5\arm\CMSIS\Include\'' 

            searched: ''C:\Program Files (x86)\IAR Systems\Embedded Workbench 6.5\arm\inc\'' 

            searched: ''C:\Program Files (x86)\IAR Systems\Embedded Workbench 6.5\arm\inc\c\'' 

Error while running C/C++ Compiler 

Thank you very much.

Yu Tang
Posted on September 30, 2013 at 01:55

You need the define ARM_MATH_CM4, otherwise is falls through and looks for an include you clearly don't have.

From the instructions in STM32F4xx_DSP_StdPeriph_Lib_V1.2.0\Libraries\CMSIS\Include\arm_math.h

* 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 or ARM_MATH_CM0PLUS depending on the target processor in the application.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
yutang_98
Associate II
Posted on September 30, 2013 at 19:35

Dear Sir:

Yes, I put #

define 

ARM_MATH_CM4 at beginning of arm_fft_bin_example_f32.c, but it give me error as following, please help to figure out the problem.

Fatal Error[Pe1696]: cannot open source file ''ARMCM4.h'' C:\Program Files (x86)\IAR Systems\Embedded Workbench 6.5\arm\CMSIS\Include\arm_math.h 280 

            searched: ''C:\Program Files (x86)\IAR Systems\Embedded Workbench 6.5\arm\CMSIS\Include\'' 

            searched: ''C:\aKopin\0VC\STM32F4xx_DSP_StdPeriph_Lib_V1.1.0y\Project\testfft\'' 

            searched: ''C:\aKopin\0VC\STM32F4xx_DSP_StdPeriph_Lib_V1.1.0y\Project\testfft\EWARM\..\'' 

            searched: ''C:\aKopin\0VC\STM32F4xx_DSP_StdPeriph_Lib_V1.1.0y\Project\testfft\EWARM\..\..\..\Libraries\CMSIS\Device\ST\STM32F4xx\Include\'' 

            searched: ''C:\aKopin\0VC\STM32F4xx_DSP_StdPeriph_Lib_V1.1.0y\Project\testfft\EWARM\..\..\..\Libraries\STM32F4xx_StdPeriph_Driver\inc\'' 

            searched: ''C:\aKopin\0VC\STM32F4xx_DSP_StdPeriph_Lib_V1.1.0y\Project\testfft\EWARM\..\..\..\Utilities\STM32_EVAL\Common\'' 

            searched: ''C:\aKopin\0VC\STM32F4xx_DSP_StdPeriph_Lib_V1.1.0y\Project\testfft\EWARM\..\..\..\Utilities\STM32_EVAL\STM3240_41_G_EVAL\'' 

            searched: ''C:\Program Files (x86)\IAR Systems\Embedded Workbench 6.5\arm\inc\'' 

            searched: ''C:\Program Files (x86)\IAR Systems\Embedded Workbench 6.5\arm\inc\c\'' 

Error while running C/C++ Compiler 

arm_fft_bin_example_f32.c  

Error[Pe011]: unrecognized preprocessing directive C:\Program Files (x86)\IAR Systems\Embedded Workbench 6.5\arm\CMSIS\Include\core_cm4.h 124 

Warning[Pe011]: unrecognized preprocessing directive C:\Program Files (x86)\IAR Systems\Embedded Workbench 6.5\arm\CMSIS\Include\arm_math.h 281 

Warning[Pa031]: IAR keyword ''__packed'' used with IAR extended language disabled C:\Program Files (x86)\IAR Systems\Embedded Workbench 6.5\arm\CMSIS\Include\arm_math.h 4971 

Error[Pe065]: expected a '';'' C:\Program Files (x86)\IAR Systems\Embedded Workbench 6.5\arm\CMSIS\Include\arm_math.h 4971 

Error[Pe020]: identifier ''vstate'' is undefined C:\Program Files (x86)\IAR Systems\Embedded Workbench 6.5\arm\CMSIS\Include\arm_math.h 4979 

Error[Pe018]: expected a '')'' C:\Program Files (x86)\IAR Systems\Embedded Workbench 6.5\arm\CMSIS\Include\arm_math.h 4979 

Warning[Pe177]: variable ''__packed'' was declared but never referenced C:\Program Files (x86)\IAR Systems\Embedded Workbench 6.5\arm\CMSIS\Include\arm_math.h 4971 

Error while running C/C++ Compiler 

Thank you very much.

Yu Tang

frankmeyer9
Associate II
Posted on September 30, 2013 at 20:20

Yes, I put #

define 

ARM_MATH_CM4 at beginning of arm_fft_bin_example_f32.c, but it give me error as following, please help to figure out the problem.

 

Changing the source code of the library is a rather bad idea.

Define ARM_MATH_CM4 on projects settings level, for instance in CPPFLAGS in the Makefile (or whatever your project is based on).

You might need to come to grips with you toolchain, the C language, and your build environment.

Posted on September 30, 2013 at 20:58

Not much into IAR, but you'll want the define globally, along with the USE_STDPERIPH_DRIVER, etc for the pre-processor.

The define clearly isn't being set, based on the include it's trying to pull in.
Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
yutang_98
Associate II
Posted on September 30, 2013 at 21:56

I put it, now the Defined Symbol as

USE_STDPERIPH_DRIVER

STM32F40XX

USE_STM324xG_EVAL

ARM_MATH_CM4

but I get new errors as following

arm_fft_bin_data.c  

Error[Pe011]: unrecognized preprocessing directive C:\Program Files (x86)\IAR Systems\Embedded Workbench 6.5\arm\CMSIS\Include\core_cm4.h 124 

Warning[Pe011]: unrecognized preprocessing directive C:\Program Files (x86)\IAR Systems\Embedded Workbench 6.5\arm\CMSIS\Include\arm_math.h 281 

Warning[Pa031]: IAR keyword ''__packed'' used with IAR extended language disabled C:\Program Files (x86)\IAR Systems\Embedded Workbench 6.5\arm\CMSIS\Include\arm_math.h 4971 

Error[Pe065]: expected a '';'' C:\Program Files (x86)\IAR Systems\Embedded Workbench 6.5\arm\CMSIS\Include\arm_math.h 4971 

Error[Pe020]: identifier ''vstate'' is undefined C:\Program Files (x86)\IAR Systems\Embedded Workbench 6.5\arm\CMSIS\Include\arm_math.h 4979 

Error[Pe018]: expected a '')'' C:\Program Files (x86)\IAR Systems\Embedded Workbench 6.5\arm\CMSIS\Include\arm_math.h 4979 

Warning[Pe177]: variable ''__packed'' was declared but never referenced C:\Program Files (x86)\IAR Systems\Embedded Workbench 6.5\arm\CMSIS\Include\arm_math.h 4971 

Error while running C/C++ Compiler 

arm_fft_bin_example_f32.c  

Error[Pe011]: unrecognized preprocessing directive C:\Program Files (x86)\IAR Systems\Embedded Workbench 6.5\arm\CMSIS\Include\core_cm4.h 124 

Warning[Pe011]: unrecognized preprocessing directive C:\Program Files (x86)\IAR Systems\Embedded Workbench 6.5\arm\CMSIS\Include\arm_math.h 281 

Warning[Pa031]: IAR keyword ''__packed'' used with IAR extended language disabled C:\Program Files (x86)\IAR Systems\Embedded Workbench 6.5\arm\CMSIS\Include\arm_math.h 4971 

Error[Pe065]: expected a '';'' C:\Program Files (x86)\IAR Systems\Embedded Workbench 6.5\arm\CMSIS\Include\arm_math.h 4971 

Error[Pe020]: identifier ''vstate'' is undefined C:\Program Files (x86)\IAR Systems\Embedded Workbench 6.5\arm\CMSIS\Include\arm_math.h 4979 

Error[Pe018]: expected a '')'' C:\Program Files (x86)\IAR Systems\Embedded Workbench 6.5\arm\CMSIS\Include\arm_math.h 4979 

Warning[Pe177]: variable ''__packed'' was declared but never referenced C:\Program Files (x86)\IAR Systems\Embedded Workbench 6.5\arm\CMSIS\Include\arm_math.h 4971 

Error while running C/C++ Compiler 

Please give me another help, thank you very much.

Yu

yutang_98
Associate II
Posted on September 30, 2013 at 21:57

I put it, now the Defined Symbol as

USE_STDPERIPH_DRIVER

STM32F40XX

USE_STM324xG_EVAL

ARM_MATH_CM4

but I get new errors as following

arm_fft_bin_data.c  

Error[Pe011]: unrecognized preprocessing directive C:\Program Files (x86)\IAR Systems\Embedded Workbench 6.5\arm\CMSIS\Include\core_cm4.h 124 

Warning[Pe011]: unrecognized preprocessing directive C:\Program Files (x86)\IAR Systems\Embedded Workbench 6.5\arm\CMSIS\Include\arm_math.h 281 

Warning[Pa031]: IAR keyword ''__packed'' used with IAR extended language disabled C:\Program Files (x86)\IAR Systems\Embedded Workbench 6.5\arm\CMSIS\Include\arm_math.h 4971 

Error[Pe065]: expected a '';'' C:\Program Files (x86)\IAR Systems\Embedded Workbench 6.5\arm\CMSIS\Include\arm_math.h 4971 

Error[Pe020]: identifier ''vstate'' is undefined C:\Program Files (x86)\IAR Systems\Embedded Workbench 6.5\arm\CMSIS\Include\arm_math.h 4979 

Error[Pe018]: expected a '')'' C:\Program Files (x86)\IAR Systems\Embedded Workbench 6.5\arm\CMSIS\Include\arm_math.h 4979 

Warning[Pe177]: variable ''__packed'' was declared but never referenced C:\Program Files (x86)\IAR Systems\Embedded Workbench 6.5\arm\CMSIS\Include\arm_math.h 4971 

Error while running C/C++ Compiler 

arm_fft_bin_example_f32.c  

Error[Pe011]: unrecognized preprocessing directive C:\Program Files (x86)\IAR Systems\Embedded Workbench 6.5\arm\CMSIS\Include\core_cm4.h 124 

Warning[Pe011]: unrecognized preprocessing directive C:\Program Files (x86)\IAR Systems\Embedded Workbench 6.5\arm\CMSIS\Include\arm_math.h 281 

Warning[Pa031]: IAR keyword ''__packed'' used with IAR extended language disabled C:\Program Files (x86)\IAR Systems\Embedded Workbench 6.5\arm\CMSIS\Include\arm_math.h 4971 

Error[Pe065]: expected a '';'' C:\Program Files (x86)\IAR Systems\Embedded Workbench 6.5\arm\CMSIS\Include\arm_math.h 4971 

Error[Pe020]: identifier ''vstate'' is undefined C:\Program Files (x86)\IAR Systems\Embedded Workbench 6.5\arm\CMSIS\Include\arm_math.h 4979 

Error[Pe018]: expected a '')'' C:\Program Files (x86)\IAR Systems\Embedded Workbench 6.5\arm\CMSIS\Include\arm_math.h 4979 

Warning[Pe177]: variable ''__packed'' was declared but never referenced C:\Program Files (x86)\IAR Systems\Embedded Workbench 6.5\arm\CMSIS\Include\arm_math.h 4971 

Error while running C/C++ Compiler 

Please give me another help, thank you very much.

Yu

Posted on September 30, 2013 at 23:35

Now it seems to be pulling include files from within IAR rather than those pathed within the DSP library. Secondarily it is complaining about ''packed'' and needing extended language features enabled. As you're using IAR, you should probably seek support from them after you have reviewed the manuals/documentation for your tool chain.

Are there any pre built project examples within the DSP library?
Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..