2021-04-02 06:49:49 +00:00
|
|
|
if(CONFIG_OPENTHREAD_ENABLED)
|
2023-01-30 10:03:41 +00:00
|
|
|
idf_build_get_property(idf_target IDF_TARGET)
|
|
|
|
|
2021-11-18 03:40:22 +00:00
|
|
|
set(public_include_dirs
|
|
|
|
"include"
|
|
|
|
"openthread/include")
|
|
|
|
|
|
|
|
set(private_include_dirs
|
|
|
|
"openthread/examples/platforms"
|
|
|
|
"openthread/include/openthread"
|
|
|
|
"openthread/src"
|
|
|
|
"openthread/src/core"
|
|
|
|
"openthread/src/lib/hdlc"
|
|
|
|
"openthread/src/lib/spinel"
|
|
|
|
"openthread/src/ncp"
|
|
|
|
"private_include")
|
|
|
|
|
|
|
|
set(src_dirs
|
2022-12-26 07:48:07 +00:00
|
|
|
"port"
|
2021-11-18 03:40:22 +00:00
|
|
|
"openthread/examples/platforms/utils"
|
|
|
|
"openthread/src/core/api"
|
|
|
|
"openthread/src/core/common"
|
|
|
|
"openthread/src/core/crypto"
|
|
|
|
"openthread/src/core/diags"
|
|
|
|
"openthread/src/core/mac"
|
|
|
|
"openthread/src/core/radio"
|
|
|
|
"openthread/src/core/thread"
|
|
|
|
"openthread/src/core/utils"
|
|
|
|
"openthread/src/lib/hdlc"
|
|
|
|
"openthread/src/lib/spinel")
|
|
|
|
|
|
|
|
set(exclude_srcs
|
|
|
|
"openthread/examples/platforms/utils/logging_rtt.c"
|
|
|
|
"openthread/examples/platforms/utils/soft_source_match_table.c"
|
|
|
|
"openthread/src/core/common/extension_example.cpp")
|
|
|
|
|
|
|
|
if(CONFIG_OPENTHREAD_FTD OR CONFIG_OPENTHREAD_MTD)
|
|
|
|
list(APPEND src_dirs
|
|
|
|
"openthread/src/core/backbone_router"
|
|
|
|
"openthread/src/core/coap"
|
|
|
|
"openthread/src/core/meshcop"
|
|
|
|
"openthread/src/core/net"
|
|
|
|
"openthread/src/lib/platform")
|
|
|
|
|
2022-09-27 06:30:46 +00:00
|
|
|
if(CONFIG_OPENTHREAD_CLI)
|
|
|
|
list(APPEND src_dirs
|
|
|
|
"openthread/examples/apps/cli"
|
|
|
|
"openthread/src/cli")
|
|
|
|
|
|
|
|
list(APPEND exclude_srcs
|
|
|
|
"openthread/examples/apps/cli/main.c")
|
|
|
|
endif()
|
2021-11-18 03:40:22 +00:00
|
|
|
|
|
|
|
elseif(CONFIG_OPENTHREAD_RADIO)
|
|
|
|
list(APPEND src_dirs
|
|
|
|
"openthread/src/ncp"
|
|
|
|
"openthread/examples/apps/ncp")
|
|
|
|
|
|
|
|
list(APPEND exclude_srcs
|
|
|
|
"openthread/examples/apps/ncp/main.c"
|
|
|
|
"openthread/src/core/api/backbone_router_api.cpp"
|
2023-03-01 07:10:21 +00:00
|
|
|
"openthread/src/core/api/child_supervision_api.cpp"
|
2021-12-07 09:32:44 +00:00
|
|
|
"openthread/src/core/api/dataset_api.cpp"
|
|
|
|
"openthread/src/core/api/dns_api.cpp"
|
2021-11-18 03:40:22 +00:00
|
|
|
"openthread/src/core/api/entropy_api.cpp"
|
2021-12-07 09:32:44 +00:00
|
|
|
"openthread/src/core/api/heap_api.cpp"
|
2021-11-18 03:40:22 +00:00
|
|
|
"openthread/src/core/api/icmp6_api.cpp"
|
|
|
|
"openthread/src/core/api/ip6_api.cpp"
|
2021-12-07 09:32:44 +00:00
|
|
|
"openthread/src/core/api/link_api.cpp"
|
2023-04-19 07:00:17 +00:00
|
|
|
"openthread/src/core/api/link_metrics_api.cpp"
|
2021-12-07 09:32:44 +00:00
|
|
|
"openthread/src/core/api/message_api.cpp"
|
2022-09-27 06:30:46 +00:00
|
|
|
"openthread/src/core/api/nat64_api.cpp"
|
2021-12-07 09:32:44 +00:00
|
|
|
"openthread/src/core/api/netdata_api.cpp"
|
2021-11-18 03:40:22 +00:00
|
|
|
"openthread/src/core/api/random_crypto_api.cpp"
|
2021-12-07 09:32:44 +00:00
|
|
|
"openthread/src/core/api/tcp_api.cpp"
|
|
|
|
"openthread/src/core/api/udp_api.cpp"
|
|
|
|
"openthread/src/core/common/heap.cpp"
|
2021-11-18 03:40:22 +00:00
|
|
|
"openthread/src/core/common/heap_string.cpp"
|
|
|
|
"openthread/src/core/common/notifier.cpp"
|
2021-12-07 09:32:44 +00:00
|
|
|
"openthread/src/core/common/settings.cpp"
|
|
|
|
"openthread/src/core/common/time_ticker.cpp"
|
|
|
|
"openthread/src/core/mac/channel_mask.cpp"
|
|
|
|
"openthread/src/core/mac/data_poll_handler.cpp"
|
|
|
|
"openthread/src/core/mac/data_poll_sender.cpp"
|
|
|
|
"openthread/src/core/mac/mac.cpp"
|
|
|
|
"openthread/src/core/mac/mac_filter.cpp"
|
|
|
|
"openthread/src/core/mac/mac_links.cpp"
|
|
|
|
"openthread/src/core/thread/announce_begin_server.cpp"
|
|
|
|
"openthread/src/core/thread/announce_sender.cpp"
|
2022-08-18 02:40:35 +00:00
|
|
|
"openthread/src/core/thread/address_resolver.cpp"
|
2023-03-01 07:10:21 +00:00
|
|
|
"openthread/src/core/thread/child_supervision.cpp"
|
2021-12-07 09:32:44 +00:00
|
|
|
"openthread/src/core/thread/discover_scanner.cpp"
|
2021-11-18 03:40:22 +00:00
|
|
|
"openthread/src/core/thread/energy_scan_server.cpp"
|
2021-12-07 09:32:44 +00:00
|
|
|
"openthread/src/core/thread/key_manager.cpp"
|
2023-04-19 07:00:17 +00:00
|
|
|
"openthread/src/core/thread/link_metrics.cpp"
|
2021-12-07 09:32:44 +00:00
|
|
|
"openthread/src/core/thread/lowpan.cpp"
|
2021-11-18 03:40:22 +00:00
|
|
|
"openthread/src/core/thread/mesh_forwarder.cpp"
|
2021-12-07 09:32:44 +00:00
|
|
|
"openthread/src/core/thread/mesh_forwarder_ftd.cpp"
|
|
|
|
"openthread/src/core/thread/mesh_forwarder_mtd.cpp"
|
2021-11-18 03:40:22 +00:00
|
|
|
"openthread/src/core/thread/mle.cpp"
|
|
|
|
"openthread/src/core/thread/neighbor_table.cpp"
|
2021-12-07 09:32:44 +00:00
|
|
|
"openthread/src/core/thread/network_data.cpp"
|
2021-11-18 03:40:22 +00:00
|
|
|
"openthread/src/core/thread/network_data_leader.cpp"
|
2021-12-07 09:32:44 +00:00
|
|
|
"openthread/src/core/thread/network_data_leader_ftd.cpp"
|
2021-11-18 03:40:22 +00:00
|
|
|
"openthread/src/core/thread/network_data_types.cpp"
|
|
|
|
"openthread/src/core/thread/network_data_service.cpp"
|
2021-12-07 09:32:44 +00:00
|
|
|
"openthread/src/core/thread/panid_query_server.cpp"
|
2021-11-18 03:40:22 +00:00
|
|
|
"openthread/src/core/thread/thread_netif.cpp"
|
2021-12-07 09:32:44 +00:00
|
|
|
"openthread/src/core/thread/tmf.cpp"
|
2021-11-18 03:40:22 +00:00
|
|
|
"openthread/src/core/thread/topology.cpp"
|
|
|
|
"openthread/src/core/utils/child_supervision.cpp")
|
|
|
|
endif()
|
|
|
|
|
2022-12-26 07:48:07 +00:00
|
|
|
if(CONFIG_OPENTHREAD_RADIO_NATIVE)
|
|
|
|
list(APPEND exclude_srcs
|
2022-11-16 08:59:57 +00:00
|
|
|
"port/esp_openthread_radio_spinel.cpp"
|
|
|
|
"port/esp_spi_spinel_interface.cpp"
|
|
|
|
"port/esp_uart_spinel_interface.cpp"
|
|
|
|
)
|
|
|
|
elseif(CONFIG_OPENTHREAD_RADIO_SPINEL_UART OR CONFIG_OPENTHREAD_RADIO_SPINEL_SPI)
|
2022-12-26 07:48:07 +00:00
|
|
|
list(APPEND exclude_srcs
|
|
|
|
"port/esp_openthread_radio.c")
|
|
|
|
endif()
|
|
|
|
|
2021-11-18 03:40:22 +00:00
|
|
|
if(CONFIG_OPENTHREAD_BORDER_ROUTER)
|
|
|
|
list(APPEND src_dirs
|
|
|
|
"openthread/src/core/border_router")
|
|
|
|
endif()
|
|
|
|
|
2021-07-28 07:32:59 +00:00
|
|
|
if(CONFIG_OPENTHREAD_FTD)
|
2021-11-18 03:40:22 +00:00
|
|
|
set_source_files_properties("openthread/src/core/net/srp_server.cpp"
|
|
|
|
PROPERTIES COMPILE_FLAGS
|
|
|
|
-Wno-maybe-uninitialized)
|
2021-06-28 11:20:51 +00:00
|
|
|
endif()
|
2021-04-02 06:49:49 +00:00
|
|
|
|
2023-03-09 03:19:31 +00:00
|
|
|
if(NOT CONFIG_OPENTHREAD_DNS64_CLIENT)
|
|
|
|
list(APPEND exclude_srcs
|
|
|
|
"port/esp_openthread_dns64.c")
|
|
|
|
endif()
|
|
|
|
|
2021-04-02 06:49:49 +00:00
|
|
|
if(CONFIG_OPENTHREAD_FTD)
|
|
|
|
set(device_type "OPENTHREAD_FTD=1")
|
|
|
|
elseif(CONFIG_OPENTHREAD_MTD)
|
|
|
|
set(device_type "OPENTHREAD_MTD=1")
|
|
|
|
elseif(CONFIG_OPENTHREAD_RADIO)
|
|
|
|
set(device_type "OPENTHREAD_RADIO=1")
|
|
|
|
endif()
|
2021-06-28 11:20:51 +00:00
|
|
|
|
2021-04-02 06:49:49 +00:00
|
|
|
endif()
|
|
|
|
|
|
|
|
execute_process(
|
|
|
|
COMMAND git rev-parse --short HEAD
|
|
|
|
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
|
|
|
OUTPUT_VARIABLE IDF_VERSION_FOR_OPENTHREAD_PACKAGE OUTPUT_STRIP_TRAILING_WHITESPACE
|
|
|
|
)
|
|
|
|
|
|
|
|
execute_process(
|
|
|
|
COMMAND git rev-parse --short HEAD
|
|
|
|
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/openthread
|
|
|
|
OUTPUT_VARIABLE OPENTHREAD_VERSION OUTPUT_STRIP_TRAILING_WHITESPACE
|
|
|
|
)
|
|
|
|
|
2022-03-02 10:04:38 +00:00
|
|
|
string(TIMESTAMP OT_BUILD_TIMESTAMP " %Y-%m-%d %H:%M:%S UTC" UTC)
|
2022-04-25 13:45:19 +00:00
|
|
|
string(CONCAT OT_FULL_VERSION_STRING
|
|
|
|
"openthread-esp32/"
|
|
|
|
"${IDF_VERSION_FOR_OPENTHREAD_PACKAGE}-${OPENTHREAD_VERSION}\; "
|
|
|
|
"${CONFIG_IDF_TARGET}\; ${OT_BUILD_TIMESTAMP}")
|
2022-03-02 10:04:38 +00:00
|
|
|
|
2021-04-02 06:49:49 +00:00
|
|
|
idf_component_register(SRC_DIRS "${src_dirs}"
|
|
|
|
EXCLUDE_SRCS "${exclude_srcs}"
|
|
|
|
INCLUDE_DIRS "${public_include_dirs}"
|
|
|
|
PRIV_INCLUDE_DIRS "${private_include_dirs}"
|
2022-11-16 08:59:57 +00:00
|
|
|
REQUIRES esp_netif lwip driver
|
2023-01-03 09:29:30 +00:00
|
|
|
LDFRAGMENTS linker.lf
|
2022-11-16 08:59:57 +00:00
|
|
|
PRIV_REQUIRES console esp_event esp_partition esp_timer
|
2022-12-26 11:05:19 +00:00
|
|
|
ieee802154 mbedtls spi_flash)
|
2021-04-02 06:49:49 +00:00
|
|
|
|
|
|
|
if(CONFIG_OPENTHREAD_ENABLED)
|
2021-07-28 07:32:59 +00:00
|
|
|
if(CONFIG_OPENTHREAD_RADIO)
|
|
|
|
set(CONFIG_FILE_TYPE "radio")
|
2021-11-18 03:40:22 +00:00
|
|
|
elseif(CONFIG_OPENTHREAD_FTD)
|
2021-07-28 07:32:59 +00:00
|
|
|
set(CONFIG_FILE_TYPE "ftd")
|
2021-11-18 03:40:22 +00:00
|
|
|
elseif(CONFIG_OPENTHREAD_MTD)
|
|
|
|
set(CONFIG_FILE_TYPE "mtd")
|
2021-07-28 07:32:59 +00:00
|
|
|
endif()
|
|
|
|
|
2021-06-28 11:20:51 +00:00
|
|
|
target_compile_definitions(
|
|
|
|
${COMPONENT_LIB}
|
|
|
|
PUBLIC
|
2021-07-28 07:32:59 +00:00
|
|
|
"OPENTHREAD_CONFIG_FILE=\"openthread-core-esp32x-${CONFIG_FILE_TYPE}-config.h\""
|
2021-06-28 11:20:51 +00:00
|
|
|
"${device_type}"
|
|
|
|
PRIVATE
|
2022-03-02 10:04:38 +00:00
|
|
|
"PACKAGE_VERSION=\"${IDF_VERSION_FOR_OPENTHREAD_PACKAGE}-${OPENTHREAD_VERSION}\""
|
|
|
|
"OPENTHREAD_BUILD_DATETIME=\"${OT_BUILD_TIMESTAMP}\""
|
|
|
|
)
|
2022-12-26 07:48:07 +00:00
|
|
|
|
2022-04-25 13:45:19 +00:00
|
|
|
if(CONFIG_OPENTHREAD_RADIO)
|
2022-03-02 10:04:38 +00:00
|
|
|
file(WRITE ${CMAKE_BINARY_DIR}/rcp_version ${OT_FULL_VERSION_STRING})
|
|
|
|
endif()
|
2021-06-28 11:20:51 +00:00
|
|
|
|
2022-12-26 07:48:07 +00:00
|
|
|
if(CONFIG_OPENTHREAD_BORDER_ROUTER)
|
|
|
|
if($ENV{OPENTHREAD_ESP_BR_LIB_FROM_INTERNAL_SRC})
|
2021-06-28 11:20:51 +00:00
|
|
|
idf_component_get_property(openthread_br_lib openthread_br COMPONENT_LIB)
|
|
|
|
target_link_libraries(${COMPONENT_LIB} PUBLIC $<TARGET_FILE:${openthread_br_lib}>)
|
2022-04-20 07:38:06 +00:00
|
|
|
else()
|
2022-12-26 07:48:07 +00:00
|
|
|
add_prebuilt_library(openthread_br "${CMAKE_CURRENT_SOURCE_DIR}/lib/${idf_target}/libopenthread_br.a"
|
|
|
|
REQUIRES openthread)
|
2021-06-28 11:20:51 +00:00
|
|
|
target_link_libraries(${COMPONENT_LIB} INTERFACE openthread_br)
|
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
|
2021-04-02 06:49:49 +00:00
|
|
|
endif()
|