feat(openthread): use explicit source list for RCP build

This commit is contained in:
Tan Yan Quan
2026-01-27 15:35:53 +08:00
parent 9d155077af
commit ca02f5700a
6 changed files with 320 additions and 244 deletions
+47 -239
View File
@@ -5,14 +5,12 @@ if(${idf_target} STREQUAL "linux")
endif()
if(CONFIG_OPENTHREAD_ENABLED OR CONFIG_IDF_DOC_BUILD OR CONFIG_OPENTHREAD_SPINEL_ONLY)
set(public_include_dirs
"include"
"openthread/include")
endif()
if(CONFIG_OPENTHREAD_ENABLED)
set(private_include_dirs
"openthread/examples/platforms"
"openthread/src"
@@ -24,243 +22,18 @@ if(CONFIG_OPENTHREAD_ENABLED)
"openthread/src/ncp"
"private_include")
set(src_dirs
"src"
"src/port"
"openthread/examples/platforms/utils"
"openthread/src/core/api"
"openthread/src/core/common"
"openthread/src/core/crypto"
"openthread/src/core/diags"
"openthread/src/core/instance"
"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/instance/extension_example.cpp"
"openthread/src/core/crypto/crypto_platform_mbedtls.cpp"
"openthread/src/core/api/random_crypto_api.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")
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()
elseif(CONFIG_OPENTHREAD_RADIO)
list(APPEND src_dirs
"openthread/src/ncp"
"openthread/examples/apps/ncp")
list(APPEND exclude_srcs
"src/port/esp_openthread_state.c"
"openthread/examples/apps/ncp/main.c"
"openthread/src/core/api/backbone_router_api.cpp"
"openthread/src/core/api/child_supervision_api.cpp"
"openthread/src/core/api/dataset_api.cpp"
"openthread/src/core/api/dns_api.cpp"
"openthread/src/core/api/entropy_api.cpp"
"openthread/src/core/api/heap_api.cpp"
"openthread/src/core/api/icmp6_api.cpp"
"openthread/src/core/api/ip6_api.cpp"
"openthread/src/core/api/link_api.cpp"
"openthread/src/core/api/link_metrics_api.cpp"
"openthread/src/core/api/message_api.cpp"
"openthread/src/core/api/nat64_api.cpp"
"openthread/src/core/api/netdata_api.cpp"
"openthread/src/core/api/netdiag_api.cpp"
"openthread/src/core/api/network_time_api.cpp"
"openthread/src/core/api/random_crypto_api.cpp"
"openthread/src/core/api/tcp_api.cpp"
"openthread/src/core/api/udp_api.cpp"
"openthread/src/core/common/heap.cpp"
"openthread/src/core/common/heap_string.cpp"
"openthread/src/core/common/notifier.cpp"
"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"
"openthread/src/core/thread/address_resolver.cpp"
"openthread/src/core/thread/child.cpp"
"openthread/src/core/thread/child_supervision.cpp"
"openthread/src/core/thread/csl_tx_scheduler.cpp"
"openthread/src/core/thread/discover_scanner.cpp"
"openthread/src/core/thread/energy_scan_server.cpp"
"openthread/src/core/thread/indirect_sender.cpp"
"openthread/src/core/thread/key_manager.cpp"
"openthread/src/core/thread/link_metrics.cpp"
"openthread/src/core/thread/lowpan.cpp"
"openthread/src/core/thread/mesh_forwarder.cpp"
"openthread/src/core/thread/mesh_forwarder_ftd.cpp"
"openthread/src/core/thread/mesh_forwarder_mtd.cpp"
"openthread/src/core/thread/message_framer.cpp"
"openthread/src/core/thread/mle.cpp"
"openthread/src/core/thread/mle_ftd.cpp"
"openthread/src/core/thread/mle_p2p.cpp"
"openthread/src/core/thread/mle_router.cpp"
"openthread/src/core/thread/mle_types.cpp"
"openthread/src/core/thread/neighbor.cpp"
"openthread/src/core/thread/neighbor_table.cpp"
"openthread/src/core/thread/network_data.cpp"
"openthread/src/core/thread/network_data_leader.cpp"
"openthread/src/core/thread/network_data_leader_ftd.cpp"
"openthread/src/core/thread/network_data_types.cpp"
"openthread/src/core/thread/network_data_service.cpp"
"openthread/src/core/thread/network_diagnostic.cpp"
"openthread/src/core/thread/network_diagnostic_tlvs.cpp"
"openthread/src/core/thread/panid_query_server.cpp"
"openthread/src/core/thread/router.cpp"
"openthread/src/core/thread/thread_netif.cpp"
"openthread/src/core/thread/time_sync_service.cpp"
"openthread/src/core/thread/tmf.cpp"
"openthread/src/core/thread/topology.cpp"
"openthread/src/core/utils/child_supervision.cpp")
endif()
if(CONFIG_OPENTHREAD_RADIO_NATIVE)
list(APPEND exclude_srcs
"src/port/esp_openthread_radio_spinel.cpp"
"src/port/esp_spi_spinel_interface.cpp"
"src/port/esp_uart_spinel_interface.cpp"
)
elseif(CONFIG_OPENTHREAD_RADIO_SPINEL_UART OR CONFIG_OPENTHREAD_RADIO_SPINEL_SPI)
list(APPEND exclude_srcs
"src/port/esp_openthread_radio.c"
"src/port/esp_openthread_sleep.c")
elseif(CONFIG_OPENTHREAD_RADIO_154_NONE)
list(APPEND exclude_srcs
"src/port/esp_openthread_radio_spinel.cpp"
"src/port/esp_spi_spinel_interface.cpp"
"src/port/esp_uart_spinel_interface.cpp"
"src/port/esp_openthread_radio.c"
"src/port/esp_openthread_sleep.c"
)
endif()
if(NOT CONFIG_OPENTHREAD_RADIO_TREL)
list(APPEND exclude_srcs
"src/port/esp_openthread_trel.c")
endif()
if(CONFIG_OPENTHREAD_BORDER_ROUTER)
list(APPEND src_dirs
"openthread/src/core/border_router")
endif()
if(CONFIG_OPENTHREAD_FTD)
set_source_files_properties("openthread/src/core/net/srp_server.cpp"
PROPERTIES COMPILE_FLAGS
-Wno-maybe-uninitialized)
endif()
if(CONFIG_OPENTHREAD_NCP_VENDOR_HOOK)
list(APPEND src_dirs
"src/ncp")
if(CONFIG_OPENTHREAD_RCP_UART OR CONFIG_OPENTHREAD_RCP_USB_SERIAL_JTAG)
list(APPEND exclude_srcs
"src/ncp/esp_openthread_ncp_spi.cpp")
elseif(CONFIG_OPENTHREAD_RCP_SPI)
list(APPEND exclude_srcs
"src/ncp/esp_openthread_ncp_hdlc.cpp")
endif()
endif()
if(NOT CONFIG_OPENTHREAD_DNS64_CLIENT)
list(APPEND exclude_srcs
"src/esp_openthread_dns64.c")
endif()
if(NOT CONFIG_FREERTOS_USE_TICKLESS_IDLE)
list(APPEND exclude_srcs
"src/port/esp_openthread_sleep.c")
endif()
if(NOT CONFIG_OPENTHREAD_PLATFORM_MSGPOOL_MANAGEMENT)
list(APPEND exclude_srcs
"src/port/esp_openthread_messagepool.c")
endif()
if(NOT CONFIG_OPENTHREAD_RCP_SPINEL_CONSOLE)
list(APPEND exclude_srcs
"src/ncp/esp_openthread_ncp_console.cpp")
endif()
if(CONFIG_OPENTHREAD_FTD)
include(srcs_ftd_mtd.cmake)
set(device_type "OPENTHREAD_FTD=1")
elseif(CONFIG_OPENTHREAD_MTD)
include(srcs_ftd_mtd.cmake)
set(device_type "OPENTHREAD_MTD=1")
elseif(CONFIG_OPENTHREAD_RADIO)
include(srcs_radio.cmake)
set(device_type "OPENTHREAD_RADIO=1")
endif()
elseif(CONFIG_OPENTHREAD_SPINEL_ONLY)
set(src_dirs
"src/spinel"
"src/port"
"openthread/src/lib/spinel"
"openthread/src/lib/hdlc"
"openthread/src/lib/platform"
"openthread/src/core/api"
"openthread/src/core/common"
"openthread/src/core/mac")
set(private_include_dirs
"private_include"
"openthread/src"
"openthread/src/core"
"openthread/src/include"
"openthread/src/lib"
"openthread/src/lib/hdlc"
"openthread/src/lib/spinel")
file(GLOB_RECURSE exclude_srcs_list
"src/port/*"
"openthread/src/core/api/*.cpp"
"openthread/src/core/common/*"
"openthread/src/core/mac/*")
list(REMOVE_ITEM exclude_srcs_list
"${CMAKE_CURRENT_SOURCE_DIR}/src/port/esp_openthread_alarm.c"
"${CMAKE_CURRENT_SOURCE_DIR}/src/port/esp_openthread_logging.c"
"${CMAKE_CURRENT_SOURCE_DIR}/openthread/src/core/api/error_api.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/openthread/src/core/api/logging_api.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/openthread/src/core/common/error.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/openthread/src/core/common/error.hpp"
"${CMAKE_CURRENT_SOURCE_DIR}/openthread/src/core/common/log.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/openthread/src/core/common/log.hpp"
"${CMAKE_CURRENT_SOURCE_DIR}/openthread/src/core/common/logging.hpp"
"${CMAKE_CURRENT_SOURCE_DIR}/openthread/src/core/common/string.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/openthread/src/core/common/string.hpp"
"${CMAKE_CURRENT_SOURCE_DIR}/openthread/src/core/mac/mac_frame.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/openthread/src/core/mac/mac_frame.hpp")
list(APPEND exclude_srcs ${exclude_srcs_list})
include(srcs_spinel.cmake)
endif()
if(CONFIG_OPENTHREAD_HEADER_CUSTOM)
@@ -287,14 +60,49 @@ string(CONCAT OT_FULL_VERSION_STRING
"${IDF_VERSION_FOR_OPENTHREAD_PACKAGE}-${OPENTHREAD_VERSION}\; "
"${CONFIG_OPENTHREAD_PLATFORM_INFO}\; ${OT_BUILD_TIMESTAMP}")
idf_component_register(SRC_DIRS "${src_dirs}"
EXCLUDE_SRCS "${exclude_srcs}"
INCLUDE_DIRS "${public_include_dirs}"
PRIV_INCLUDE_DIRS "${private_include_dirs}"
REQUIRES esp_netif lwip esp_driver_uart esp_driver_gpio esp_driver_spi esp_driver_usb_serial_jtag
LDFRAGMENTS linker.lf
PRIV_REQUIRES console esp_coex esp_event esp_partition esp_timer
ieee802154 mbedtls nvs_flash)
# Register component based on mode
if(CONFIG_OPENTHREAD_FTD OR CONFIG_OPENTHREAD_MTD)
# FTD/MTD modes use directory-based collection from srcs_ftd_mtd.cmake
idf_component_register(SRC_DIRS "${src_dirs}"
EXCLUDE_SRCS "${exclude_srcs}"
INCLUDE_DIRS "${public_include_dirs}"
PRIV_INCLUDE_DIRS "${private_include_dirs}"
REQUIRES esp_netif lwip esp_driver_uart esp_driver_gpio esp_driver_spi
esp_driver_usb_serial_jtag
LDFRAGMENTS linker.lf
PRIV_REQUIRES console esp_coex esp_event esp_partition esp_timer
ieee802154 mbedtls nvs_flash)
elseif(CONFIG_OPENTHREAD_RADIO)
# RCP mode uses explicit source list from srcs_radio.cmake
idf_component_register(SRCS ${rcp_srcs}
INCLUDE_DIRS "${public_include_dirs}"
PRIV_INCLUDE_DIRS "${private_include_dirs}"
REQUIRES esp_netif lwip esp_driver_uart esp_driver_gpio esp_driver_spi
esp_driver_usb_serial_jtag
LDFRAGMENTS linker.lf
PRIV_REQUIRES console esp_coex esp_event esp_partition esp_timer
ieee802154 mbedtls nvs_flash)
elseif(CONFIG_OPENTHREAD_SPINEL_ONLY)
# SPINEL_ONLY mode uses explicit source list from srcs_spinel.cmake
idf_component_register(SRCS ${spinel_srcs}
INCLUDE_DIRS "${public_include_dirs}"
PRIV_INCLUDE_DIRS "${private_include_dirs}"
REQUIRES esp_netif lwip esp_driver_uart esp_driver_gpio esp_driver_spi
esp_driver_usb_serial_jtag
LDFRAGMENTS linker.lf
PRIV_REQUIRES console esp_coex esp_event esp_partition esp_timer
ieee802154 mbedtls nvs_flash)
else()
# This is not supposed to happen, but in older versions of IDF components couldn't be selectively
# enabled based on KConfig options so some examples just included openthread for all configs.
idf_component_register(INCLUDE_DIRS "${public_include_dirs}"
PRIV_INCLUDE_DIRS "${private_include_dirs}"
REQUIRES esp_netif lwip esp_driver_uart esp_driver_gpio esp_driver_spi
esp_driver_usb_serial_jtag
LDFRAGMENTS linker.lf
PRIV_REQUIRES console esp_coex esp_event esp_partition esp_timer
ieee802154 mbedtls nvs_flash)
endif()
if(CONFIG_OPENTHREAD_RADIO_TREL)
idf_component_optional_requires(PRIVATE espressif__mdns)
+1 -1
View File
@@ -2,13 +2,13 @@
archive: libopenthread.a
entries:
if OPENTHREAD_TIMING_OPTIMIZATION = y:
link_metrics (noflash)
link_quality (noflash)
mac_frame (noflash)
radio (noflash)
sub_mac (noflash)
if OPENTHREAD_TIMING_OPTIMIZATION = y && OPENTHREAD_RADIO = n:
link_metrics (noflash)
mesh_forwarder (noflash)
csl_tx_scheduler (noflash)
mac (noflash)
@@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2021-2025 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2021-2026 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
@@ -179,11 +179,21 @@ esp_err_t esp_openthread_platform_deinit(void)
esp_openthread_task_queue_deinit();
esp_openthread_radio_deinit();
if (get_host_connection_mode() == HOST_CONNECTION_MODE_RCP_SPI){
esp_openthread_host_connection_mode_t host_mode = get_host_connection_mode();
switch (host_mode) {
#if CONFIG_OPENTHREAD_RCP_SPI
case HOST_CONNECTION_MODE_RCP_SPI:
esp_openthread_spi_slave_deinit();
} else if (get_host_connection_mode() == HOST_CONNECTION_MODE_CLI_UART ||
get_host_connection_mode() == HOST_CONNECTION_MODE_RCP_UART) {
break;
#endif
#if CONFIG_OPENTHREAD_RCP_UART || CONFIG_OPENTHREAD_CONSOLE_TYPE_UART
case HOST_CONNECTION_MODE_RCP_UART:
case HOST_CONNECTION_MODE_CLI_UART:
esp_openthread_uart_deinit();
break;
#endif
default:
break;
}
esp_openthread_lock_deinit();
+116
View File
@@ -0,0 +1,116 @@
# SPDX-FileCopyrightText: 2026 Espressif Systems (Shanghai) CO LTD
# SPDX-License-Identifier: Apache-2.0
# Source files for FTD (Full Thread Device) and MTD (Minimal Thread Device) modes.
# Uses directory-based collection with exclusions.
set(src_dirs
"src"
"src/port"
"openthread/examples/platforms/utils"
"openthread/src/core/api"
"openthread/src/core/common"
"openthread/src/core/crypto"
"openthread/src/core/diags"
"openthread/src/core/instance"
"openthread/src/core/mac"
"openthread/src/core/radio"
"openthread/src/core/thread"
"openthread/src/core/utils"
"openthread/src/lib/hdlc"
"openthread/src/lib/spinel"
"openthread/src/core/backbone_router"
"openthread/src/core/coap"
"openthread/src/core/meshcop"
"openthread/src/core/net"
"openthread/src/lib/platform"
)
set(exclude_srcs
"openthread/examples/platforms/utils/logging_rtt.c"
"openthread/examples/platforms/utils/soft_source_match_table.c"
"openthread/src/core/instance/extension_example.cpp"
"openthread/src/core/crypto/crypto_platform_mbedtls.cpp"
"openthread/src/core/api/random_crypto_api.cpp"
)
# CLI sources
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()
# Radio interface exclusions
if(CONFIG_OPENTHREAD_RADIO_NATIVE)
list(APPEND exclude_srcs
"src/port/esp_openthread_radio_spinel.cpp"
"src/port/esp_spi_spinel_interface.cpp"
"src/port/esp_uart_spinel_interface.cpp")
elseif(CONFIG_OPENTHREAD_RADIO_SPINEL_UART OR CONFIG_OPENTHREAD_RADIO_SPINEL_SPI)
list(APPEND exclude_srcs
"src/port/esp_openthread_radio.c"
"src/port/esp_openthread_sleep.c")
elseif(CONFIG_OPENTHREAD_RADIO_154_NONE)
list(APPEND exclude_srcs
"src/port/esp_openthread_radio_spinel.cpp"
"src/port/esp_spi_spinel_interface.cpp"
"src/port/esp_uart_spinel_interface.cpp"
"src/port/esp_openthread_radio.c"
"src/port/esp_openthread_sleep.c")
endif()
# TREL
if(NOT CONFIG_OPENTHREAD_RADIO_TREL)
list(APPEND exclude_srcs
"src/port/esp_openthread_trel.c")
endif()
# Border router
if(CONFIG_OPENTHREAD_BORDER_ROUTER)
list(APPEND src_dirs
"openthread/src/core/border_router")
endif()
# FTD-specific
if(CONFIG_OPENTHREAD_FTD)
set_source_files_properties("openthread/src/core/net/srp_server.cpp"
PROPERTIES COMPILE_FLAGS
-Wno-maybe-uninitialized)
endif()
# NCP vendor hook
if(CONFIG_OPENTHREAD_NCP_VENDOR_HOOK)
list(APPEND src_dirs
"src/ncp")
if(CONFIG_OPENTHREAD_RCP_UART OR CONFIG_OPENTHREAD_RCP_USB_SERIAL_JTAG)
list(APPEND exclude_srcs
"src/ncp/esp_openthread_ncp_spi.cpp")
elseif(CONFIG_OPENTHREAD_RCP_SPI)
list(APPEND exclude_srcs
"src/ncp/esp_openthread_ncp_hdlc.cpp")
endif()
endif()
# Optional features
if(NOT CONFIG_OPENTHREAD_DNS64_CLIENT)
list(APPEND exclude_srcs
"src/esp_openthread_dns64.c")
endif()
if(NOT CONFIG_FREERTOS_USE_TICKLESS_IDLE)
list(APPEND exclude_srcs
"src/port/esp_openthread_sleep.c")
endif()
if(NOT CONFIG_OPENTHREAD_PLATFORM_MSGPOOL_MANAGEMENT)
list(APPEND exclude_srcs
"src/port/esp_openthread_messagepool.c")
endif()
if(NOT CONFIG_OPENTHREAD_RCP_SPINEL_CONSOLE)
list(APPEND exclude_srcs
"src/ncp/esp_openthread_ncp_console.cpp")
endif()
+97
View File
@@ -0,0 +1,97 @@
# SPDX-FileCopyrightText: 2026 Espressif Systems (Shanghai) CO LTD
# SPDX-License-Identifier: Apache-2.0
# Source files for RCP (Radio Co-Processor) mode.
# Uses explicit whitelist to avoid including non-RCP-compatible files.
# This prevents new OpenThread files from breaking RCP builds.
set(rcp_srcs
# OpenThread core - RADIO_COMMON_SOURCES from openthread/src/core/CMakeLists.txt
# No need for crypto/crypto_platform_mbedtls.cpp because we use esp-idf implementation
openthread/src/core/api/diags_api.cpp
openthread/src/core/api/error_api.cpp
openthread/src/core/api/instance_api.cpp
openthread/src/core/api/link_raw_api.cpp
openthread/src/core/api/logging_api.cpp
openthread/src/core/api/random_noncrypto_api.cpp
openthread/src/core/api/tasklet_api.cpp
openthread/src/core/common/binary_search.cpp
openthread/src/core/common/error.cpp
openthread/src/core/common/frame_builder.cpp
openthread/src/core/common/log.cpp
openthread/src/core/common/random.cpp
openthread/src/core/common/string.cpp
openthread/src/core/common/tasklet.cpp
openthread/src/core/common/timer.cpp
openthread/src/core/common/uptime.cpp
openthread/src/core/crypto/aes_ccm.cpp
openthread/src/core/crypto/aes_ecb.cpp
openthread/src/core/crypto/crypto_platform_psa.cpp
openthread/src/core/crypto/storage.cpp
openthread/src/core/diags/factory_diags.cpp
openthread/src/core/instance/instance.cpp
openthread/src/core/mac/link_raw.cpp
openthread/src/core/mac/mac_frame.cpp
openthread/src/core/mac/mac_header_ie.cpp
openthread/src/core/mac/mac_types.cpp
openthread/src/core/mac/sub_mac.cpp
openthread/src/core/mac/sub_mac_callbacks.cpp
openthread/src/core/mac/sub_mac_csl_receiver.cpp
openthread/src/core/mac/sub_mac_wed.cpp
openthread/src/core/radio/radio.cpp
openthread/src/core/radio/radio_callbacks.cpp
openthread/src/core/radio/radio_platform.cpp
openthread/src/core/thread/link_quality.cpp
openthread/src/core/utils/otns.cpp
openthread/src/core/utils/parse_cmdline.cpp
openthread/src/core/utils/power_calibration.cpp
# Platform utils
openthread/examples/platforms/utils/mac_frame.cpp
# HDLC library
openthread/src/lib/hdlc/hdlc.cpp
# Spinel library
openthread/src/lib/spinel/spinel.c
openthread/src/lib/spinel/spinel_buffer.cpp
openthread/src/lib/spinel/spinel_decoder.cpp
openthread/src/lib/spinel/spinel_encoder.cpp
# NCP
openthread/src/ncp/changed_props_set.cpp
openthread/src/ncp/ncp_base.cpp
openthread/src/ncp/ncp_base_dispatcher.cpp
openthread/src/ncp/ncp_base_radio.cpp
openthread/examples/apps/ncp/ncp.c
# ESP port
src/port/esp_openthread_alarm.c
src/port/esp_openthread_logging.c
src/port/esp_openthread_misc.c
src/port/esp_openthread_radio.c
src/port/esp_openthread_settings.c
# ESP sources
src/esp_openthread.cpp
src/esp_openthread_lock.c
src/esp_openthread_platform.cpp
src/esp_openthread_task_queue.c
# ESP NCP
src/ncp/esp_openthread_ncp.cpp
)
# Conditional sources based on host connection mode
if(CONFIG_OPENTHREAD_RCP_UART OR CONFIG_OPENTHREAD_RCP_USB_SERIAL_JTAG)
list(APPEND rcp_srcs
openthread/src/ncp/ncp_hdlc.cpp
src/port/esp_openthread_uart.c)
if(CONFIG_OPENTHREAD_NCP_VENDOR_HOOK)
list(APPEND rcp_srcs src/ncp/esp_openthread_ncp_hdlc.cpp)
endif()
elseif(CONFIG_OPENTHREAD_RCP_SPI)
list(APPEND rcp_srcs
openthread/src/ncp/ncp_spi.cpp
src/port/esp_openthread_spi_slave.c)
if(CONFIG_OPENTHREAD_NCP_VENDOR_HOOK)
list(APPEND rcp_srcs src/ncp/esp_openthread_ncp_spi.cpp)
endif()
endif()
if(CONFIG_OPENTHREAD_NCP_VENDOR_HOOK AND CONFIG_OPENTHREAD_RCP_SPINEL_CONSOLE)
list(APPEND rcp_srcs src/ncp/esp_openthread_ncp_console.cpp)
endif()
+45
View File
@@ -0,0 +1,45 @@
# SPDX-FileCopyrightText: 2026 Espressif Systems (Shanghai) CO LTD
# SPDX-License-Identifier: Apache-2.0
# Source files for SPINEL_ONLY mode.
# Minimal build for host-side spinel communication.
# Uses explicit whitelist for clarity.
set(private_include_dirs
"private_include"
"openthread/src"
"openthread/src/core"
"openthread/src/include"
"openthread/src/lib"
"openthread/src/lib/hdlc"
"openthread/src/lib/spinel"
)
set(spinel_srcs
# ESP spinel sources
src/spinel/esp_radio_spinel.cpp
src/spinel/esp_radio_spinel_uart_interface.cpp
# ESP port (minimal)
src/port/esp_openthread_alarm.c
src/port/esp_openthread_logging.c
# OpenThread spinel library
openthread/src/lib/spinel/spinel.c
openthread/src/lib/spinel/spinel_buffer.cpp
openthread/src/lib/spinel/spinel_decoder.cpp
openthread/src/lib/spinel/spinel_encoder.cpp
openthread/src/lib/spinel/spinel_helper.cpp
openthread/src/lib/spinel/radio_spinel.cpp
openthread/src/lib/spinel/spinel_driver.cpp
openthread/src/lib/spinel/logger.cpp
# OpenThread HDLC library
openthread/src/lib/hdlc/hdlc.cpp
# OpenThread platform library
openthread/src/lib/platform/exit_code.c
# OpenThread core (minimal)
openthread/src/core/api/error_api.cpp
openthread/src/core/api/logging_api.cpp
openthread/src/core/common/error.cpp
openthread/src/core/common/log.cpp
openthread/src/core/common/string.cpp
openthread/src/core/mac/mac_frame.cpp
)