2 Replies Latest reply: Dec 12, 2013 3:31 PM by simplehhan RSS

How can I resolve the issue - including arm_math.h makes systick function unavailable?

simplehhan Bit

I tried to use FFT functions in a project and included the header file required for CMSIS library, arm_math.h.

But I found one issue.

Including “arm_math.h” in a project disables systick function which is used as timer event implementing source for the project.

 

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

 

If this is removed, any of CMSIS library functions becomes unavailable.

What is the reason of disabling Systick function?

Is there any work-around way on the issue?

  • Re: How can I resolve the issue - including arm_math.h makes systick function unavailable?
    Martin Günther Employee

    Hello simplehhan,

     

    The CMSIS DSP library (arm_math.h) includes the CMSIS core files (e.g.: core_cm4.h) but uses only the core generic part of the CMSIS core file. The core dependant part, which contains also the SysTick defines is not used and therefore not included. This is achieved with setting the define __CMSIS_GENERIC.

    The CMSIS core file is also included in the device specific header file, which needs to be CMSIS compliant (as an example you can check file .\Keil\ARM\Device\ARM\ARMCM4\Include\ARMCM4.h)
    If you want to use the CMSIS DSP library together with the CMSIS SysTick definitions you need to include both arm_math.h and CMSIS compliant device header file.

     

    e.g.:

    #include "arm_math.h"

    #include "ARMCM4.h"

     

    Best Regards,
    Martin Guenther

    • Re: How can I resolve the issue - including arm_math.h makes systick function unavailable?
      simplehhan Bit

      Now somehow Systick function is working. I don't know what was different in the first.

      In my source code, arm_math.h is included and ARM_MATH_CM4 is defined in complier preprecessor setup.

      Is that the point of the your comment - just including arm_math.h and armcm4.h will resolve the issue?

      "arm_math.h" included has the following codes.

      The function of the code below, what I expect is, to disable Systick if arm_math.h is included.

       

      #ifndef _ARM_MATH_H
      #define _ARM_MATH_H

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

      #if defined (ARM_MATH_CM4)
      #include "core_cm4.h"

      ...
      #else
      #include "ARMCM4.h"
      #warning "Define either ARM_MATH_CM4 OR ARM_MATH_CM3...By Default building on ARM_MATH_CM4....."
      #endif    /* I (Hyeong Han) think this is the end of block end starting with  #ifdef_ARM_MATH_H, which means

                       the definition code enabling Systick functions is not entered if arm_math.h is included in the source code.

       

      #undef  __CMSIS_GENERIC         /* enable NVIC and Systick functions */
      #include "string.h"
      #include "math.h"
      #ifdef __cplusplus
      extern "C"
      {
      #endif

      Thank you Martin for your support.

      Best regards,

      Hyeong Han