2021-08-22 13:25:24 +02:00
|
|
|
# Modules common to all chips
|
|
|
|
set(module_srcs
|
|
|
|
"adc.c"
|
|
|
|
"bit.c"
|
|
|
|
"bthci.c"
|
|
|
|
"common.c"
|
|
|
|
"crypto.c"
|
|
|
|
"dht.c"
|
|
|
|
"encoder.c"
|
2022-03-05 03:51:54 +01:00
|
|
|
"eromfs.c"
|
2021-08-22 13:25:24 +02:00
|
|
|
"file.c"
|
|
|
|
"gpio.c"
|
2021-09-16 05:54:55 +02:00
|
|
|
"heaptrace.c"
|
2021-08-22 13:25:24 +02:00
|
|
|
"http.c"
|
2022-03-05 03:51:54 +01:00
|
|
|
"httpd.c"
|
2021-08-22 13:25:24 +02:00
|
|
|
"i2c.c"
|
|
|
|
"i2c_hw_master.c"
|
|
|
|
"i2c_hw_slave.c"
|
|
|
|
"ledc.c"
|
|
|
|
"mqtt.c"
|
|
|
|
"net.c"
|
|
|
|
"node.c"
|
|
|
|
"otaupgrade.c"
|
|
|
|
"ow.c"
|
|
|
|
"pipe.c"
|
2022-09-30 03:37:34 +02:00
|
|
|
"rtcmem.c"
|
2021-08-22 13:25:24 +02:00
|
|
|
"qrcodegen.c"
|
|
|
|
"sigma_delta.c"
|
|
|
|
"sjson.c"
|
|
|
|
"sodium.c"
|
|
|
|
"spi.c"
|
|
|
|
"spi_master.c"
|
|
|
|
"struct.c"
|
|
|
|
"time.c"
|
|
|
|
"tmr.c"
|
|
|
|
"u8g2.c"
|
|
|
|
"uart.c"
|
|
|
|
"ucg.c"
|
|
|
|
"wifi.c"
|
|
|
|
"wifi_ap.c"
|
|
|
|
"wifi_common.c"
|
|
|
|
"wifi_sta.c"
|
|
|
|
"ws2812.c"
|
2021-07-15 08:25:25 +02:00
|
|
|
)
|
|
|
|
|
2021-08-22 13:25:24 +02:00
|
|
|
# Chip specific modules, per module.
|
|
|
|
# List source files for each applicable chip.
|
|
|
|
if(IDF_TARGET STREQUAL "esp32")
|
|
|
|
list(APPEND module_srcs
|
|
|
|
"can.c"
|
|
|
|
"dac.c"
|
|
|
|
"eth.c"
|
|
|
|
"i2s.c"
|
|
|
|
"pulsecnt.c"
|
2022-03-05 23:27:11 +01:00
|
|
|
"rmt.c"
|
2021-08-22 13:25:24 +02:00
|
|
|
"sdmmc.c"
|
|
|
|
"touch.c"
|
|
|
|
)
|
|
|
|
elseif(IDF_TARGET STREQUAL "esp32s2")
|
|
|
|
list(APPEND module_srcs
|
|
|
|
"dac.c"
|
2022-10-03 00:29:57 +02:00
|
|
|
"pulsecnt.c"
|
2023-01-31 07:07:54 +01:00
|
|
|
"rmt.c"
|
2021-08-22 13:25:24 +02:00
|
|
|
)
|
|
|
|
elseif(IDF_TARGET STREQUAL "esp32s3")
|
|
|
|
list(APPEND module_srcs
|
2022-10-03 00:29:57 +02:00
|
|
|
"pulsecnt.c"
|
2023-01-31 07:07:54 +01:00
|
|
|
"rmt.c"
|
|
|
|
"sdmmc.c"
|
2021-08-22 13:25:24 +02:00
|
|
|
)
|
|
|
|
elseif(IDF_TARGET STREQUAL "esp32c3")
|
|
|
|
list(APPEND module_srcs
|
2022-10-03 00:29:57 +02:00
|
|
|
"rmt.c"
|
2021-08-22 13:25:24 +02:00
|
|
|
)
|
|
|
|
endif()
|
|
|
|
|
2021-07-15 08:25:25 +02:00
|
|
|
idf_component_register(
|
|
|
|
SRCS ${module_srcs}
|
2021-08-11 09:11:11 +02:00
|
|
|
INCLUDE_DIRS "." "${CMAKE_CURRENT_BINARY_DIR}"
|
2021-07-15 08:25:25 +02:00
|
|
|
PRIV_REQUIRES
|
|
|
|
"app_update"
|
|
|
|
"base_nodemcu"
|
|
|
|
"bt"
|
|
|
|
"driver_can"
|
2023-01-31 07:07:54 +01:00
|
|
|
"esp_eth"
|
2021-07-15 08:25:25 +02:00
|
|
|
"esp_http_client"
|
2022-03-05 03:51:54 +01:00
|
|
|
"esp_http_server"
|
2023-01-31 07:07:54 +01:00
|
|
|
"esp_hw_support"
|
|
|
|
"fatfs"
|
2021-07-15 08:25:25 +02:00
|
|
|
"libsodium"
|
|
|
|
"lua"
|
|
|
|
"mbedtls"
|
|
|
|
"mqtt"
|
|
|
|
"platform"
|
|
|
|
"qrcodegen"
|
|
|
|
"sdmmc"
|
2023-01-31 07:07:54 +01:00
|
|
|
"spi_flash"
|
2021-07-15 08:25:25 +02:00
|
|
|
"sjson"
|
|
|
|
"soc"
|
|
|
|
"u8g2"
|
|
|
|
"ucg"
|
2023-01-31 07:07:54 +01:00
|
|
|
"vfs"
|
2021-07-15 08:25:25 +02:00
|
|
|
)
|
|
|
|
|
|
|
|
# Match up all the module source files with their corresponding Kconfig
|
|
|
|
# option in the form NODEMCU_CMODULE_<modname> and if enabled, add a
|
|
|
|
# "-u <modname>_module_selected1" option to force the linker to include
|
|
|
|
# the module. See components/core/include/module.h for further details on
|
|
|
|
# how this works.
|
|
|
|
set(modules_enabled)
|
|
|
|
foreach(module_src ${module_srcs})
|
|
|
|
string(REPLACE ".c" "" module_name ${module_src})
|
|
|
|
string(TOUPPER ${module_name} module_ucase)
|
|
|
|
set(mod_opt "CONFIG_NODEMCU_CMODULE_${module_ucase}")
|
|
|
|
if (${${mod_opt}})
|
|
|
|
list(APPEND modules_enabled ${module_ucase})
|
|
|
|
endif()
|
|
|
|
endforeach()
|
|
|
|
message("Including the following modules: ${modules_enabled}")
|
|
|
|
|
|
|
|
foreach(mod ${modules_enabled})
|
|
|
|
target_link_libraries(${COMPONENT_LIB} "-u ${mod}_module_selected1")
|
|
|
|
endforeach()
|
|
|
|
|
|
|
|
|
|
|
|
# Auto-generation of ucg/u8g2 header files, per
|
|
|
|
# https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-guides/build-system.html#source-code-generation
|
|
|
|
|
|
|
|
add_custom_command(
|
|
|
|
OUTPUT ucg_config.h
|
|
|
|
COMMAND perl -w ${PROJECT_DIR}/tools/ucg_config.pl < ${SDKCONFIG_HEADER} > ucg_config.h
|
|
|
|
DEPENDS ${SDKCONFIG_HEADER}
|
|
|
|
VERBATIM
|
|
|
|
)
|
|
|
|
add_custom_target(ucg_config DEPENDS ucg_config.h)
|
|
|
|
|
|
|
|
add_custom_command(
|
|
|
|
OUTPUT u8g2_fonts.h
|
|
|
|
COMMAND perl -w ${PROJECT_DIR}/tools/u8g2_config_fonts.pl < ${SDKCONFIG_HEADER} > u8g2_fonts.h
|
|
|
|
DEPENDS ${SDKCONFIG_HEADER}
|
|
|
|
VERBATIM
|
|
|
|
)
|
|
|
|
add_custom_target(u8g2_fonts DEPENDS u8g2_fonts.h)
|
|
|
|
add_custom_command(
|
|
|
|
OUTPUT u8g2_displays.h
|
|
|
|
COMMAND perl -w ${PROJECT_DIR}/tools/u8g2_config_displays.pl < ${SDKCONFIG_HEADER} > u8g2_displays.h
|
|
|
|
)
|
|
|
|
add_custom_target(u8g2_displays DEPENDS u8g2_displays.h)
|
|
|
|
|
|
|
|
add_dependencies(${COMPONENT_LIB} ucg_config u8g2_fonts u8g2_displays)
|
|
|
|
|
|
|
|
set_property(
|
|
|
|
DIRECTORY "${COMPONENT_DIR}" APPEND
|
|
|
|
PROPERTY ADDITIONAL_MAKE_CLEAN_FILES ucg_config.h u8g2_fonts.h u8g2_displays.h
|
|
|
|
)
|
2022-03-05 03:51:54 +01:00
|
|
|
|
|
|
|
# eromfs generation
|
|
|
|
add_custom_command(
|
|
|
|
OUTPUT eromfs.bin
|
|
|
|
COMMAND ${COMPONENT_DIR}/eromfs.py ${CONFIG_NODEMCU_CMODULE_EROMFS_VOLUMES}
|
|
|
|
DEPENDS ${SDKCONFIG_HEADER}
|
|
|
|
)
|
|
|
|
add_custom_target(eromfs_bin DEPENDS eromfs.bin)
|
|
|
|
target_add_binary_data(${COMPONENT_LIB} "${CMAKE_CURRENT_BINARY_DIR}/eromfs.bin" BINARY DEPENDS eromfs_bin)
|
|
|
|
set_property(
|
|
|
|
DIRECTORY "${COMPONENT_DIR}" APPEND
|
|
|
|
PROPERTY ADDITIONAL_MAKE_CLEAN_FILES eromfs.bin
|
|
|
|
)
|
|
|
|
|