Skip to content

arm_math.h functions not included in core #7

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
janjongboom opened this issue Jun 30, 2020 · 10 comments
Open

arm_math.h functions not included in core #7

janjongboom opened this issue Jun 30, 2020 · 10 comments
Assignees

Comments

@janjongboom
Copy link
Contributor

janjongboom commented Jun 30, 2020

@facchinm we have the following code which compiles fine against the nRF52 core (Arduino nRF528x Boards (Mbed OS) v1.1.4), but not against Portenta H7 (M7 core) (Arduino mbed-enabled Boards v1.2.0). I think the CMSIS-DSP functions are not compiled into this core...

#include <Arduino.h>
#include "arm_math.h"

void setup() {
   float v1[] = { 3.21f, 1.27f };
   float v2[] = { 8.21f, 3.33f };
   float dest[2];
   arm_add_f32(v1, v2, dest, 2);
   Serial.print(dest[0]);
   Serial.print(dest[1]);
   Serial.println();
}

void loop() {
  
}

This fails when linking with:

/var/folders/3r/fds0qzv914ng4t17nhh5xs5c0000gn/T/arduino_build_436493/sketch/asdhjasdhjqwfd2.ino.cpp.o: In function `setup':
/Users/janjongboom/Documents/Arduino/libraries/ei-continuous-gestures-arduino-1.0.10/examples/asdhjasdhjqwfd2/asdhjasdhjqwfd2.ino:30: undefined reference to `arm_add_f32'
collect2: error: ld returned 1 exit status
exit status 1
Error compiling for board Arduino Portenta H7 (M7 core).
@facchinm
Copy link
Member

The omission is due to this commit (ARMmbed/mbed-os@50455c0) which removed the unsupported folder from mbed tree. I can restore and precompile cmsis-dsp but probably it's a better idea to provide it as a downloadable library.
What do you think?

@janjongboom
Copy link
Contributor Author

janjongboom commented Jun 30, 2020

@facchinm Ah. Are you going to be updating the nRF52 core to Mbed OS 6.0.0 as well? If so, we can just ship the source with the library (as we do for non-Arduino targets). Now it's complicated, with some targets having CMSIS-DSP sources, and some not.

@facchinm
Copy link
Member

As soon as this repo is fully validated the idea is to "deprecate" the old one and switch 100% here for nRF52 too.

@janjongboom
Copy link
Contributor Author

janjongboom commented Jun 30, 2020

@facchinm It's a weird choice on the Mbed OS side though, because the arm_math library is still in the core:

janjongboom:~/Library/Arduino15/packages/arduino-beta/hardware/mbed/1.2.0/cores $ find . -name "arm_math.h"
./arduino/mbed/cmsis/TARGET_CORTEX_M/arm_math.h

And also in Mbed OS 6, but the actual implementation has disappeared. Have filed an issue with the mbed-os repository.

@sabas1080
Copy link

sabas1080 commented Sep 4, 2020

Hi @janjongboom

I have the same problem with https://github.com/DaleGia/nano-33-sense-serial-example, could you solve it?

@Soulkrown
Copy link

Hi @janjongboom @facchinm

I have the same problem with https://github.com/DaleGia/nano-33-sense-serial-example, could you solve it?

@janjongboom
Copy link
Contributor Author

We've 'solved' it like this:

  1. Header that defines whether to load CMSIS-DSP based on Mbed headers, then detects Mbed OS >6 and sets the EIDSP_LOAD_CMSIS_DSP_SOURCES macro. https://github.com/edgeimpulse/inferencing-sdk-cpp/blob/67f085eb39033edf80e1ea8e41f5c089b65187e3/dsp/config.hpp#L26
  2. On Arduino: guard all CMSIS-DSP .c files with this macro: https://github.com/edgeimpulse/firmware-arduino-nano-33-ble-sense/blob/b4f9e3ffc136c7b3f9ce66bbe16a0d166fdcb38c/src/edge-impulse-sdk/CMSIS/DSP/Source/TransformFunctions/TransformFunctionsF16.c#L1

@dbuggz
Copy link

dbuggz commented May 3, 2021

Still an issue, this time in, BLESense_dash_sketch on Arduino Create.

/tmp/082760084/BLESense_dash_sketch/BLESense_dash_sketch.ino:23:10: fatal error: arm_math.h: No such file or directory

#include <arm_math.h>

^~~~~~~~~~~~

compilation terminated.

exit status 1

@hussain2603
Copy link

This is still an issue, the arm_math.h file is missing.

@facchinm
Copy link
Member

@janjongboom @hussain2603 @dbuggz we just published https://github.com/arduino-libraries/Arduino_CMSIS-DSP in the library manager; since mbed now doesn't ship anymore arm_math.h you can safely add that library (to the dependency field of your library.properties or just installing it manually) and it will be picked up.
The library is just a repackaging of the official CMSIS-DSP from https://github.com/ARM-software/CMSIS_5

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants