Arduino exported library - arm_max_pool_s8.c include errors

Working on a gesture recognition prototype running on an ESP32 dev board.
Included as a platform.io library, the deployed Arduino library fails to compile with an error in the file:
src/edge_impulse_sdk/CMSIS/NN/Source/PoolingFunctions/arm_max_pool_s8.c
Due to line 32:
'#include <arm_math.h>Replacing with:#include “edge-impulse-sdk/CMSIS/DSP/Include/arm_math.h”`
Resolves the issue.

Hi @dperez, this is interesting actually - how come the ARM headers are even loaded here? The ESP32 is not an ARM target, and I thus expect https://github.com/edgeimpulse/inferencing-sdk-cpp/blob/c2567861f6c143acf0ce9c02ec3e5aa7de70f682/classifier/ei_classifier_config.h#L30 to evaluate to 0 and we don’t load any CMSIS-NN related code…

True!
Removing the CMSIS folder altogether works.

It would seem platform.io compiles all source files it finds in its library folder, even those not included in the actual code.

By the way, enjoying the API, the nodejs data acquisition interface makes it seem almost too easy.

@dperez yeah, annoying. Do you happen to know if there’s a way where we can exclude folders for certain targets (e.g. Mbed OS has TARGET_* folders which are loaded on a per-target or per-architecture basis) in a manner where Arm cores would still load the CMSIS extensions, but platform.io would ignore them for ESP32?

By the way, enjoying the API, the nodejs data acquisition interface makes it seem almost too easy.

Thanks!

I imagine you’d have to use the library.json file (within the base library folder), modifying the extrascripts property to conditionally change the src_filter variable. The docs mention something along the lines of:

library.json:

{
   "name": "SomeLib",
   "version": "0.0.0",
   "build": {
       "extraScript": "extra_script.py"
   }
}

And then also in the root of the library folder:

extra_script.py:

Import("env")

MBED_PLATFORM = "mbed"    
platform = env.get("PIOPLATFORM")

try:
  if (platform != MBED_PLATFORM):
    env.Replace(SRC_FILTER=[ "+<*>","-<edge-impulse-sdk/examples/*>","-<edge-impulse-sdk/CMSIS>"])          
except:
  pass

I’m not 100% sure that’s the platform string for mbed enabled devices (“mbed”). For example on the esp32 the value of platform is “espressif32”, regardless of using the arduino or esp-idf frameworks.

Interesting, I’ll take a look at it in the near future!