From 4b7c107b0ea3d9c5a3daa97d1560a96d0661e989 Mon Sep 17 00:00:00 2001 From: Chirag Atal Date: Wed, 14 Sep 2022 12:24:49 +0530 Subject: [PATCH 1/3] es32c2: Support for esp32c2 This includes some memory optimisations. Also corresponding changes required for idf 5.0. --- components/esp_matter/Kconfig | 24 ++++++++++ components/esp_matter/esp_matter_core.cpp | 2 +- .../zap_common/zap-generated/gen_config.h | 47 ++++++++++--------- .../button_driver/button/CMakeLists.txt | 4 ++ .../button_driver/button/include/button_adc.h | 9 +++- device_hal/device/esp32c2_devkit_m/device.c | 43 +++++++++++++++++ .../esp32c2_devkit_m/esp_matter_device.cmake | 11 +++++ device_hal/led_driver/hollow_led/led_driver.c | 2 +- .../main/zap-generated/endpoint_config.h | 3 +- .../main/zap-generated/endpoint_config.h | 3 +- .../main/zap-generated/endpoint_config.h | 3 +- .../main/zap-generated/endpoint_config.h | 3 +- 12 files changed, 124 insertions(+), 30 deletions(-) create mode 100644 device_hal/device/esp32c2_devkit_m/device.c create mode 100644 device_hal/device/esp32c2_devkit_m/esp_matter_device.cmake diff --git a/components/esp_matter/Kconfig b/components/esp_matter/Kconfig index 91f99e127..ab11aa5fe 100644 --- a/components/esp_matter/Kconfig +++ b/components/esp_matter/Kconfig @@ -36,4 +36,28 @@ menu "ESP Matter" endchoice + config ESP_MATTER_MAX_DYNAMIC_ENDPOINT_COUNT + int "Maximum dynamic endpoints" + default 16 + help + The maximum dynamic endpoints supported. + + config ESP_MATTER_SCENES_TABLE_SIZE + int "Scenes table size" + default 3 + help + Size of the scenes table. + + config ESP_MATTER_BINDING_TABLE_SIZE + int "Binding table size" + default 10 + help + Size of the binding table. + + config ESP_MATTER_UNICAST_MESSAGE_COUNT + int "Unicast message count" + default 10 + help + APS unicast message count. + endmenu diff --git a/components/esp_matter/esp_matter_core.cpp b/components/esp_matter/esp_matter_core.cpp index bd2de82a8..da82cf301 100644 --- a/components/esp_matter/esp_matter_core.cpp +++ b/components/esp_matter/esp_matter_core.cpp @@ -756,7 +756,7 @@ esp_err_t chip_stack_unlock() static void esp_matter_chip_init_task(intptr_t context) { - xTaskHandle task_to_notify = reinterpret_cast(context); + TaskHandle_t task_to_notify = reinterpret_cast(context); static chip::CommonCaseDeviceServerInitParams initParams; initParams.InitializeStaticResourcesBeforeServerInit(); diff --git a/components/esp_matter/zap_common/zap-generated/gen_config.h b/components/esp_matter/zap_common/zap-generated/gen_config.h index 323538260..ce2e0bc9c 100644 --- a/components/esp_matter/zap_common/zap-generated/gen_config.h +++ b/components/esp_matter/zap_common/zap-generated/gen_config.h @@ -20,13 +20,15 @@ // Prevent multiple inclusion #pragma once +#include + // User options for plugin Binding Table Library -#define EMBER_BINDING_TABLE_SIZE 10 +#define EMBER_BINDING_TABLE_SIZE CONFIG_ESP_MATTER_BINDING_TABLE_SIZE /**** Network Section ****/ #define EMBER_SUPPORTED_NETWORKS (1) -#define EMBER_APS_UNICAST_MESSAGE_COUNT 10 +#define EMBER_APS_UNICAST_MESSAGE_COUNT CONFIG_ESP_MATTER_UNICAST_MESSAGE_COUNT /* Cluster macros for all */ #define ZCL_USING_ACCESS_CONTROL_CLUSTER_SERVER @@ -167,25 +169,26 @@ /* Other cluster specific macros which are made generic */ -#define EMBER_AF_ACCOUNT_LOGIN_CLUSTER_SERVER_ENDPOINT_COUNT (16) // used in account login -#define EMBER_AF_APPLICATION_BASIC_CLUSTER_SERVER_ENDPOINT_COUNT (16) // used in application basic -#define EMBER_AF_APPLICATION_LAUNCHER_CLUSTER_SERVER_ENDPOINT_COUNT (16) // used in application launcher -#define EMBER_AF_AUDIO_OUTPUT_CLUSTER_SERVER_ENDPOINT_COUNT (16) // used in audio output -#define EMBER_AF_CHANNEL_CLUSTER_SERVER_ENDPOINT_COUNT (16) // used in channel -#define EMBER_AF_COLOR_CONTROL_CLUSTER_SERVER_ENDPOINT_COUNT (16) // used in color control -#define EMBER_AF_CONTENT_LAUNCHER_CLUSTER_SERVER_ENDPOINT_COUNT (16) // used in content launch -#define EMBER_AF_IDENTIFY_CLUSTER_SERVER_ENDPOINT_COUNT (16) // used in identify -#define EMBER_AF_KEYPAD_INPUT_CLUSTER_SERVER_ENDPOINT_COUNT (16) // used in keypad input -#define EMBER_AF_LEVEL_CONTROL_CLUSTER_SERVER_ENDPOINT_COUNT (16) // used in level control -#define EMBER_AF_LOW_POWER_CLUSTER_SERVER_ENDPOINT_COUNT (16) // used in low power -#define EMBER_AF_MEDIA_INPUT_CLUSTER_SERVER_ENDPOINT_COUNT (16) // used in media input -#define EMBER_AF_MEDIA_PLAYBACK_CLUSTER_SERVER_ENDPOINT_COUNT (16) // used in media playback -#define EMBER_AF_ON_OFF_CLUSTER_SERVER_ENDPOINT_COUNT (16) // used in on off -#define EMBER_AF_OTA_SOFTWARE_UPDATE_PROVIDER_CLUSTER_SERVER_ENDPOINT_COUNT (16) // used in ota software update provider -#define EMBER_AF_TARGET_NAVIGATOR_CLUSTER_SERVER_ENDPOINT_COUNT (16) // used in target navigator -#define EMBER_AF_WAKE_ON_LAN_CLUSTER_SERVER_ENDPOINT_COUNT (16) // used in wake on lan -#define EMBER_AF_WINDOW_COVERING_CLUSTER_SERVER_ENDPOINT_COUNT (16) // used in window covering -#define EMBER_AF_DOOR_LOCK_CLUSTER_SERVER_ENDPOINT_COUNT (16) // used in door lock +#define DYNAMIC_ENDPOINTS CONFIG_ESP_MATTER_MAX_DYNAMIC_ENDPOINT_COUNT +#define EMBER_AF_ACCOUNT_LOGIN_CLUSTER_SERVER_ENDPOINT_COUNT DYNAMIC_ENDPOINTS // used in account login +#define EMBER_AF_APPLICATION_BASIC_CLUSTER_SERVER_ENDPOINT_COUNT DYNAMIC_ENDPOINTS // used in application basic +#define EMBER_AF_APPLICATION_LAUNCHER_CLUSTER_SERVER_ENDPOINT_COUNT DYNAMIC_ENDPOINTS // used in application launcher +#define EMBER_AF_AUDIO_OUTPUT_CLUSTER_SERVER_ENDPOINT_COUNT DYNAMIC_ENDPOINTS // used in audio output +#define EMBER_AF_CHANNEL_CLUSTER_SERVER_ENDPOINT_COUNT DYNAMIC_ENDPOINTS // used in channel +#define EMBER_AF_COLOR_CONTROL_CLUSTER_SERVER_ENDPOINT_COUNT DYNAMIC_ENDPOINTS // used in color control +#define EMBER_AF_CONTENT_LAUNCHER_CLUSTER_SERVER_ENDPOINT_COUNT DYNAMIC_ENDPOINTS // used in content launch +#define EMBER_AF_IDENTIFY_CLUSTER_SERVER_ENDPOINT_COUNT DYNAMIC_ENDPOINTS // used in identify +#define EMBER_AF_KEYPAD_INPUT_CLUSTER_SERVER_ENDPOINT_COUNT DYNAMIC_ENDPOINTS // used in keypad input +#define EMBER_AF_LEVEL_CONTROL_CLUSTER_SERVER_ENDPOINT_COUNT DYNAMIC_ENDPOINTS // used in level control +#define EMBER_AF_LOW_POWER_CLUSTER_SERVER_ENDPOINT_COUNT DYNAMIC_ENDPOINTS // used in low power +#define EMBER_AF_MEDIA_INPUT_CLUSTER_SERVER_ENDPOINT_COUNT DYNAMIC_ENDPOINTS // used in media input +#define EMBER_AF_MEDIA_PLAYBACK_CLUSTER_SERVER_ENDPOINT_COUNT DYNAMIC_ENDPOINTS // used in media playback +#define EMBER_AF_ON_OFF_CLUSTER_SERVER_ENDPOINT_COUNT DYNAMIC_ENDPOINTS // used in on off +#define EMBER_AF_OTA_SOFTWARE_UPDATE_PROVIDER_CLUSTER_SERVER_ENDPOINT_COUNT DYNAMIC_ENDPOINTS // used in ota software update provider +#define EMBER_AF_TARGET_NAVIGATOR_CLUSTER_SERVER_ENDPOINT_COUNT DYNAMIC_ENDPOINTS // used in target navigator +#define EMBER_AF_WAKE_ON_LAN_CLUSTER_SERVER_ENDPOINT_COUNT DYNAMIC_ENDPOINTS // used in wake on lan +#define EMBER_AF_WINDOW_COVERING_CLUSTER_SERVER_ENDPOINT_COUNT DYNAMIC_ENDPOINTS // used in window covering +#define EMBER_AF_DOOR_LOCK_CLUSTER_SERVER_ENDPOINT_COUNT DYNAMIC_ENDPOINTS // used in door lock -#define MATTER_SCENES_TABLE_SIZE 3 // used in scenes // TODO: check this again +#define MATTER_SCENES_TABLE_SIZE CONFIG_ESP_MATTER_SCENES_TABLE_SIZE // used in scenes // TODO: check this again diff --git a/device_hal/button_driver/button/CMakeLists.txt b/device_hal/button_driver/button/CMakeLists.txt index a856f57ff..1c3aee617 100644 --- a/device_hal/button_driver/button/CMakeLists.txt +++ b/device_hal/button_driver/button/CMakeLists.txt @@ -3,6 +3,10 @@ include($ENV{ESP_MATTER_DEVICE_PATH}/esp_matter_device.cmake) set(src_dirs ) set(requires driver) +if("${IDF_VERSION_MAJOR}.${IDF_VERSION_MINOR}" VERSION_GREATER_EQUAL "5.0") + list(APPEND requires esp_adc) +endif() + if ("${button_type}" STREQUAL "hollow_button") list(APPEND src_dirs hollow_button) endif() diff --git a/device_hal/button_driver/button/include/button_adc.h b/device_hal/button_driver/button/include/button_adc.h index f1b004106..6e5be6ea4 100644 --- a/device_hal/button_driver/button/include/button_adc.h +++ b/device_hal/button_driver/button/include/button_adc.h @@ -15,7 +15,12 @@ #define _IOT_BUTTON_ADC_H_ #include "driver/gpio.h" +#include +#if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(5, 0, 0) +#include "esp_adc/adc_continuous.h" +#else #include "driver/adc.h" +#endif #ifdef __cplusplus extern "C" { @@ -30,7 +35,7 @@ extern "C" { * */ typedef struct { - adc1_channel_t adc_channel; /**< Channel of ADC */ + adc_channel_t adc_channel; /**< Channel of ADC */ uint8_t button_index; /**< button index on the channel */ uint16_t min; /**< min voltage in mv corresponding to the button */ uint16_t max; /**< max voltage in mv corresponding to the button */ @@ -59,7 +64,7 @@ esp_err_t button_adc_init(const button_adc_config_t *config); * - ESP_OK on success * - ESP_ERR_INVALID_ARG Arguments is invalid. */ -esp_err_t button_adc_deinit(adc1_channel_t channel, int button_index); +esp_err_t button_adc_deinit(adc_channel_t channel, int button_index); /** * @brief Get the adc button level diff --git a/device_hal/device/esp32c2_devkit_m/device.c b/device_hal/device/esp32c2_devkit_m/device.c new file mode 100644 index 000000000..fa8e7d1b3 --- /dev/null +++ b/device_hal/device/esp32c2_devkit_m/device.c @@ -0,0 +1,43 @@ +// Copyright 2021 Espressif Systems (Shanghai) CO LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License + +#include +#include +#include + +#define LED_GPIO_PIN GPIO_NUM_8 +#define LED_CHANNEL 0 /* RMT_CHANNEL_0 */ +#define BUTTON_GPIO_PIN GPIO_NUM_9 + +static const char *TAG = "device"; + +led_driver_config_t led_driver_get_config() +{ + led_driver_config_t config = { + .gpio = LED_GPIO_PIN, + .channel = LED_CHANNEL, + }; + return config; +} + +button_config_t button_driver_get_config() +{ + button_config_t config = { + .type = BUTTON_TYPE_GPIO, + .gpio_button_config = { + .gpio_num = BUTTON_GPIO_PIN, + .active_level = 0, + } + }; + return config; +} diff --git a/device_hal/device/esp32c2_devkit_m/esp_matter_device.cmake b/device_hal/device/esp32c2_devkit_m/esp_matter_device.cmake new file mode 100644 index 000000000..5348059d3 --- /dev/null +++ b/device_hal/device/esp32c2_devkit_m/esp_matter_device.cmake @@ -0,0 +1,11 @@ +cmake_minimum_required(VERSION 3.5) +if (NOT ("${IDF_TARGET}" STREQUAL "esp32c2" )) + message(FATAL_ERROR "please set esp32c2 as the IDF_TARGET using 'idf.py set-target esp32c2'") +endif() + +SET(device_type esp32c2_devkit_m) +SET(led_type gpio) +SET(button_type hollow_button) + +SET(extra_components_dirs_append "$ENV{ESP_MATTER_DEVICE_PATH}/../../led_driver" + "$ENV{ESP_MATTER_DEVICE_PATH}/../../button_driver/button") diff --git a/device_hal/led_driver/hollow_led/led_driver.c b/device_hal/led_driver/hollow_led/led_driver.c index ecca5f466..1bf9921db 100644 --- a/device_hal/led_driver/hollow_led/led_driver.c +++ b/device_hal/led_driver/hollow_led/led_driver.c @@ -59,7 +59,7 @@ esp_err_t led_driver_set_saturation(led_driver_handle_t handle, uint8_t saturati esp_err_t led_driver_set_temperature(led_driver_handle_t handle, uint32_t temperature) { - ESP_LOGI(TAG, "Setting temperature to: %d", temperature); + ESP_LOGI(TAG, "Setting temperature to: %lu", temperature); /* Set the color temp here*/ return ESP_OK; diff --git a/examples/blemesh_bridge/main/zap-generated/endpoint_config.h b/examples/blemesh_bridge/main/zap-generated/endpoint_config.h index cfd7f6fc1..caafa958e 100644 --- a/examples/blemesh_bridge/main/zap-generated/endpoint_config.h +++ b/examples/blemesh_bridge/main/zap-generated/endpoint_config.h @@ -21,6 +21,7 @@ #pragma once #include +#include #define GENERATED_ATTRIBUTES \ {} @@ -46,7 +47,7 @@ static_assert(ATTRIBUTE_LARGEST <= CHIP_CONFIG_MAX_ATTRIBUTE_STORE_ELEMENT_SIZE, #ifdef CHIP_DEVICE_CONFIG_DYNAMIC_ENDPOINT_COUNT #undef CHIP_DEVICE_CONFIG_DYNAMIC_ENDPOINT_COUNT #endif -#define CHIP_DEVICE_CONFIG_DYNAMIC_ENDPOINT_COUNT (16) +#define CHIP_DEVICE_CONFIG_DYNAMIC_ENDPOINT_COUNT CONFIG_ESP_MATTER_MAX_DYNAMIC_ENDPOINT_COUNT // Array of endpoints that are supported, the data inside // the array is the endpoint number. diff --git a/examples/light/main/zap-generated/endpoint_config.h b/examples/light/main/zap-generated/endpoint_config.h index cfd7f6fc1..caafa958e 100644 --- a/examples/light/main/zap-generated/endpoint_config.h +++ b/examples/light/main/zap-generated/endpoint_config.h @@ -21,6 +21,7 @@ #pragma once #include +#include #define GENERATED_ATTRIBUTES \ {} @@ -46,7 +47,7 @@ static_assert(ATTRIBUTE_LARGEST <= CHIP_CONFIG_MAX_ATTRIBUTE_STORE_ELEMENT_SIZE, #ifdef CHIP_DEVICE_CONFIG_DYNAMIC_ENDPOINT_COUNT #undef CHIP_DEVICE_CONFIG_DYNAMIC_ENDPOINT_COUNT #endif -#define CHIP_DEVICE_CONFIG_DYNAMIC_ENDPOINT_COUNT (16) +#define CHIP_DEVICE_CONFIG_DYNAMIC_ENDPOINT_COUNT CONFIG_ESP_MATTER_MAX_DYNAMIC_ENDPOINT_COUNT // Array of endpoints that are supported, the data inside // the array is the endpoint number. diff --git a/examples/light_switch/main/zap-generated/endpoint_config.h b/examples/light_switch/main/zap-generated/endpoint_config.h index cfd7f6fc1..caafa958e 100644 --- a/examples/light_switch/main/zap-generated/endpoint_config.h +++ b/examples/light_switch/main/zap-generated/endpoint_config.h @@ -21,6 +21,7 @@ #pragma once #include +#include #define GENERATED_ATTRIBUTES \ {} @@ -46,7 +47,7 @@ static_assert(ATTRIBUTE_LARGEST <= CHIP_CONFIG_MAX_ATTRIBUTE_STORE_ELEMENT_SIZE, #ifdef CHIP_DEVICE_CONFIG_DYNAMIC_ENDPOINT_COUNT #undef CHIP_DEVICE_CONFIG_DYNAMIC_ENDPOINT_COUNT #endif -#define CHIP_DEVICE_CONFIG_DYNAMIC_ENDPOINT_COUNT (16) +#define CHIP_DEVICE_CONFIG_DYNAMIC_ENDPOINT_COUNT CONFIG_ESP_MATTER_MAX_DYNAMIC_ENDPOINT_COUNT // Array of endpoints that are supported, the data inside // the array is the endpoint number. diff --git a/examples/zigbee_bridge/main/zap-generated/endpoint_config.h b/examples/zigbee_bridge/main/zap-generated/endpoint_config.h index cfd7f6fc1..caafa958e 100644 --- a/examples/zigbee_bridge/main/zap-generated/endpoint_config.h +++ b/examples/zigbee_bridge/main/zap-generated/endpoint_config.h @@ -21,6 +21,7 @@ #pragma once #include +#include #define GENERATED_ATTRIBUTES \ {} @@ -46,7 +47,7 @@ static_assert(ATTRIBUTE_LARGEST <= CHIP_CONFIG_MAX_ATTRIBUTE_STORE_ELEMENT_SIZE, #ifdef CHIP_DEVICE_CONFIG_DYNAMIC_ENDPOINT_COUNT #undef CHIP_DEVICE_CONFIG_DYNAMIC_ENDPOINT_COUNT #endif -#define CHIP_DEVICE_CONFIG_DYNAMIC_ENDPOINT_COUNT (16) +#define CHIP_DEVICE_CONFIG_DYNAMIC_ENDPOINT_COUNT CONFIG_ESP_MATTER_MAX_DYNAMIC_ENDPOINT_COUNT // Array of endpoints that are supported, the data inside // the array is the endpoint number. From 22b6f8ca09865854f5ab5a42a25f082364accf9a Mon Sep 17 00:00:00 2001 From: Shubham Patil Date: Fri, 3 Feb 2023 19:16:59 +0530 Subject: [PATCH 2/3] Changes in examples for C2 --- examples/generic_switch/CMakeLists.txt | 2 ++ .../generic_switch/sdkconfig.defaults.esp32c2 | 19 +++++++++++++++++++ examples/light/CMakeLists.txt | 2 ++ examples/light/sdkconfig.defaults.esp32c2 | 19 +++++++++++++++++++ examples/light_switch/CMakeLists.txt | 2 ++ .../light_switch/sdkconfig.defaults.esp32c2 | 19 +++++++++++++++++++ 6 files changed, 63 insertions(+) create mode 100644 examples/generic_switch/sdkconfig.defaults.esp32c2 create mode 100644 examples/light/sdkconfig.defaults.esp32c2 create mode 100644 examples/light_switch/sdkconfig.defaults.esp32c2 diff --git a/examples/generic_switch/CMakeLists.txt b/examples/generic_switch/CMakeLists.txt index 8b743418c..036db1b6a 100644 --- a/examples/generic_switch/CMakeLists.txt +++ b/examples/generic_switch/CMakeLists.txt @@ -11,6 +11,8 @@ if(NOT DEFINED ENV{ESP_MATTER_DEVICE_PATH}) set(ENV{ESP_MATTER_DEVICE_PATH} $ENV{ESP_MATTER_PATH}/device_hal/device/esp32_devkit_c) elseif("${IDF_TARGET}" STREQUAL "esp32c3") set(ENV{ESP_MATTER_DEVICE_PATH} $ENV{ESP_MATTER_PATH}/device_hal/device/esp32c3_devkit_m) + elseif("${IDF_TARGET}" STREQUAL "esp32c2") + set(ENV{ESP_MATTER_DEVICE_PATH} $ENV{ESP_MATTER_PATH}/device_hal/device/esp32c2_devkit_m) elseif("${IDF_TARGET}" STREQUAL "esp32h2") set(ENV{ESP_MATTER_DEVICE_PATH} $ENV{ESP_MATTER_PATH}/device_hal/device/esp32h2_devkit_c) elseif("${IDF_TARGET}" STREQUAL "esp32s3") diff --git a/examples/generic_switch/sdkconfig.defaults.esp32c2 b/examples/generic_switch/sdkconfig.defaults.esp32c2 new file mode 100644 index 000000000..6cb90db4f --- /dev/null +++ b/examples/generic_switch/sdkconfig.defaults.esp32c2 @@ -0,0 +1,19 @@ +# Disable chip shell +CONFIG_ENABLE_CHIP_SHELL=n + +# CONFIG_ESP32_WIFI_IRAM_OPT is not set +# CONFIG_ESP32_WIFI_RX_IRAM_OPT is not set +CONFIG_FREERTOS_PLACE_FUNCTIONS_INTO_FLASH=y +CONFIG_FREERTOS_PLACE_SNAPSHOT_FUNS_INTO_FLASH=y + +CONFIG_COMPILER_OPTIMIZATION_ASSERTIONS_DISABLE=y + +CONFIG_LWIP_TCPIP_RECVMBOX_SIZE=16 +CONFIG_LWIP_TCP_RECVMBOX_SIZE=8 + +CONFIG_BT_NIMBLE_ROLE_CENTRAL=n +CONFIG_BT_NIMBLE_ROLE_OBSERVER=n + +CONFIG_ESP32_WIFI_STATIC_RX_BUFFER_NUM=4 +CONFIG_ESP32_WIFI_DYNAMIC_RX_BUFFER_NUM=8 +CONFIG_ESP32_WIFI_DYNAMIC_TX_BUFFER_NUM=16 diff --git a/examples/light/CMakeLists.txt b/examples/light/CMakeLists.txt index d14fc991e..525f54bfe 100644 --- a/examples/light/CMakeLists.txt +++ b/examples/light/CMakeLists.txt @@ -11,6 +11,8 @@ if(NOT DEFINED ENV{ESP_MATTER_DEVICE_PATH}) set(ENV{ESP_MATTER_DEVICE_PATH} $ENV{ESP_MATTER_PATH}/device_hal/device/esp32_devkit_c) elseif("${IDF_TARGET}" STREQUAL "esp32c3") set(ENV{ESP_MATTER_DEVICE_PATH} $ENV{ESP_MATTER_PATH}/device_hal/device/esp32c3_devkit_m) + elseif("${IDF_TARGET}" STREQUAL "esp32c2") + set(ENV{ESP_MATTER_DEVICE_PATH} $ENV{ESP_MATTER_PATH}/device_hal/device/esp32c2_devkit_m) elseif("${IDF_TARGET}" STREQUAL "esp32h2") set(ENV{ESP_MATTER_DEVICE_PATH} $ENV{ESP_MATTER_PATH}/device_hal/device/esp32h2_devkit_c) elseif("${IDF_TARGET}" STREQUAL "esp32s3") diff --git a/examples/light/sdkconfig.defaults.esp32c2 b/examples/light/sdkconfig.defaults.esp32c2 new file mode 100644 index 000000000..6cb90db4f --- /dev/null +++ b/examples/light/sdkconfig.defaults.esp32c2 @@ -0,0 +1,19 @@ +# Disable chip shell +CONFIG_ENABLE_CHIP_SHELL=n + +# CONFIG_ESP32_WIFI_IRAM_OPT is not set +# CONFIG_ESP32_WIFI_RX_IRAM_OPT is not set +CONFIG_FREERTOS_PLACE_FUNCTIONS_INTO_FLASH=y +CONFIG_FREERTOS_PLACE_SNAPSHOT_FUNS_INTO_FLASH=y + +CONFIG_COMPILER_OPTIMIZATION_ASSERTIONS_DISABLE=y + +CONFIG_LWIP_TCPIP_RECVMBOX_SIZE=16 +CONFIG_LWIP_TCP_RECVMBOX_SIZE=8 + +CONFIG_BT_NIMBLE_ROLE_CENTRAL=n +CONFIG_BT_NIMBLE_ROLE_OBSERVER=n + +CONFIG_ESP32_WIFI_STATIC_RX_BUFFER_NUM=4 +CONFIG_ESP32_WIFI_DYNAMIC_RX_BUFFER_NUM=8 +CONFIG_ESP32_WIFI_DYNAMIC_TX_BUFFER_NUM=16 diff --git a/examples/light_switch/CMakeLists.txt b/examples/light_switch/CMakeLists.txt index e1cfea8ca..4ad887e47 100644 --- a/examples/light_switch/CMakeLists.txt +++ b/examples/light_switch/CMakeLists.txt @@ -11,6 +11,8 @@ if(NOT DEFINED ENV{ESP_MATTER_DEVICE_PATH}) set(ENV{ESP_MATTER_DEVICE_PATH} $ENV{ESP_MATTER_PATH}/device_hal/device/esp32_devkit_c) elseif("${IDF_TARGET}" STREQUAL "esp32c3") set(ENV{ESP_MATTER_DEVICE_PATH} $ENV{ESP_MATTER_PATH}/device_hal/device/esp32c3_devkit_m) + elseif("${IDF_TARGET}" STREQUAL "esp32c2") + set(ENV{ESP_MATTER_DEVICE_PATH} $ENV{ESP_MATTER_PATH}/device_hal/device/esp32c2_devkit_m) elseif("${IDF_TARGET}" STREQUAL "esp32h2") set(ENV{ESP_MATTER_DEVICE_PATH} $ENV{ESP_MATTER_PATH}/device_hal/device/esp32h2_devkit_c) else() diff --git a/examples/light_switch/sdkconfig.defaults.esp32c2 b/examples/light_switch/sdkconfig.defaults.esp32c2 new file mode 100644 index 000000000..6cb90db4f --- /dev/null +++ b/examples/light_switch/sdkconfig.defaults.esp32c2 @@ -0,0 +1,19 @@ +# Disable chip shell +CONFIG_ENABLE_CHIP_SHELL=n + +# CONFIG_ESP32_WIFI_IRAM_OPT is not set +# CONFIG_ESP32_WIFI_RX_IRAM_OPT is not set +CONFIG_FREERTOS_PLACE_FUNCTIONS_INTO_FLASH=y +CONFIG_FREERTOS_PLACE_SNAPSHOT_FUNS_INTO_FLASH=y + +CONFIG_COMPILER_OPTIMIZATION_ASSERTIONS_DISABLE=y + +CONFIG_LWIP_TCPIP_RECVMBOX_SIZE=16 +CONFIG_LWIP_TCP_RECVMBOX_SIZE=8 + +CONFIG_BT_NIMBLE_ROLE_CENTRAL=n +CONFIG_BT_NIMBLE_ROLE_OBSERVER=n + +CONFIG_ESP32_WIFI_STATIC_RX_BUFFER_NUM=4 +CONFIG_ESP32_WIFI_DYNAMIC_RX_BUFFER_NUM=8 +CONFIG_ESP32_WIFI_DYNAMIC_TX_BUFFER_NUM=16 From 9ae68ec1c6ef64b0644b9334108caf1299a0d4c8 Mon Sep 17 00:00:00 2001 From: Shubham Patil Date: Mon, 6 Feb 2023 12:08:54 +0530 Subject: [PATCH 3/3] Specify route_hook in ESP32_custom platforms BUILD.gn --- examples/blemesh_bridge/platform/ESP32_custom/BUILD.gn | 4 ++++ examples/blemesh_bridge/platform/ESP32_custom/route_hook | 1 + 2 files changed, 5 insertions(+) create mode 120000 examples/blemesh_bridge/platform/ESP32_custom/route_hook diff --git a/examples/blemesh_bridge/platform/ESP32_custom/BUILD.gn b/examples/blemesh_bridge/platform/ESP32_custom/BUILD.gn index 4e4e4430f..d71cde3ca 100644 --- a/examples/blemesh_bridge/platform/ESP32_custom/BUILD.gn +++ b/examples/blemesh_bridge/platform/ESP32_custom/BUILD.gn @@ -129,6 +129,10 @@ static_library("ESP32_custom") { "ConnectivityManagerImpl_WiFi.cpp", "NetworkCommissioningDriver.cpp", "NetworkCommissioningDriver.h", + "route_hook/ESP32RouteHook.c", + "route_hook/ESP32RouteHook.h", + "route_hook/ESP32RouteTable.c", + "route_hook/ESP32RouteTable.h", ] if (chip_mdns == "platform") { sources += [ diff --git a/examples/blemesh_bridge/platform/ESP32_custom/route_hook b/examples/blemesh_bridge/platform/ESP32_custom/route_hook new file mode 120000 index 000000000..1516f3684 --- /dev/null +++ b/examples/blemesh_bridge/platform/ESP32_custom/route_hook @@ -0,0 +1 @@ +../../../../connectedhomeip/connectedhomeip/src/platform/ESP32/route_hook \ No newline at end of file