ESP 32 cam, Compilation Error

Hi all,
I’m trying to work on a new project with the esp 32 cam and an Arduino Mega and I was following this tutorial: https://www.youtube.com/watch?v=UaNy53AnAQg
i did everything like the video says, but i get the following error when I verify the code in Arduino IDE:

c:\Users\User\Documents\Arduino\libraries\htasoji-project-1_inferencing\src\edge-impulse-sdk\tensorflow\lite\micro\kernels\conv.cpp: In function ‘TfLiteStatus tflite::{anonymous}::Prepare(TfLiteContext*, TfLiteNode*)’:
c:\Users\User\Documents\Arduino\libraries\htasoji-project-1_inferencing\src\edge-impulse-sdk\tensorflow\lite\micro\kernels\conv.cpp:1789:67: error: either all initializer clauses should be designated or none of them should be
1789 | .channels = input->dims->data[3], 1
| ^
c:\Users\User\Documents\Arduino\libraries\htasoji-project-1_inferencing\src\edge-impulse-sdk\tensorflow\lite\micro\kernels\conv.cpp:1793:68: error: either all initializer clauses should be designated or none of them should be
1793 | .channels = output->dims->data[3], 1
| ^
c:\Users\User\Documents\Arduino\libraries\htasoji-project-1_inferencing\src\edge-impulse-sdk\tensorflow\lite\micro\kernels\conv.cpp:1795:80: error: either all initializer clauses should be designated or none of them should be
1795 | data_dims_t filter_dims = {.width = filter_width, .height = filter_height, 0, 0};
| ^
c:\Users\User\Documents\Arduino\libraries\htasoji-project-1_inferencing\src\edge-impulse-sdk\tensorflow\lite\micro\kernels\conv.cpp: In function ‘void tflite::{anonymous}::EvalQuantizedPerChannel(TfLiteContext*, TfLiteNode*, const TfLiteConvParams&, const NodeData&, const TfLiteEvalTensor*, const TfLiteEvalTensor*, const TfLiteEvalTensor*, TfLiteEvalTensor*)’:
c:\Users\User\Documents\Arduino\libraries\htasoji-project-1_inferencing\src\edge-impulse-sdk\tensorflow\lite\micro\kernels\conv.cpp:1883:58: error: either all initializer clauses should be designated or none of them should be
1883 | .channels = input_depth, 1
| ^
c:\Users\User\Documents\Arduino\libraries\htasoji-project-1_inferencing\src\edge-impulse-sdk\tensorflow\lite\micro\kernels\conv.cpp:1887:59: error: either all initializer clauses should be designated or none of them should be
1887 | .channels = output_depth, 1
| ^
c:\Users\User\Documents\Arduino\libraries\htasoji-project-1_inferencing\src\edge-impulse-sdk\tensorflow\lite\micro\kernels\conv.cpp:1889:80: error: either all initializer clauses should be designated or none of them should be
1889 | data_dims_t filter_dims = {.width = filter_width, .height = filter_height, 0, 0};
| ^
c:\Users\User\Documents\Arduino\libraries\htasoji-project-1_inferencing\src\edge-impulse-sdk\tensorflow\lite\micro\kernels\depthwise_conv.cpp: In function ‘void tflite::{anonymous}::EvalQuantizedPerChannel(TfLiteContext*, TfLiteNode*, const TfLiteDepthwiseConvParams&, const NodeData&, const TfLiteEvalTensor*, const TfLiteEvalTensor*, const TfLiteEvalTensor*, TfLiteEvalTensor*)’:
c:\Users\User\Documents\Arduino\libraries\htasoji-project-1_inferencing\src\edge-impulse-sdk\tensorflow\lite\micro\kernels\depthwise_conv.cpp:1727:58: error: either all initializer clauses should be designated or none of them should be
1727 | .channels = input_depth, 1
| ^
c:\Users\User\Documents\Arduino\libraries\htasoji-project-1_inferencing\src\edge-impulse-sdk\tensorflow\lite\micro\kernels\depthwise_conv.cpp:1731:59: error: either all initializer clauses should be designated or none of them should be
1731 | .channels = output_depth, 1
| ^
c:\Users\User\Documents\Arduino\libraries\htasoji-project-1_inferencing\src\edge-impulse-sdk\tensorflow\lite\micro\kernels\depthwise_conv.cpp:1733:80: error: either all initializer clauses should be designated or none of them should be
1733 | data_dims_t filter_dims = {.width = filter_width, .height = filter_height, 0, 0};
| ^
c:\Users\User\Documents\Arduino\libraries\htasoji-project-1_inferencing\src\edge-impulse-sdk\tensorflow\lite\micro\kernels\depthwise_conv.cpp: In function ‘TfLiteStatus tflite::{anonymous}::Prepare(TfLiteContext*, TfLiteNode*)’:
c:\Users\User\Documents\Arduino\libraries\htasoji-project-1_inferencing\src\edge-impulse-sdk\tensorflow\lite\micro\kernels\depthwise_conv.cpp:1836:67: error: either all initializer clauses should be designated or none of them should be
1836 | .channels = input->dims->data[3], 1
| ^
c:\Users\User\Documents\Arduino\libraries\htasoji-project-1_inferencing\src\edge-impulse-sdk\tensorflow\lite\micro\kernels\depthwise_conv.cpp:1840:68: error: either all initializer clauses should be designated or none of them should be
1840 | .channels = output->dims->data[3], 1
| ^
c:\Users\User\Documents\Arduino\libraries\htasoji-project-1_inferencing\src\edge-impulse-sdk\tensorflow\lite\micro\kernels\depthwise_conv.cpp:1842:80: error: either all initializer clauses should be designated or none of them should be
1842 | data_dims_t filter_dims = {.width = filter_width, .height = filter_height, 0, 0};
| ^

