Issue working with "ml-edgeimpulse-project-builder"

Hi there,

My recent project is trying to integrate the machine learning model trained on the Edge Impulse with my existing project developed in MPLAB (ver. 6.0.0) with xc32-gcc (ver.4.2.0).

The MCU I am using is ATSAMD21J16B.

I was generally following this two instructions:

I so far I was able to use docker to build the Edge Impulse model that is supposedly ready to be integrated to the MPLAB project.

However, when I try to compile the library with the project, I ran into the following issue:

…/src/ML/edge-impulse-sdk/dsp/numpy.hpp:32:10: fatal error: cfloat: No such file or directory
#include <cfloat>
^~~~~~~~
compilation terminated.
make[2]: *** [build/default/production/_ext/818654064/drv_usbfsv1_device.o] Error 255
make[2]: *** Waiting for unfinished jobs…

After some google search, it seems like cfloat is obsolete now, which is unfortunate considering the “ml-edgeimpulse-project-builder” repo was last updated a year ago.

I was assuming, the repo is pretty up to date and should be pretty “plug and play” sort to speak.

Has anyone work with " “ml-edgeimpulse-project-builder”, would you shed some lights please?

Could it be the issue with the edge impulse library or something to dig more with MPLAB?

Appreciate any insights, thanks in advanced.

Cheers,
Jordan

Hi @lhjordanlh

Thanks for informing us, I’m not aware of this project builder integration. Checking with our technical team.

Are you trying to change the compiler settings in MPLAB? If you are unable to get the correct compiler version to run in MPLAB with the version that project is expecting, you may be best to ask the question on their git repo.

Best,

Eoin

Hi @lhjordanlh

As we wait to see if there is any further info please try updating your compiler in MPLAB. Follow the steps here: Configuring Project Build Options - Developer Help

Let me know if this resolves your issue, and if you get any help on their forum please link back here. Thanks!

Best

Eoin

Hi Eoin,

Thanks for your reply. After more digging and messing around, it doesn’t seem to solve the issue.
First of all, the document you shared with me is obsolete with the latest version of MPLAB. This one seems to be the more updated version: https://ww1.microchip.com/downloads/aemDocuments/documents/DEV/ProductDocuments/UserGuides/MPLAB-XC32-Compiler-UG-PIC32C-DS-50002895.pdf
However, it doesn’t seem to have other options for 32 bits compilers that I can use. I then tried using old ATMEL Arm compiler toolchain 6.3.1 and it doesn’t help the case either: Build MPLAB Harmony v3 project with ARM GCC toolchain in MPLAB X IDE | Microchip MPLAB Harmony Quick Documentation help

When manually linking the , multiple other files are also missing.

Does EdgeImpulse have a tutorial or other resources to help integrating ML model outputted from your platform to work with MPLAB ver 6.XX with ATSAM series MCU?

cheers,
Jordan

Hi @lhjordanlh

No we don’t yet unfortunately, I’ve checked with the tech team and we are only learning of this integration.

I’m not very familiar with microchip and their IDE/SDK. Tried following along with the setup with a fresh project, but didn’t hit the same problem. (if anyone else is reading this with microchip experience and wants to give advice please do)

I installed 6.15 and the only thing I noticed was their command needs to be updated to specify the version 6.15 etc you install for the SDK/IDE. Other than that I cant really give much else here.

MPLABX_VERSION=6.15 XC_VERSION=4.00 XC_NUMBER_BITS=32 ./build.sh ATSAME54P20A libedgeimpulse .

Did you try asking on their forum or the git repo?

Best

Eoin

Hi Eoin,
Thanks for you efforts.
When you say you haven’t encountered the same issue, were you able to compile the example project in MAPLAB?

What other resources would you recommend if I were to integrate model generated from Edge Impulse with MPLAB?

I have filed an issue in the repo and also posted on the forum, I have not heard back from Microchip yet.

Cheers,
Jordan

Hi Eoin,

I have not heard back from you, but I have in fact inquired with Microchip and was told that the builder is not up to date.

It seems like they recommend using their own ML training platform: https://www.microchip.com/en-us/tools-resources/develop/mplab-machine-learning-development-suite and ask us to ditch Edge Impulse all together.

However, we already have the setup and are still interested in deploying the model to our existing MCU if possible. Do you have other resources or recommendation for us to build the model with our MCU without their build tool?

Cheers,
Jordan

Hi Eoin,

Not sure if you are still able to look a little bit further into this issue.

I was trying to just run the model in Arduino Nano 33 BLE, and run into the following issue:

C:\Users\lhjor\AppData\Local\Temp\arduino\sketches\EC5BB9A52BCFE2A5CE49941D702B8F24\sketch\objs.a(static_buffer.ino.cpp.o):(.data.ei_dsp_blocks+0x2c): undefined reference to `extract_swipe_features_extraction_features(ei::ei_signal_t*, ei::ei_matrix*, void*, float)’
collect2.exe: error: ld returned 1 exit status

Using library SWIPE_Detection_inferencing at version 1.0.5 in folder: C:\Users\lhjor\Documents\Arduino\libraries\SWIPE_Detection_inferencing
exit status 1

Compilation error: exit status 1

Do you have any clue why? Is there something wrong about the library itself?

Cheers,
Jordan

Hi @lhjordanlh

Let me check into the nano one for you first, as I don’t have any hardware to fully test the Microchip integration.

Arduino Nano

You need to copy and paste your raw features into the Raw features array e.g.:

Click on the ‘Copy to clipboard’ button next to ‘Raw features’. On the processing This will copy the raw values from this validation file, before any signal processing or inferencing happened.

static const float features[] = {
    -19.8800, -0.6900, 8.2300, -17.6600, -1.1300, 5.9700, ...
};

You can read more on developing for the nano in this guide:

Microchip Integration

Sorry to hear they will not support the integration, hopefully we can hear from them officially. As we open up the possibility to build Edge AI solutions for all vendors and architectures. It would be great to have their integration working. I tested the MAPLAB integration by following the instructions to try to get the same error as you had, but couldn’t hit it. Possibly the pathway, different OS, or lack of hardware.

In the meantime perhaps we can troubleshoot it a bit deeper, I have created a fork of that repo we can debug on:

There are some build args that are not honoured throughout the running of the docker command, which need to be updated if you change the MPLAB version from the one in the script e.g.:

MPLABX_VERSION=6.15 XC_VERSION=4.00 XC_NUMBER_BITS=32 ./build.sh ATSAME54P20A libedgeimpulse .

=> CANCELED [ 3/13] RUN wget -qO /tmp/mplabx-installer.tar “http://ww1.microchip.com/downloads/en/DeviceDoc/MPLABX-**v6.00**-linux-installer.tar” & 0.4s

So perhaps you can verify they are all correct on your system, and we can update accordingly.

Best

Eoin