I've been using ESP32-WROOM-32D module with 4MB flash and esp-idf v3.2 for the last year. I would like to update my project to cmake based build system but I can not find how to add my project's custom components in the project using CMakeLists.txt files. Before trying to update my old project I've compiled, flashed and debugged successfully blink example from esp-idf examples with VScode.
My old project tree was like that:
Project (folder)
-->build (folder)
-->partition.csv
-->Makefile
-->sdkconfig
-->version.txt
-->main (folder)
-------->component.mk
-------->main.c
-------->include (folder)
------------->main_include.h
-->components (folder)
-------->component01 (folder)
------------->component.mk
------------->component01_source.c
------------->include (folder)
------------------>component01_include.h
-------->component02 (folder)
------------->component.mk
------------->component02_source.c
------------->include (folder)
------------------>component02_include.h
I've tried this one with Cmake build system (installed master branch with the help of ESP-Tools installer 2.0)
Project (folder)
-->build (folder)
-->partition.csv
-->CMakeLists.txt
-->sdkconfig
-->version.txt
-->main (folder)
-------->CMakeLists.txt
-------->main.c
-------->include (folder)
------------->main_include.h
-->components (folder)
-------->component01 (folder)
------------->CMakeLists.txt
------------->component01_source.c
------------->include (folder)
------------------>component01_include.h
-------->component02 (folder)
------------->CMakeLists.txt
------------->component02_source.c
------------->include (folder)
------------------>component02_include.h
But when compiling with VScode I get error for all of my components, like this one:
Code: Select all
[21/65] Building C object esp-idf/01_TIMER/CMakeFiles/__idf_01_TIMER.dir/timers_v1i1.c.obj
FAILED: esp-idf/01_TIMER/CMakeFiles/__idf_01_TIMER.dir/timers_v1i1.c.obj
C:\esp\esp-idf\.espressif\tools\xtensa-esp32-elf\esp32-2019r1-8.2.0\xtensa-esp32-elf\bin\xtensa-esp32-elf-gcc.exe -Iconfig -I../components/01_TIMER/. -I../components/01_TIMER/include -I../../../../components/newlib/platform_include -I../../../../components/freertos/include -I../../../../components/heap/include -I../../../../components/log/include -I../../../../components/soc/esp32/include -I../../../../components/soc/include -I../../../../components/esp_rom/include -I../../../../components/esp_common/include -I../../../../components/xtensa/include -I../../../../components/xtensa/esp32/include -I../../../../components/esp32/include -I../../../../components/driver/include -I../../../../components/esp_ringbuf/include -I../../../../components/esp_event/include -I../../../../components/tcpip_adapter/include -I../../../../components/lwip/include/apps -I../../../../components/lwip/include/apps/sntp -I../../../../components/lwip/lwip/src/include -I../../../../components/lwip/port/esp32/include -I../../../../components/lwip/port/esp32/include/arch -I../../../../components/vfs/include -I../../../../components/esp_wifi/include -I../../../../components/esp_wifi/esp32/include -I../../../../components/esp_eth/include
-I../../../../components/efuse/include -I../../../../components/efuse/esp32/include -I../../../../components/app_trace/include -mlongcalls -Wno-frame-address -ffunction-sections -fdata-sections -fstrict-volatile-bitfields -nostdlib -Wall -Werror=all -Wno-error=unused-function -Wno-error=unused-but-set-variable -Wno-error=unused-variable -Wno-error=deprecated-declarations -Wextra -Wno-unused-parameter -Wno-sign-compare -ggdb -Og -std=gnu99 -Wno-old-style-declaration -D_GNU_SOURCE -DIDF_VER=\"v4.0-dev-1381-g6fe853a2c\" -DGCC_NOT_5_2_0 -DESP_PLATFORM -MD -MT esp-idf/01_TIMER/CMakeFiles/__idf_01_TIMER.dir/timers_v1i1.c.obj -MF esp-idf\01_TIMER\CMakeFiles\__idf_01_TIMER.dir\timers_v1i1.c.obj.d -o esp-idf/01_TIMER/CMakeFiles/__idf_01_TIMER.dir/timers_v1i1.c.obj -c ../components/01_TIMER/timers_v1i1.c
../components/01_TIMER/timers_v1i1.c:38:10: fatal error: globals.h: No such file or directory
#include "globals.h"
^~~~~~~~~~~
compilation terminated.
I've already read the Cmake build system from esp32readthedocs website but I can't understand yet the concept. My purpose is to make my code modular and not a single large file containing everything.
Best regards, K.Ifantidis.