Using library htasoji-project-1_inferencing at version 1.0.1 in folder: C:\Users\User\Documents\Arduino\libraries\htasoji-project-1_inferencing
exit status 1

Compilation error: exit status 1

Project ID: 432097

I hope someone can help me out :slight_smile:

Hi @htasoji I solved the problem by editing the file ei_classifier_config in model_library\src\edge-impulse-sdk\classifier
#if defined(ESP32)
#include “sdkconfig.h”
#define EI_CLASSIFIER_TFLITE_ENABLE_ESP_NN 1
#define ESP_NN 0
#endif // ESP32 check

Not sure if this is the correct solution for this problem

3 Likes

Hi, thanks for your help, but i couldnt try because now i get this error code:

cc1plus.exe: fatal error:
c:\Users\User\Downloads\ei-htasoji-project-1-arduino-1.0.5\htasoji-project-1_inferencing\src\edge-impulse-sdk\classifier\libraries\first_inferencing\src\edge-impulse-sdk\porting\espressif\ESP-NN\src\convolution\esp_nn_conv_s8_filter_aligned_input_padded_esp32s3.S: No such file or directory
compilation terminated.
Alternatives for c: []
ResolveLibrary(c)
→ candidates: []
exit status 1

Compilation error: exit status 1

The file is named correctly and its also the right parth when I look it up.
I dont know why this error appears. I hope someone can help.

I am having the same exact issue. Just by looking at the error message and doing a quick search, I found out that all of the "1"s in the error and corresponding files need to be set equal to something, they cannot stand alone after the comma. However, I have no idea what to set it equal to. Just to see the effect, I deleted all of the "1"s from the files and tried compiling it again. The code compiled without errors, but the ESP-32 just constantly sent random symbols and numbers to the serial monitor after the code was uploaded. If anyone knows the correct way to deal with the "1"s, I would also greatly appreciate it.

1 Like

Hi @Kavesh @Balexander

