-
Notifications
You must be signed in to change notification settings - Fork 162
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'controller/controller_with_thread_br' into 'master'
Add Thread border router support in rainmaker + matter controller See merge request app-frameworks/esp-rainmaker!434
- Loading branch information
Showing
24 changed files
with
670 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,7 @@ | ||
set(ldfragments linker.lf) | ||
idf_component_register(SRCS ./app_main.cpp ./app_matter.cpp ./app_driver.cpp | ||
PRIV_INCLUDE_DIRS ".") | ||
PRIV_INCLUDE_DIRS "." | ||
LDFRAGMENTS "${ldfragments}") | ||
|
||
set_property(TARGET ${COMPONENT_LIB} PROPERTY CXX_STANDARD 17) | ||
target_compile_options(${COMPONENT_LIB} PRIVATE "-DCHIP_HAVE_CONFIG_H") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
/* | ||
* SPDX-FileCopyrightText: 2021-2022 Espressif Systems (Shanghai) CO LTD | ||
* | ||
* SPDX-License-Identifier: CC0-1.0 | ||
* | ||
* OpenThread Border Router Example | ||
* | ||
* This example code is in the Public Domain (or CC0 licensed, at your option.) | ||
* | ||
* Unless required by applicable law or agreed to in writing, this | ||
* software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR | ||
* CONDITIONS OF ANY KIND, either express or implied. | ||
*/ | ||
|
||
#pragma once | ||
|
||
#include "sdkconfig.h" | ||
#if CONFIG_OPENTHREAD_BORDER_ROUTER | ||
#include "esp_openthread_types.h" | ||
|
||
#if CONFIG_OPENTHREAD_RADIO_NATIVE | ||
#define ESP_OPENTHREAD_DEFAULT_RADIO_CONFIG() \ | ||
{ \ | ||
.radio_mode = RADIO_MODE_NATIVE, \ | ||
} | ||
#elif CONFIG_OPENTHREAD_RADIO_SPINEL_UART | ||
#define ESP_OPENTHREAD_DEFAULT_RADIO_CONFIG() \ | ||
{ \ | ||
.radio_mode = RADIO_MODE_UART_RCP, \ | ||
.radio_uart_config = { \ | ||
.port = (uart_port_t)1, \ | ||
.uart_config = \ | ||
{ \ | ||
.baud_rate = 460800, \ | ||
.data_bits = UART_DATA_8_BITS, \ | ||
.parity = UART_PARITY_DISABLE, \ | ||
.stop_bits = UART_STOP_BITS_1, \ | ||
.flow_ctrl = UART_HW_FLOWCTRL_DISABLE, \ | ||
.rx_flow_ctrl_thresh = 0, \ | ||
.source_clk = UART_SCLK_DEFAULT, \ | ||
}, \ | ||
.rx_pin = GPIO_NUM_17, \ | ||
.tx_pin = GPIO_NUM_18, \ | ||
}, \ | ||
} | ||
#else | ||
#define ESP_OPENTHREAD_DEFAULT_RADIO_CONFIG() \ | ||
{ \ | ||
.radio_mode = RADIO_MODE_SPI_RCP, \ | ||
.radio_spi_config = { \ | ||
.host_device = SPI2_HOST, \ | ||
.dma_channel = 2, \ | ||
.spi_interface = \ | ||
{ \ | ||
.mosi_io_num = 11, \ | ||
.sclk_io_num = 12, \ | ||
.miso_io_num = 13, \ | ||
}, \ | ||
.spi_device = \ | ||
{ \ | ||
.cs_ena_pretrans = 2, \ | ||
.input_delay_ns = 100, \ | ||
.mode = 0, \ | ||
.clock_speed_hz = 2500 * 1000, \ | ||
.spics_io_num = 10, \ | ||
.queue_size = 5, \ | ||
}, \ | ||
.intr_pin = 8, \ | ||
}, \ | ||
} | ||
#endif // CONFIG_OPENTHREAD_RADIO_SPINEL_UART OR CONFIG_OPENTHREAD_RADIO_SPINEL_SPI | ||
|
||
#define HOST_BAUD_RATE 115200 | ||
|
||
#define ESP_OPENTHREAD_DEFAULT_HOST_CONFIG() \ | ||
{ \ | ||
.host_connection_mode = HOST_CONNECTION_MODE_NONE, \ | ||
} | ||
|
||
#define ESP_OPENTHREAD_DEFAULT_PORT_CONFIG() \ | ||
{ \ | ||
.storage_partition_name = "nvs", .netif_queue_size = 10, .task_queue_size = 10, \ | ||
} | ||
#endif // CONFIG_OPENTHREAD_BORDER_ROUTER |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
[mapping:CHIP] | ||
archive: libCHIP.a | ||
entries: | ||
if ESP_ALLOW_BSS_SEG_EXTERNAL_MEMORY = y: | ||
* (extram_bss) | ||
else: | ||
* (default) | ||
|
||
[mapping:esp_matter] | ||
archive: libesp_matter.a | ||
entries: | ||
if ESP_ALLOW_BSS_SEG_EXTERNAL_MEMORY = y: | ||
* (extram_bss) | ||
else: | ||
* (default) | ||
|
||
[mapping:openthread_bss] | ||
archive: libopenthread.a | ||
entries: | ||
if ESP_ALLOW_BSS_SEG_EXTERNAL_MEMORY = y: | ||
* (extram_bss) | ||
else: | ||
* (default) | ||
|
||
[mapping:openthread_br] | ||
archive: libopenthread_br.a | ||
entries: | ||
if ESP_ALLOW_BSS_SEG_EXTERNAL_MEMORY = y: | ||
* (extram_bss) | ||
else: | ||
* (default) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# Name, Type, SubType, Offset, Size, Flags | ||
# Note: Firmware partition offset needs to be 64K aligned, initial 36K (9 sectors) are reserved for bootloader and partition table | ||
esp_secure_cert, 0x3F, , 0xD000, 0x2000, encrypted | ||
nvs, data, nvs, 0x10000, 0xC000, | ||
otadata, data, ota, , 0x2000 | ||
phy_init, data, phy, , 0x1000, | ||
ota_0, app, ota_0, 0x20000, 3000K, | ||
fctry, data, nvs, 0x320000, 0x6000 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
# ESP Thread Border Router DevKits use 4MB flash | ||
CONFIG_ESPTOOLPY_FLASHSIZE_4MB=y | ||
|
||
# SPIRAM | ||
CONFIG_SPIRAM=y | ||
CONFIG_SPIRAM_MODE_QUAD=y | ||
CONFIG_SPIRAM_SPEED_80M=y | ||
CONFIG_SPIRAM_MALLOC_ALWAYSINTERNAL=512 | ||
CONFIG_SPIRAM_MALLOC_RESERVE_INTERNAL=8192 | ||
CONFIG_SPIRAM_ALLOW_BSS_SEG_EXTERNAL_MEMORY=y | ||
CONFIG_SPIRAM_TRY_ALLOCATE_WIFI_LWIP=y | ||
CONFIG_ESP_ALLOW_BSS_SEG_EXTERNAL_MEMORY=y | ||
CONFIG_BT_NIMBLE_MEM_ALLOC_MODE_EXTERNAL=y | ||
CONFIG_ESP_MATTER_MEM_ALLOC_MODE_EXTERNAL=y | ||
CONFIG_MBEDTLS_EXTERNAL_MEM_ALLOC=y | ||
|
||
# Enable Openthread Border Router, but don't run matter over Thread | ||
CONFIG_OPENTHREAD_ENABLED=y | ||
CONFIG_OPENTHREAD_LOG_LEVEL_DYNAMIC=n | ||
CONFIG_OPENTHREAD_LOG_LEVEL_NOTE=y | ||
CONFIG_OPENTHREAD_BORDER_ROUTER=y | ||
CONFIG_ENABLE_MATTER_OVER_THREAD=n | ||
|
||
#LwIP config for OpenThread | ||
CONFIG_LWIP_IPV6_AUTOCONFIG=y | ||
CONFIG_LWIP_IPV6_NUM_ADDRESSES=8 | ||
CONFIG_LWIP_MULTICAST_PING=y | ||
CONFIG_LWIP_IPV6_FORWARD=y | ||
CONFIG_LWIP_HOOK_IP6_ROUTE_DEFAULT=y | ||
CONFIG_LWIP_HOOK_ND6_GET_GW_DEFAULT=y | ||
CONFIG_LWIP_NETIF_STATUS_CALLBACK=y | ||
|
||
# mbedTLS | ||
CONFIG_MBEDTLS_HARDWARE_AES=y | ||
CONFIG_MBEDTLS_HARDWARE_MPI=y | ||
CONFIG_MBEDTLS_HARDWARE_SHA=y | ||
CONFIG_MBEDTLS_CMAC_C=y | ||
CONFIG_MBEDTLS_KEY_EXCHANGE_ECJPAKE=y | ||
CONFIG_MBEDTLS_ECJPAKE_C=y | ||
CONFIG_MBEDTLS_SSL_PROTO_DTLS=y | ||
CONFIG_MBEDTLS_HKDF_C=y | ||
|
||
# MDNS platform | ||
CONFIG_USE_MINIMAL_MDNS=n | ||
CONFIG_ENABLE_EXTENDED_DISCOVERY=y | ||
CONFIG_MDNS_MULTIPLE_INSTANCE=y | ||
|
||
# Enable chip shell | ||
CONFIG_ENABLE_CHIP_SHELL=y | ||
CONFIG_ESP_MATTER_CONSOLE_TASK_STACK=4096 | ||
|
||
# Increase Stack size | ||
CONFIG_CHIP_TASK_STACK_SIZE=10240 | ||
CONFIG_ESP_MAIN_TASK_STACK_SIZE=8192 | ||
|
||
# Wi-Fi Settings | ||
CONFIG_ENABLE_WIFI_STATION=y | ||
CONFIG_ENABLE_WIFI_AP=n | ||
|
||
# Enable Controller and disable commissioner | ||
CONFIG_ESP_MATTER_CONTROLLER_ENABLE=y | ||
CONFIG_ESP_MATTER_COMMISSIONER_ENABLE=n | ||
CONFIG_ESP_MATTER_CONTROLLER_CUSTOM_CLUSTER_ENABLE=y | ||
CONFIG_USE_BLE_ONLY_FOR_COMMISSIONING=n | ||
|
||
# Use a custom partition table | ||
CONFIG_PARTITION_TABLE_CUSTOM=y | ||
CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="partitions_br.csv" | ||
|
||
# Disable chip test build | ||
CONFIG_BUILD_CHIP_TESTS=n | ||
|
||
# Disable OTA Requestor | ||
CONFIG_ENABLE_OTA_REQUESTOR=n | ||
|
||
# Use compact attribute storage mode | ||
CONFIG_ESP_MATTER_NVS_USE_COMPACT_ATTR_STORAGE=y | ||
|
||
# Disable route hook for matter since OTBR has already initialize the route hook | ||
CONFIG_ENABLE_ROUTE_HOOK=n | ||
|
||
CONFIG_OPENTHREAD_CLI=y | ||
|
||
# Use USB Jtag Console | ||
CONFIG_ESP_CONSOLE_USB_SERIAL_JTAG=y |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.