Question/Issue:
[Describe the question or issue in detail]
I have trained a module and I want to deploy on my esp32s3 device , I used esp idf . but I got error shows files such as " include " not found. I wander whatis the matter and how to write my CMakelist.txt .
Here is my build log :
– Configuring done
– Generating done
– Build files have been written to: /home/ysc/esp32/prj/sine_model/build
[1/1] cd /home/ysc/esp32/prj/sine_model/build/bootloader/esp-idf…0 /home/ysc/esp32/prj/sine_model/build/bootloader/bootloader.bin
Bootloader binary size 0x5240 bytes. 0x2dc0 bytes (36%) free.
[4/234] Building C object esp-idf/main/CMakeFiles/idf_main.dir//edge-impulse-sdk/porting/himax-we2/ethosu_driver.c.obj
cc1: warning: command-line option ‘-std=gnu++11’ is valid for C++/ObjC++ but not for C
[5/234] Building C object esp-idf/main/CMakeFiles/__idf_main.dir…ge-impulse-sdk/porting/ethos-core-driver/src/ethosu_driver.c.obj
cc1: warning: command-line option ‘-std=gnu++11’ is valid for C++/ObjC++ but not for C
[6/234] Building C object esp-idf/main/CMakeFiles/__idf_main.dir…se-sdk/porting/ethos-core-driver/src/ethosu_device_u55_u65.c.obj
cc1: warning: command-line option ‘-std=gnu++11’ is valid for C++/ObjC++ but not for C
[7/234] Building C object esp-idf/main/CMakeFiles/__idf_main.dir/sine_model.c.obj
FAILED: esp-idf/main/CMakeFiles/__idf_main.dir/sine_model.c.obj
/home/ysc/.espressif/tools/xtensa-esp-elf/esp-13.2.0_20230928/xtensa-esp-elf/bin/xtensa-esp32s3-elf-gcc -DEI_CLASSIFIER_TFLITE_ENABLE_ESP_NN=1 -DESP_PLATFORM -DIDF_VER="v5.2" -DSOC_MMU_PAGE_SIZE=CONFIG_MMU_PAGE_SIZE -DSOC_XTAL_FREQ_MHZ=CONFIG_XTAL_FREQ -D_GLIBCXX_HAVE_POSIX_SEMAPHORE -D_GLIBCXX_USE_POSIX_SEMAPHORE -D_GNU_SOURCE -D_POSIX_READER_WRITER_LOCKS -Iconfig -I…/ -I…/tflite-model -I…/model-parameters -I…/edge-impulse-sdk -I…/edge-impulse-sdk/classifier -I…/edge-impulse-sdk/dsp -I…/edge-impulse-sdk/porting -I…/edge-impulse-sdk/porting/espressif/ESP-NN -I…/edge-impulse-sdk/porting/espressif/ESP-NN/include -I…/edge-impulse-sdk/tensorflow -I…/edge-impulse-sdk/third_party -I…/edge-impulse-sdk/third_party/ruy -I…/edge-impulse-sdk/third_party/gemmlowp -I…/edge-impulse-sdk/third_party/flatbuffers/include -I/home/ysc/esp32/esp-idf/components/newlib/platform_include -I/home/ysc/esp32/esp-idf/components/freertos/config/include -I/home/ysc/esp32/esp-idf/components/freertos/config/include/freertos -I/home/ysc/esp32/esp-idf/components/freertos/config/xtensa/include -I/home/ysc/esp32/esp-idf/components/freertos/FreeRTOS-Kernel/include -I/home/ysc/esp32/esp-idf/components/freertos/FreeRTOS-Kernel/portable/xtensa/include -I/home/ysc/esp32/esp-idf/components/freertos/FreeRTOS-Kernel/portable/xtensa/include/freertos -I/home/ysc/esp32/esp-idf/components/freertos/esp_additions/include -I/home/ysc/esp32/esp-idf/components/esp_hw_support/include -I/home/ysc/esp32/esp-idf/components/esp_hw_support/include/soc -I/home/ysc/esp32/esp-idf/components/esp_hw_support/include/soc/esp32s3 -I/home/ysc/esp32/esp-idf/components/esp_hw_support/port/esp32s3/. -I/home/ysc/esp32/esp-idf/components/heap/include -I/home/ysc/esp32/esp-idf/components/log/include -I/home/ysc/esp32/esp-idf/components/soc/include -I/home/ysc/esp32/esp-idf/components/soc/esp32s3 -I/home/ysc/esp32/esp-idf/components/soc/esp32s3/include -I/home/ysc/esp32/esp-idf/components/hal/platform_port/include -I/home/ysc/esp32/esp-idf/components/hal/esp32s3/include -I/home/ysc/esp32/esp-idf/components/hal/include -I/home/ysc/esp32/esp-idf/components/esp_rom/include -I/home/ysc/esp32/esp-idf/components/esp_rom/include/esp32s3 -I/home/ysc/esp32/esp-idf/components/esp_rom/esp32s3 -I/home/ysc/esp32/esp-idf/components/esp_common/include -I/home/ysc/esp32/esp-idf/components/esp_system/include -I/home/ysc/esp32/esp-idf/components/esp_system/port/soc -I/home/ysc/esp32/esp-idf/components/esp_system/port/include/private -I/home/ysc/esp32/esp-idf/components/xtensa/esp32s3/include -I/home/ysc/esp32/esp-idf/components/xtensa/include -I/home/ysc/esp32/esp-idf/components/xtensa/deprecated_include -I/home/ysc/esp32/esp-idf/components/lwip/include -I/home/ysc/esp32/esp-idf/components/lwip/include/apps -I/home/ysc/esp32/esp-idf/components/lwip/include/apps/sntp -I/home/ysc/esp32/esp-idf/components/lwip/lwip/src/include -I/home/ysc/esp32/esp-idf/components/lwip/port/include -I/home/ysc/esp32/esp-idf/components/lwip/port/freertos/include -I/home/ysc/esp32/esp-idf/components/lwip/port/esp32xx/include -I/home/ysc/esp32/esp-idf/components/lwip/port/esp32xx/include/arch -I/home/ysc/esp32/esp-idf/components/lwip/port/esp32xx/include/sys -I…/managed_components/espressif__esp-tflite-micro -I…/managed_components/espressif__esp-tflite-micro/third_party/gemmlowp -I…/managed_components/espressif__esp-tflite-micro/third_party/flatbuffers/include -I…/managed_components/espressif__esp-tflite-micro/third_party/ruy -I…/managed_components/espressif__esp-tflite-micro/third_party/kissfft -mlongcalls -ffunction-sections -fdata-sections -Wall -Werror=all -Wno-error=unused-function -Wno-error=unused-variable -Wno-error=unused-but-set-variable -Wno-error=deprecated-declarations -Wextra -Wno-unused-parameter -Wno-sign-compare -Wno-enum-conversion -gdwarf-4 -ggdb -Og -fno-shrink-wrap -fmacro-prefix-map=/home/ysc/esp32/prj/sine_model=. -fmacro-prefix-map=/home/ysc/esp32/esp-idf=/IDF -fstrict-volatile-bitfields -fno-jump-tables -fno-tree-switch-conversion -std=gnu17 -Wno-old-style-declaration -std=gnu++11 -DTF_LITE_STATIC_MEMORY -MD -MT esp-idf/main/CMakeFiles/__idf_main.dir/sine_model.c.obj -MF esp-idf/main/CMakeFiles/__idf_main.dir/sine_model.c.obj.d -o esp-idf/main/CMakeFiles/__idf_main.dir/sine_model.c.obj -c …/main/sine_model.c
cc1: warning: command-line option ‘-std=gnu++11’ is valid for C++/ObjC++ but not for C
In file included from …/edge-impulse-sdk/dsp/ei_dsp_handle.h:35,
from …/edge-impulse-sdk/classifier/ei_model_types.h:24,
from …/edge-impulse-sdk/classifier/ei_run_classifier.h:21,
from …/main/sine_model.c:37:
…/edge-impulse-sdk/dsp/numpy_types.h:617:5: error: expected specifier-qualifier-list before ‘std’
617 | std::function<int(size_t offset, size_t length, float *out_ptr)> get_data;
| ^~~
…/edge-impulse-sdk/dsp/ei_dsp_handle.h:38:1: error: unknown type name ‘class’
38 | class DspHandle {
| ^~~~~
…/edge-impulse-sdk/dsp/ei_dsp_handle.h:38:17: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘attribute’ before ‘{’ token
38 | class DspHandle {
| ^
In file included from …/edge-impulse-sdk/classifier/ei_model_types.h:25:
…/edge-impulse-sdk/dsp/numpy.hpp:37:10: fatal error: cfloat: No such file or directory
37 | #include
| ^~~~~~~~
compilation terminated.
[14/234] Linking C static library esp-idf/espressif__esp-tflite-micro/libespressif__esp-tflite-micro.a
ninja: build stopped: subcommand failed.
ninja failed with exit code 1, output of the command is in the /home/ysc/esp32/prj/sine_model/build/log/idf_py_stderr_output_11411 and /home/ysc/esp32/prj/sine_model/build/log/idf_py_stdout_output_11411
And here is my Cmakelist.txt in main folder .
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED on)
set(MODEL_FOLDER …)
set(EI_SDK_FOLDER …/edge-impulse-sdk)
if(NOT CMAKE_BUILD_EARLY_EXPANSION)
add_definitions(-DEI_CLASSIFIER_TFLITE_ENABLE_ESP_NN=1) # enables ESP-NN optimizations by Espressif
endif()
set(include_dirs
${MODEL_FOLDER}
${MODEL_FOLDER}/tflite-model
${MODEL_FOLDER}/model-parameters
${EI_SDK_FOLDER}
${EI_SDK_FOLDER}/classifier
${EI_SDK_FOLDER}/dsp
${EI_SDK_FOLDER}/porting
${EI_SDK_FOLDER}/porting/espressif/ESP-NN
${EI_SDK_FOLDER}/porting/espressif/ESP-NN/include
${EI_SDK_FOLDER}/tensorflow
${EI_SDK_FOLDER}/third_party
${EI_SDK_FOLDER}/third_party/ruy
${EI_SDK_FOLDER}/third_party/gemmlowp
${EI_SDK_FOLDER}/third_party/flatbuffers/include
)
include(${EI_SDK_FOLDER}/cmake/utils.cmake)
RECURSIVE_FIND_FILE_EXCLUDE_DIR(SOURCE_FILES “…/edge-impulse-sdk” “CMSIS” “.cpp")
RECURSIVE_FIND_FILE_EXCLUDE_DIR(CC_FILES “…/edge-impulse-sdk” “CMSIS” ".cc”)
RECURSIVE_FIND_FILE_EXCLUDE_DIR(S_FILES “…/edge-impulse-sdk” “CMSIS” “.s")
RECURSIVE_FIND_FILE_EXCLUDE_DIR(C_FILES “…/edge-impulse-sdk” “CMSIS” ".c”)
Manually handle needed C only files b/c of build errors
list(APPEND C_FILES “…/edge-impulse-sdk/CMSIS/DSP/Source/StatisticsFunctions/arm_rms_f32.c”)
RECURSIVE_FIND_FILE(PORTING_FILES “…/edge-impulse-sdk/porting/espressif” “*.cpp”)
RECURSIVE_FIND_FILE(MODEL_FILES “…/tflite-model” “*.cpp”)
list(APPEND SOURCE_FILES ${S_FILES})
list(APPEND SOURCE_FILES ${C_FILES})
list(APPEND SOURCE_FILES ${CC_FILES})
list(APPEND SOURCE_FILES ${PORTING_FILES})
list(APPEND SOURCE_FILES ${MODEL_FILES})
idf_component_register(SRCS “sine_model.c” “${SOURCE_FILES}”
INCLUDE_DIRS “${include_dirs}”
REQUIRES cxx)
#target_compile_options(${COMPONENT_LIB} PRIVATE -std=gnu++17)
target_compile_options(${COMPONENT_LIB} PRIVATE -std=gnu++11)
Here is my file folder tree:
VirtualBox:~/esp32/prj/sine_model$ tree -L 2
├── build
├── CMakeLists.txt
├── dependencies.lock
├── edge-impulse-sdk
│ ├── classifier
│ ├── cmake
│ ├── CMSIS
│ ├── dsp
│ ├── LICENSE
│ ├── LICENSE-apache-2.0.txt
│ ├── porting
│ ├── README.md
│ ├── sources.txt
│ ├── tensorflow
│ └── third_party
├── main
│ ├── CMakeLists.txt
│ ├── idf_component.yml
│ └── sine_model.c
├── model-parameters
│ ├── model_metadata.h
│ └── model_variables.h
├── sdkconfig
├── sdkconfig.old
├── sine-v1.zip
├── sin_gen.py
└── tflite-model
├── tflite_learn_7_compiled.cpp
├── tflite_learn_7_compiled.h
└── trained_model_ops_define.h
12 directories, 18 files
Project ID:
[Provide the project ID]
Context/Use case:
[Provide context or use case where the issue is encountered]
Steps Taken:
- [Step 1]
- [Step 2]
- [Step 3]
Expected Outcome:
[Describe what you expected to happen]
Actual Outcome:
[Describe what actually happened]
Reproducibility:
- [ ] Always
- [ ] Sometimes
- [ ] Rarely
Environment:
- Platform: [esp32s3]
- Build Environment Details: [ esp idf V5.2 ]
- OS Version: [ Ubuntu 18.04,]
-
Edge Impulse Version (Firmware): [e.g., 1.2.3]Logs/Attachments:
[Include any logs or screenshots that may help in diagnosing the issue]
Additional Information:
[Any other information that might be relevant]