Подключены ESP32|Linux, обновлен интерфейс

This commit is contained in:
2026-09-11 20:53:38 +03:00
parent 9fce687690
commit e7a01aaeda
23 changed files with 477 additions and 647 deletions
+29
View File
@@ -0,0 +1,29 @@
# Prepare the same complete component layout that worked locally, inside build.
# Run before project() so ESP-IDF can discover the generated component normally.
if(EXISTS "${CMAKE_CURRENT_LIST_DIR}/../components/lwip/CMakeLists.txt")
message(FATAL_ERROR "Remove components/lwip: it would override the generated build component.")
endif()
if(NOT PYTHON)
find_package(Python3 REQUIRED COMPONENTS Interpreter)
set(PYTHON "${Python3_EXECUTABLE}")
endif()
set(monitoring_lwip_generator "${CMAKE_CURRENT_LIST_DIR}/../patches/lwip/prepare.py")
set(monitoring_arp_source "${CMAKE_CURRENT_LIST_DIR}/../patches/lwip/etharp.c")
set(monitoring_lwip_dir "${CMAKE_BINARY_DIR}/monitoring_components/lwip")
execute_process(
COMMAND "${PYTHON}" "${monitoring_lwip_generator}"
"${IDF_PATH}/components/lwip" "${monitoring_lwip_dir}" "${monitoring_arp_source}"
RESULT_VARIABLE monitoring_lwip_result
OUTPUT_VARIABLE monitoring_lwip_output
ERROR_VARIABLE monitoring_lwip_error
)
if(NOT monitoring_lwip_result EQUAL 0)
message(FATAL_ERROR "lwIP preparation failed: ${monitoring_lwip_error}")
endif()
set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS
"${monitoring_lwip_generator}"
"${IDF_PATH}/components/lwip/CMakeLists.txt"
"${IDF_PATH}/components/lwip/lwip/src/include/lwip/sockets.h"
"${IDF_PATH}/components/lwip/port/linux/include/sys/fcntl.h")
list(APPEND EXTRA_COMPONENT_DIRS "${monitoring_lwip_dir}")
message(STATUS "lwIP: prepared in ${monitoring_lwip_dir}; ARP source is patches/lwip/etharp.c")
+56
View File
@@ -0,0 +1,56 @@
# Applied after project(): component targets already exist at this point.
include_guard(GLOBAL)
function(monitoring_patch_tapif)
idf_build_get_property(tap_target IDF_TARGET)
if(NOT "${tap_target}" STREQUAL "linux")
return()
endif()
idf_component_get_property(tap_lib protocol_examples_tapif_io COMPONENT_LIB)
idf_component_get_property(tap_dir protocol_examples_tapif_io COMPONENT_DIR)
idf_build_get_property(tap_idf_path IDF_PATH)
get_filename_component(tap_dir "${tap_dir}" REALPATH)
get_filename_component(tap_sdk_dir
"${tap_idf_path}/examples/common_components/protocol_examples_tapif_io" REALPATH)
if(NOT "${tap_dir}" STREQUAL "${tap_sdk_dir}")
message(FATAL_ERROR
"TAP must come from ESP-IDF. Move components/protocol_examples_tapif_io outside the project, then reconfigure.")
endif()
set(tap_patch_dir "${CMAKE_CURRENT_FUNCTION_LIST_DIR}/../patches/protocol_examples_tapif_io")
set(tap_generated_dir "${CMAKE_BINARY_DIR}/monitoring_tapif")
file(MAKE_DIRECTORY "${tap_generated_dir}/lwip")
# Quoted includes search the source's own directory before -I directories.
# Relocate this unmodified SDK source so it finds our matching declaration.
configure_file("${tap_dir}/linux_connect.c"
"${tap_generated_dir}/linux_connect.c" COPYONLY)
configure_file("${tap_patch_dir}/tapif.h"
"${tap_generated_dir}/lwip/tapif.h" COPYONLY)
get_target_property(tap_sources "${tap_lib}" SOURCES)
set(tap_new_sources "")
set(tap_input_found FALSE)
set(tap_connect_found FALSE)
foreach(tap_source IN LISTS tap_sources)
get_filename_component(tap_absolute "${tap_source}" ABSOLUTE BASE_DIR "${tap_dir}")
if("${tap_absolute}" STREQUAL "${tap_dir}/lwip/tapif.c")
list(APPEND tap_new_sources "${tap_patch_dir}/tapif.c")
set(tap_input_found TRUE)
elseif("${tap_absolute}" STREQUAL "${tap_dir}/linux_connect.c")
list(APPEND tap_new_sources "${tap_generated_dir}/linux_connect.c")
set(tap_connect_found TRUE)
else()
list(APPEND tap_new_sources "${tap_source}")
endif()
endforeach()
if(NOT tap_input_found OR NOT tap_connect_found)
message(FATAL_ERROR
"Unexpected TAP source list. This compatibility patch was prepared for ESP-IDF v6.0.2.")
endif()
set_property(TARGET "${tap_lib}" PROPERTY SOURCES "${tap_new_sources}")
message(STATUS "TAP: using ESP-IDF component with project-local tapif.c/tapif.h fix")
endfunction()
monitoring_patch_tapif()