Skip to content

how to use arm_math.h #325

@jerabaul29

Description

@jerabaul29

I want to use some functions in arm_math.h .

I noticed something surprising. If I do something like this:

// with inspiration from https://os.mbed.com/users/martinsimpson/code/CMSIS_FFT_mbed_os_DAC//file/05e2c9ca68e2/main.cpp/

#include "mbed.h"
#include "arm_math.h"

void setup() {
  // put your setup code here, to run once:

}

void loop() {
  // put your main code here, to run repeatedly:

}

Then I get a compile error:

Error while detecting libraries included by /tmp/arduino_build_107529/sketch/recipe_FFT.ino.cpp
Generating function prototypes...
/home/jrlab/.arduino15/packages/SparkFun/tools/arm-none-eabi-gcc/8-2018-q4-major/bin/arm-none-eabi-g++ -include /home/jrlab/.arduino15/packages/SparkFun/hardware/apollo3/2.0.3/variants/SFE_ARTEMIS/mbed/mbed_config.h -include /home/jrlab/.arduino15/packages/SparkFun/hardware/apollo3/2.0.3/cores/arduino/sdk/ArduinoSDK.h -iprefix/home/jrlab/.arduino15/packages/SparkFun/hardware/apollo3/2.0.3/cores/ @/home/jrlab/.arduino15/packages/SparkFun/hardware/apollo3/2.0.3/variants/SFE_ARTEMIS/mbed/.cxx-flags -w -x c++ -E -CC -DARDUINO=10813 -DARDUINO_APOLLO3_SFE_ARTEMIS -DARDUINO_ARCH_MBED -DARDUINO_ARCH_APOLLO3 -DMBED_NO_GLOBAL_USING_DIRECTIVE -DCORDIO_ZERO_COPY_HCI -I/home/jrlab/.arduino15/packages/SparkFun/hardware/apollo3/2.0.3/cores/arduino -I/home/jrlab/.arduino15/packages/SparkFun/hardware/apollo3/2.0.3/variants/SFE_ARTEMIS -I/home/jrlab/.arduino15/packages/SparkFun/hardware/apollo3/2.0.3/cores/arduino -I/home/jrlab/.arduino15/packages/SparkFun/hardware/apollo3/2.0.3/cores/arduino/mbed-bridge -I/home/jrlab/.arduino15/packages/SparkFun/hardware/apollo3/2.0.3/cores/arduino/mbed-bridge/core-api @/home/jrlab/.arduino15/packages/SparkFun/hardware/apollo3/2.0.3/variants/SFE_ARTEMIS/mbed/.includes /tmp/arduino_build_107529/sketch/recipe_FFT.ino.cpp -o /tmp/arduino_build_107529/preproc/ctags_target_for_gcc_minus_e.cpp -DARDUINO_LIB_DISCOVERY_PHASE
In file included from /home/jrlab/Desktop/Git/Artemis_MbedOS_recipes/recipes/recipe_FFT/recipe_FFT.ino:6:
/home/jrlab/.arduino15/packages/SparkFun/hardware/apollo3/2.0.3/cores/mbed-os/cmsis/TARGET_CORTEX_M/arm_math.h:345:4: error: #error "Define according the used Cortex core ARM_MATH_CM7, ARM_MATH_CM4, ARM_MATH_CM3, ARM_MATH_CM0PLUS, ARM_MATH_CM0, ARM_MATH_ARMV8MBL, ARM_MATH_ARMV8MML"
   #error "Define according the used Cortex core ARM_MATH_CM7, ARM_MATH_CM4, ARM_MATH_CM3, ARM_MATH_CM0PLUS, ARM_MATH_CM0, ARM_MATH_ARMV8MBL, ARM_MATH_ARMV8MML"
    ^~~~~
exit status 1
Error compiling for board RedBoard Artemis.

The apollo3 is a cortex-M4 if I understood well, so I tried:

// with inspiration from https://os.mbed.com/users/martinsimpson/code/CMSIS_FFT_mbed_os_DAC//file/05e2c9ca68e2/main.cpp/

#define ARM_MATH_CM4

#include "mbed.h"
#include "arm_math.h"

void setup() {
  // put your setup code here, to run once:

}

void loop() {
  // put your main code here, to run repeatedly:

}

This compiles, but getting a warning:

Compiling sketch...
/home/jrlab/.arduino15/packages/SparkFun/tools/arm-none-eabi-gcc/8-2018-q4-major/bin/arm-none-eabi-g++ -include /home/jrlab/.arduino15/packages/SparkFun/hardware/apollo3/2.0.3/variants/SFE_ARTEMIS/mbed/mbed_config.h -include /home/jrlab/.arduino15/packages/SparkFun/hardware/apollo3/2.0.3/cores/arduino/sdk/ArduinoSDK.h -iprefix/home/jrlab/.arduino15/packages/SparkFun/hardware/apollo3/2.0.3/cores/ @/home/jrlab/.arduino15/packages/SparkFun/hardware/apollo3/2.0.3/variants/SFE_ARTEMIS/mbed/.cxx-flags -DARDUINO=10813 -DARDUINO_APOLLO3_SFE_ARTEMIS -DARDUINO_ARCH_MBED -DARDUINO_ARCH_APOLLO3 -DMBED_NO_GLOBAL_USING_DIRECTIVE -DCORDIO_ZERO_COPY_HCI @/home/jrlab/.arduino15/packages/SparkFun/hardware/apollo3/2.0.3/variants/SFE_ARTEMIS/mbed/.cxx-symbols -I/home/jrlab/.arduino15/packages/SparkFun/hardware/apollo3/2.0.3/cores/arduino -I/home/jrlab/.arduino15/packages/SparkFun/hardware/apollo3/2.0.3/variants/SFE_ARTEMIS -I/home/jrlab/.arduino15/packages/SparkFun/hardware/apollo3/2.0.3/cores/arduino -I/home/jrlab/.arduino15/packages/SparkFun/hardware/apollo3/2.0.3/cores/arduino/mbed-bridge -I/home/jrlab/.arduino15/packages/SparkFun/hardware/apollo3/2.0.3/cores/arduino/mbed-bridge/core-api @/home/jrlab/.arduino15/packages/SparkFun/hardware/apollo3/2.0.3/variants/SFE_ARTEMIS/mbed/.includes /tmp/arduino_build_107529/sketch/recipe_FFT.ino.cpp -o /tmp/arduino_build_107529/sketch/recipe_FFT.ino.cpp.o
/home/jrlab/Desktop/Git/Artemis_MbedOS_recipes/recipes/recipe_FFT/recipe_FFT.ino:3: warning: "ARM_MATH_CM4" redefined
 #define ARM_MATH_CM4

Any idea why the compiler complains about a re-definition while it was saying it was missing initialliy?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions