For some reason unknown to me, arduino-nRF5/cores/nRF5/SDK/components/toolchain/CMSIS/Include at master · sandeepmistry/arduino-nRF5 · GitHub gives you the arm_math.h and related header files, but doesn’t actually include the library file where the functions are implemented…
You can either:
- compile the CMSIS-DSP library from the source files (here)
- tell the linker to link against the statically compiled library
I’ll do the latter because it’s easier. The libraries are compiler per Cortex flavour, so you have the Cortex-M3, M4, M4F (M4 + FPU) etc. Your nrf52_dk board has a nRF52832 which is in turn a "The ARM® Cortex®-M4 processor with floating-point unit (FPU) " (here, here), i.e. an M4F. However, PlatformIO compiles the firmware using soft-float instead of hard-float (-mcpu=cortex-m4 -mfloat-abi=softfp -mfpu=fpv4-sp-d16, here), which means we actually have to use the link-compatible M4 type. See here for an explanation on float-ABIs.
To make the project compile, do:
- download
libarm_cortexM4l_math.afrom here - place the file in your project folder
- add the line
build_flags = -l arm_cortexM4l_mathto the the build environment of the[env:nrf52_dk] - observe
[SUCCESS] Took 10.10 secondsat the end of the compilation