Skip to content

Commit 2320d4d

Browse files
committed
Switching to new ESP32 IDF v5.X.X
1 parent 57191b7 commit 2320d4d

File tree

2 files changed

+25
-1
lines changed

2 files changed

+25
-1
lines changed

.travis/setup_esp_build_env.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ else
88
#
99
mkdir -p ~/esp
1010
# Switching to 4.3 version, since v5.0-dev doesn't support Makefiles anymore
11-
git clone -b v4.4.7 --recursive https://github.com/espressif/esp-idf.git ~/esp/esp-idf
11+
git clone -b v5.4.1 --recursive https://github.com/espressif/esp-idf.git ~/esp/esp-idf
1212
# git clone --recursive https://github.com/espressif/esp-idf.git ~/esp/esp-idf
1313
fi
1414

examples/Makefile.esp32

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,15 +39,19 @@ endif
3939

4040
BLD ?= ../bld
4141
PROJECT ?= demos/ssd1306_demo
42+
BUILD_FOR_OLD_ESPIDF ?= n
4243

4344
$(BLD)/esp32/components/lcdgfx/component.mk:
4445
mkdir -p $(BLD)/esp32/components/lcdgfx
4546
cp -a ../src $(BLD)/esp32/components/lcdgfx/
47+
cp -a ../CMakeLists.txt $(BLD)/esp32/components/lcdgfx/
4648
cp -a ../component.mk $(BLD)/esp32/components/lcdgfx/
4749

4850
$(BLD)/esp32/components/sketch/main.cpp:
4951
mkdir -p $(BLD)/esp32/components/sketch
5052
rm -rf $(BLD)/esp32/components/sketch/*
53+
echo "file(GLOB SOURCES *.cpp)" > $(BLD)/esp32/components/sketch/CMakeLists.txt
54+
echo "idf_component_register(SRCS \$${SOURCES} INCLUDE_DIRS "." REQUIRES lcdgfx)" >> $(BLD)/esp32/components/sketch/CMakeLists.txt
5155
cp -a $(PROJECT)/* $(BLD)/esp32/components/sketch/
5256
mv $(BLD)/esp32/components/sketch/$(notdir $(PROJECT)).ino $(BLD)/esp32/components/sketch/main.cpp
5357
echo "COMPONENT_ADD_INCLUDEDIRS := ." > $(BLD)/esp32/components/sketch/component.mk
@@ -60,8 +64,28 @@ $(BLD)/esp32/main/component.mk:
6064
echo "PROJECT_NAME:=$(notdir $(PROJECT))" > $(BLD)/esp32/Makefile
6165
echo "include \$$(IDF_PATH)/make/project.mk" >> $(BLD)/esp32/Makefile
6266

67+
$(BLD)/esp32/main/CMakeLists.txt:
68+
mkdir -p $(BLD)/esp32/main
69+
echo "idf_component_register(SRCS \"esp32_main.cpp\"" > $(BLD)/esp32/main/CMakeLists.txt
70+
echo " INCLUDE_DIRS \".\"" >> $(BLD)/esp32/main/CMakeLists.txt
71+
echo " REQUIRES sketch)" >> $(BLD)/esp32/main/CMakeLists.txt
72+
73+
$(BLD)/esp32/CMakeLists.txt:
74+
mkdir -p $(BLD)/esp32
75+
echo "cmake_minimum_required(VERSION 3.16)" > $(BLD)/esp32/CMakeLists.txt
76+
echo "include(\$$ENV{IDF_PATH}/tools/cmake/project.cmake)" >> $(BLD)/esp32/CMakeLists.txt
77+
echo "project(ssd1306_demo)" >> $(BLD)/esp32/CMakeLists.txt
78+
echo "SET(EXTRA_COMPONENT_DIRS main components)" >> $(BLD)/esp32/CMakeLists.txt
79+
6380
all: $(BLD)/esp32/main/component.mk \
6481
$(BLD)/esp32/components/lcdgfx/component.mk \
6582
$(BLD)/esp32/components/sketch/main.cpp
83+
ifeq ($(BUILD_FOR_OLD_ESPIDF),y)
6684
$(MAKE) -C $(BLD)/esp32 defconfig
6785
$(MAKE) -C $(BLD)/esp32
86+
else
87+
cd $(BLD)/esp32 && idf.py build
88+
89+
all: $(BLD)/esp32/CMakeLists.txt \
90+
$(BLD)/esp32/main/CMakeLists.txt
91+
endif

0 commit comments

Comments
 (0)