Can you try the following troubleshooting steps and share any debugging output?

  1. Update the ESP32 Arduino Core: Ensure you are using a compatible version of the ESP32 Arduino core. Versions 2.0.4 or 2.0.5 are recommended:
  • Go to the Arduino IDE preferences.
  • Add the URL https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_index.json.
  • Update the board manager to the specified version and recompile.
  1. Modify the Initializer Clauses: The error indicates that either all or none of the initializer clauses in your structure should be designated. Here’s how you can modify your code:
data_dims_t filter_dims = {
    .width = filter_width, 
    .height = filter_height, 
    .channels = channels, 
    .depth = depth // Ensure all fields are initialized
};

Ensure all fields in your structures are initialized consistently. This change should resolve the initializer clause errors.
3. Check for Missing Files: Verify that all required files, such as esp_nn_conv_s8_filter_aligned_input_padded_esp32s3.S, are present in your project directory. If they are missing, it might be due to a sync issue with the Edge Impulse SDK. You can try the following:

  • Remove the ESP-NN/ folder found in Arduino/libraries/htasoji-project-1_inferencing/src/edge-impulse-sdk/porting/espressif/ and then re-download the dependencies. More details can be found here and here.
  1. File Path Verification: Ensure the file paths are correctly set in your build configuration. The path mentioned in the error message should point to the correct directory where the necessary files are stored. Correct any incorrect paths to avoid file not found errors.
  2. Reset and Reconnect: Sometimes, simply pressing the reset button on the ESP32-CAM can resolve initialization issues. If the camera fails to initialize after resolving compilation errors, try resetting the device.
  3. Enable PSRAM: Make sure that PSRAM is enabled when selecting the ESP32 Dev Module in the Arduino IDE. This can be done by selecting the appropriate settings in the tools menu.

Best

Eoin

Thank you for the troubleshooting steps. I attempted the first step but was met with the following error:

In file included from c:\users\BA\appdata\local\arduino15\packages\esp32\tools\xtensa-esp32-elf-gcc\gcc8_4_0-esp-2021r2-patch3\xtensa-esp32-elf\include\c++\8.4.0\cstdlib:41,
                 from c:\users\BA\appdata\local\arduino15\packages\esp32\tools\xtensa-esp32-elf-gcc\gcc8_4_0-esp-2021r2-patch3\xtensa-esp32-elf\include\c++\8.4.0\stdlib.h:36,
                 from C:\Users\BA\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.4/tools/sdk/esp32/include/newlib/platform_include/assert.h:21,
                 from c:\users\BA\appdata\local\arduino15\packages\esp32\tools\xtensa-esp32-elf-gcc\gcc8_4_0-esp-2021r2-patch3\xtensa-esp32-elf\sys-include\sys\reent.h:503,
                 from C:\Users\BA\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.4/tools/sdk/esp32/include/newlib/platform_include/sys/reent.h:17,
                 from c:\users\BA\appdata\local\arduino15\packages\esp32\tools\xtensa-esp32-elf-gcc\gcc8_4_0-esp-2021r2-patch3\xtensa-esp32-elf\sys-include\stdio.h:60,
                 from C:\Users\BA\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.4\cores\esp32/Arduino.h:27,
                 from C:\Users\BA\AppData\Local\Temp\arduino\sketches\7882D13B9E886158F62A34E35AEEE3F5\sketch\esp32_camera.ino.cpp:1:
c:\users\BA\appdata\local\arduino15\packages\esp32\tools\xtensa-esp32-elf-gcc\gcc8_4_0-esp-2021r2-patch3\xtensa-esp32-elf\include\c++\8.4.0\xtensa-esp32-elf\esp32-psram\no-rtti\bits\c++config.h:511:10: fatal error: bits/cpu_defines.h: No such file or directory
 #include <bits/cpu_defines.h>
          ^~~~~~~~~~~~~~~~~~~~
compilation terminated.
exit status 1

Compilation error: exit status 1

I used files from edge impulse that I had not modified when I received this error. I searched my computer files and bits/cpu_defines.h does indeed not exist on my computer. Does anyone have any solutions?