summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ports/esp32/Makefile8
-rw-r--r--ports/esp32/main/CMakeLists.txt10
2 files changed, 17 insertions, 1 deletions
diff --git a/ports/esp32/Makefile b/ports/esp32/Makefile
index 9a3a15d6e..39b740ffa 100644
--- a/ports/esp32/Makefile
+++ b/ports/esp32/Makefile
@@ -18,7 +18,13 @@ GIT_SUBMODULES = lib/berkeley-db-1.xx
.PHONY: all clean deploy erase submodules FORCE
-IDFPY_FLAGS += -D MICROPY_BOARD=$(BOARD) -B $(BUILD)
+CMAKE_ARGS =
+
+ifdef USER_C_MODULES
+ CMAKE_ARGS += -DUSER_C_MODULES=${USER_C_MODULES}
+endif
+
+IDFPY_FLAGS += -D MICROPY_BOARD=$(BOARD) -B $(BUILD) $(CMAKE_ARGS)
all:
idf.py $(IDFPY_FLAGS) build
diff --git a/ports/esp32/main/CMakeLists.txt b/ports/esp32/main/CMakeLists.txt
index b6bccdde3..082410f4c 100644
--- a/ports/esp32/main/CMakeLists.txt
+++ b/ports/esp32/main/CMakeLists.txt
@@ -5,6 +5,10 @@ get_filename_component(MICROPY_DIR ${PROJECT_DIR}/../.. ABSOLUTE)
include(${MICROPY_DIR}/py/py.cmake)
include(${MICROPY_DIR}/extmod/extmod.cmake)
+if(NOT CMAKE_BUILD_EARLY_EXPANSION)
+ include(${MICROPY_DIR}/py/usermod.cmake)
+endif()
+
set(MICROPY_QSTRDEFS_PORT
${PROJECT_DIR}/qstrdefsport.h
)
@@ -71,6 +75,7 @@ set(MICROPY_SOURCE_PORT
set(MICROPY_SOURCE_QSTR
${MICROPY_SOURCE_PY}
${MICROPY_SOURCE_EXTMOD}
+ ${MICROPY_SOURCE_USERMOD}
${MICROPY_SOURCE_LIB}
${MICROPY_SOURCE_PORT}
)
@@ -129,6 +134,7 @@ idf_component_register(
${MICROPY_SOURCE_PORT}
INCLUDE_DIRS
${MICROPY_DIR}
+ ${MICROPY_INC_USERMOD}
${MICROPY_PORT_DIR}
${MICROPY_BOARD_DIR}
${CMAKE_BINARY_DIR}
@@ -159,6 +165,10 @@ target_compile_options(${MICROPY_TARGET} PUBLIC
-Wno-missing-field-initializers
)
+# add usermod
+target_link_libraries(${MICROPY_TARGET} usermod)
+
+
# Collect all of the include directories and compile definitions for the IDF components.
foreach(comp ${IDF_COMPONENTS})
get_target_property(type __idf_${comp} TYPE)