Problem with compiling Arduino library for XIAO ESP32S3

I built a face recognition model on Edge Impulse and have been trying to deploy the model. I am using the Seeed Studio XIAO ESP32S3 and Arduino IDE 2.3.2. The esp32 package is not an alpha version and I installed the 2.0.11 version after facing some issues with the compilation.

I keep getting this error every time I try to compile and the process takes a really long time.
This is the error message:
Error while detecting libraries included by c:\Users\user\Documents\Arduino\libraries\Face_Recognition_Model_-_Transfer_learning_3_Classes__inferencin\src\edge-impulse-sdk\porting\espressif\ESP-NN\src\pooling\esp_nn_max_pool_s8_esp32s3.S

I did check the path and file exists. Can anyone please help me out with this?

Hi @RucksikaaR

There are a few notes on this in the docs and in the forum have you tried to remove the ESP-NN folder. This can be found in the following directory: Arduino/libraries/<your-ei-project-name>/src/edge-impulse-sdk/porting/espressif/ESP-NN/. By deleting this folder, you can prevent the build process from linking to the unsupported ESP-NN files, which should resolve the compilation errors.

Best

Eoin

Thank you Sir. I will try this now.
After going through a tutorial, I replaced the ESP-NN with this: XIAO-ESP32S3-Sense/ESP-NN.zip at main · Mjrovai/XIAO-ESP32S3-Sense · GitHub
But it still gave me some issues.
Would there be any porting errors by deleting the ESP-NN folder?

I tried deleting the ESP NN folder but then I got another error stating that esp_nn.h was not found, so in ei_classifier_config.h under ‘classifier’ folder in edge-impulse-sdk directory, I changed

#define EI_CLASSIFIER_TFLITE_ENABLE_ESP_NN 1

to

#define EI_CLASSIFIER_TFLITE_ENABLE_ESP_NN 0

to disable NN functions.
It has not returned any error messages yet but it has been nearly 2 hours and it is still compiling. I enabled the verbose in Arduino IDE to monitor the process during compilation, and it feels like it’s getting stuck and then processing.
Is it normal for the compilation to take long?

This is the ei_classifier_config.h:

/*

  • Copyright (c) 2022 EdgeImpulse Inc.
  • Licensed under the Apache License, Version 2.0 (the “License”);
  • you may not use this file except in compliance with the License.
  • You may obtain a copy of the License at
  • http://www.apache.org/licenses/LICENSE-2.0
  • Unless required by applicable law or agreed to in writing,
  • software distributed under the License is distributed on an "AS
  • IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
  • express or implied. See the License for the specific language
  • governing permissions and limitations under the License.
  • SPDX-License-Identifier: Apache-2.0
    */

#ifndef EI_CLASSIFIER_CONFIG_H
#define EI_CLASSIFIER_CONFIG_H

// clang-format off

// This is a file that’s only used in benchmarking to override HW optimized kernels
#ifdef __has_include
#if __has_include(“source/benchmark.h”)
#include “source/benchmark.h”
#endif
#endif

#if EI_CLASSIFIER_TFLITE_ENABLE_SILABS_MVP == 1
#define EI_CLASSIFIER_TFLITE_ENABLE_CMSIS_NN 0
#define EI_CLASSIFIER_TFLITE_LOAD_CMSIS_NN_SOURCES 1
#endif

#ifndef EI_CLASSIFIER_TFLITE_ENABLE_CMSIS_NN
#if defined(MBED)
#include “mbed_version.h”
#if (MBED_VERSION < MBED_ENCODE_VERSION((5), (7), (0)))
#define EI_CLASSIFIER_TFLITE_ENABLE_CMSIS_NN 0
#else
#define EI_CLASSIFIER_TFLITE_ENABLE_CMSIS_NN 1
#endif // Mbed OS 5.7 version check

// __ARM_ARCH_PROFILE is a predefine of arm-gcc. _TARGET* is armcc
#elif __ARM_ARCH_PROFILE == ‘M’ || defined(__TARGET_CPU_CORTEX_M0) || defined(__TARGET_CPU_CORTEX_M0PLUS) || defined(__TARGET_CPU_CORTEX_M3) || defined(__TARGET_CPU_CORTEX_M4) || defined(__TARGET_CPU_CORTEX_M7) || defined(ARDUINO_NRF52_ADAFRUIT)
#define EI_CLASSIFIER_TFLITE_ENABLE_CMSIS_NN 1
#else
#define EI_CLASSIFIER_TFLITE_ENABLE_CMSIS_NN 0
#endif
#endif // EI_CLASSIFIER_TFLITE_ENABLE_CMSIS_NN

#if EI_CLASSIFIER_TFLITE_ENABLE_CMSIS_NN == 1
#define CMSIS_NN 1
#define EI_CLASSIFIER_TFLITE_LOAD_CMSIS_NN_SOURCES 1
#endif

#ifndef EI_CLASSIFIER_TFLITE_ENABLE_ARC
#ifdef CPU_ARC
#define EI_CLASSIFIER_TFLITE_ENABLE_ARC 1
#else
#define EI_CLASSIFIER_TFLITE_ENABLE_ARC 0
#endif // CPU_ARC
#endif // EI_CLASSIFIER_TFLITE_ENABLE_ARC

#ifndef EI_CLASSIFIER_TFLITE_ENABLE_ESP_NN
#if defined(ESP32)
#include “sdkconfig.h”
#define EI_CLASSIFIER_TFLITE_ENABLE_ESP_NN 0
#define ESP_NN 0
#endif // ESP32 check
#if defined(CONFIG_IDF_TARGET_ESP32S3)
#define EI_CLASSIFIER_TFLITE_ENABLE_ESP_NN_S3 0
#endif // ESP32S3 check
#else
#define ESP_NN 0
#endif

// no include checks in the compiler? then just include metadata and then ops_define (optional if on EON model)
#ifndef __has_include
#include “model-parameters/model_metadata.h”
#if (EI_CLASSIFIER_INFERENCING_ENGINE == EI_CLASSIFIER_TFLITE) && (EI_CLASSIFIER_COMPILED == 1)
#include “tflite-model/trained_model_ops_define.h”
#endif
#else
#if __has_include(“tflite-model/trained_model_ops_define.h”)
#include “tflite-model/trained_model_ops_define.h”
#endif
#endif // __has_include

// clang-format on
#endif // EI_CLASSIFIER_CONFIG_H

Please let me know if I did it correctly or if there is something I should correct. Thanks in advance.

Hi @RucksikaaR

You will need to remove the folder, and mark the NN to 0:

  • Remove the ESP-NN Folder:
  • Navigate to the directory: Arduino/libraries/<your-ei-project-name>/src/edge-impulse-sdk/porting/espressif/ESP-NN/.
  • Delete the entire ESP-NN folder. This prevents the build process from attempting to link to unsupported ESP-NN files, which are known to cause compilation errors.
  • Modify the ei_classifier_config.h File:
  • Locate the ei_classifier_config.h file within the classifier folder in the edge-impulse-sdk directory.
  • Update the line:
#define EI_CLASSIFIER_TFLITE_ENABLE_ESP_NN 1

to

#define EI_CLASSIFIER_TFLITE_ENABLE_ESP_NN 0

Best

Eoin

Thank you sir. It compiles perfectly alright now.