diff --git a/config/esp32/components/chip/CMakeLists.txt b/config/esp32/components/chip/CMakeLists.txt index aa803be4361a34..41138138d4d0c1 100644 --- a/config/esp32/components/chip/CMakeLists.txt +++ b/config/esp32/components/chip/CMakeLists.txt @@ -435,6 +435,8 @@ if(CONFIG_BT_ENABLED) idf_component_get_property(bt_dir bt COMPONENT_DIR) list(APPEND chip_libraries $) list(APPEND chip_libraries "${bt_dir}/controller/lib_${target_name}/${target_name}-bt-lib/libble_app.a") + elseif(target_name STREQUAL "esp32p4") + list(APPEND chip_libraries $) else() list(APPEND chip_libraries $ -lbtdm_app) endif() @@ -513,11 +515,12 @@ endif() idf_component_get_property(lwip_lib lwip COMPONENT_LIB) list(APPEND chip_libraries $) - -if (CONFIG_ESP32_WIFI_ENABLED) +if (CONFIG_ESP32_WIFI_ENABLED OR CONFIG_IDF_TARGET_ESP32P4) idf_component_get_property(esp_wifi_lib esp_wifi COMPONENT_LIB) - idf_component_get_property(esp_wifi_dir esp_wifi COMPONENT_DIR) list(APPEND chip_libraries $) +endif() +if (CONFIG_ESP32_WIFI_ENABLED) + idf_component_get_property(esp_wifi_dir esp_wifi COMPONENT_DIR) if (CONFIG_IDF_TARGET_ESP32C2) set(blobs core net80211 pp) else() @@ -543,6 +546,7 @@ list(APPEND chip_libraries $) idf_component_get_property(esp_hw_support_lib esp_hw_support COMPONENT_LIB) list(APPEND chip_libraries $) +if (NOT CONFIG_IDF_TARGET_ESP32P4) idf_component_get_property(esp_phy_lib esp_phy COMPONENT_LIB) idf_component_get_property(esp_phy_dir esp_phy COMPONENT_DIR) list(APPEND chip_libraries $) @@ -557,8 +561,12 @@ endif() foreach(phy_blob ${phy_blobs}) list(APPEND chip_libraries "${esp_phy_dir}/lib/${target_name}/lib${phy_blob}.a") endforeach() +endif() -set(components_to_link esp_event hal esp_system soc efuse vfs driver esp_coex freertos esp_timer) +set(components_to_link esp_event hal esp_system soc efuse vfs driver freertos esp_timer) +if (NOT CONFIG_IDF_TARGET_ESP32P4) +list(APPEND components_to_link esp_coex) +endif() idf_build_get_property(build_components BUILD_COMPONENTS) foreach(component ${components_to_link}) # Some of the components are not present in IDF v4.x diff --git a/config/esp32/components/chip/idf_component.yml b/config/esp32/components/chip/idf_component.yml index 2662ad5eb7ef22..78d21af787c631 100644 --- a/config/esp32/components/chip/idf_component.yml +++ b/config/esp32/components/chip/idf_component.yml @@ -36,3 +36,8 @@ dependencies: require: public rules: - if: "idf_version >=4.3" + + espressif/esp_wifi_remote: + version: ">=0.1.12" + rules: + - if: "target in [esp32p4]" diff --git a/examples/all-clusters-app/esp32/main/Kconfig.projbuild b/examples/all-clusters-app/esp32/main/Kconfig.projbuild index 2cec0c32093734..72807a1618632a 100644 --- a/examples/all-clusters-app/esp32/main/Kconfig.projbuild +++ b/examples/all-clusters-app/esp32/main/Kconfig.projbuild @@ -26,6 +26,7 @@ menu "Demo" default DEVICE_TYPE_ESP32_C3_DEVKITM if IDF_TARGET_ESP32C3 default DEVICE_TYPE_ESP32_C2_DEVKITM if IDF_TARGET_ESP32C2 default DEVICE_TYPE_ESP32_C6_DEVKITC if IDF_TARGET_ESP32C6 + default DEVICE_TYPE_ESP32_P4_FUNCTION_EV_BOARD if IDF_TARGET_ESP32P4 help Specifies the type of ESP32 device. @@ -57,6 +58,9 @@ menu "Demo" config DEVICE_TYPE_ESP32_H2_DEVKITM bool "ESP32H2-DevKitM" depends on IDF_TARGET_ESP32H2 + config DEVICE_TYPE_ESP32_P4_FUNCTION_EV_BOARD + bool "ESP32P4 Function EV Board" + depends on IDF_TARGET_ESP32P4 endchoice choice @@ -87,7 +91,7 @@ menu "Demo" config TFT_PREDEFINED_DISPLAY_TYPE int range 0 5 - default 0 if DEVICE_TYPE_ESP32_DEVKITC || DEVICE_TYPE_ESP32_H2_DEVKITM + default 0 if DEVICE_TYPE_ESP32_DEVKITC || DEVICE_TYPE_ESP32_H2_DEVKITM || DEVICE_TYPE_ESP32_P4_FUNCTION_EV_BOARD default 0 if DEVICE_TYPE_ESP32_C3_DEVKITM || DEVICE_TYPE_ESP32_C2_DEVKITM || DEVICE_TYPE_ESP32_C6_DEVKITC default 3 if DEVICE_TYPE_M5STACK default 4 if DEVICE_TYPE_ESP32_WROVER_KIT @@ -118,7 +122,7 @@ menu "Demo" range 0 40 default 2 if DEVICE_TYPE_ESP32_DEVKITC #Use LED1 (blue LED) as status LED on DevKitC default 2 if DEVICE_TYPE_ESP32_ETHERNET_KIT - default 8 if DEVICE_TYPE_ESP32_C3_DEVKITM || DEVICE_TYPE_ESP32_C2_DEVKITM || DEVICE_TYPE_ESP32_C6_DEVKITC || DEVICE_TYPE_ESP32_H2_DEVKITM + default 8 if DEVICE_TYPE_ESP32_C3_DEVKITM || DEVICE_TYPE_ESP32_C2_DEVKITM || DEVICE_TYPE_ESP32_C6_DEVKITC || DEVICE_TYPE_ESP32_H2_DEVKITM || DEVICE_TYPE_ESP32_P4_FUNCTION_EV_BOARD default 26 if DEVICE_TYPE_ESP32_WROVER_KIT default 40 if DEVICE_TYPE_M5STACK help diff --git a/examples/all-clusters-app/esp32/sdkconfig.defaults.esp32p4 b/examples/all-clusters-app/esp32/sdkconfig.defaults.esp32p4 new file mode 100644 index 00000000000000..3211b306b2be99 --- /dev/null +++ b/examples/all-clusters-app/esp32/sdkconfig.defaults.esp32p4 @@ -0,0 +1,37 @@ +CONFIG_IDF_TARGET="esp32p4" + +# Flash size and partition +CONFIG_ESPTOOLPY_FLASHSIZE_4MB=y +CONFIG_PARTITION_TABLE_CUSTOM=y +CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="partitions.csv" + +# Enable BLE Host but use remote controller +CONFIG_BT_ENABLED=y +CONFIG_BT_NIMBLE_ENABLED=y +CONFIG_BT_NIMBLE_TRANSPORT_UART=n +CONFIG_ESP_ENABLE_BT=y + +# Increase main task stack size +CONFIG_ESP_MAIN_TASK_STACK_SIZE=4096 + +# Disable Wi-Fi Soft AP +CONFIG_ESP_WIFI_SOFTAP_SUPPORT=n + +# LwIP +CONFIG_LWIP_IPV6_AUTOCONFIG=y +CONFIG_LWIP_IPV6_NUM_ADDRESSES=6 + +# mbedtls +CONFIG_MBEDTLS_HKDF_C=y + +# Matter shell +CONFIG_ENABLE_CHIP_SHELL=y + +# OTA requestor +CONFIG_ENABLE_OTA_REQUESTOR=y + +# Do not deinit BLE after commissioning +CONFIG_USE_BLE_ONLY_FOR_COMMISSIONING=n + +# ESP32-P4 Function EV Board use ESP32C6 as slave device +CONFIG_SLAVE_IDF_TARGET_ESP32C6=y diff --git a/examples/lighting-app/esp32/sdkconfig.defaults.esp32p4 b/examples/lighting-app/esp32/sdkconfig.defaults.esp32p4 new file mode 100644 index 00000000000000..3211b306b2be99 --- /dev/null +++ b/examples/lighting-app/esp32/sdkconfig.defaults.esp32p4 @@ -0,0 +1,37 @@ +CONFIG_IDF_TARGET="esp32p4" + +# Flash size and partition +CONFIG_ESPTOOLPY_FLASHSIZE_4MB=y +CONFIG_PARTITION_TABLE_CUSTOM=y +CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="partitions.csv" + +# Enable BLE Host but use remote controller +CONFIG_BT_ENABLED=y +CONFIG_BT_NIMBLE_ENABLED=y +CONFIG_BT_NIMBLE_TRANSPORT_UART=n +CONFIG_ESP_ENABLE_BT=y + +# Increase main task stack size +CONFIG_ESP_MAIN_TASK_STACK_SIZE=4096 + +# Disable Wi-Fi Soft AP +CONFIG_ESP_WIFI_SOFTAP_SUPPORT=n + +# LwIP +CONFIG_LWIP_IPV6_AUTOCONFIG=y +CONFIG_LWIP_IPV6_NUM_ADDRESSES=6 + +# mbedtls +CONFIG_MBEDTLS_HKDF_C=y + +# Matter shell +CONFIG_ENABLE_CHIP_SHELL=y + +# OTA requestor +CONFIG_ENABLE_OTA_REQUESTOR=y + +# Do not deinit BLE after commissioning +CONFIG_USE_BLE_ONLY_FOR_COMMISSIONING=n + +# ESP32-P4 Function EV Board use ESP32C6 as slave device +CONFIG_SLAVE_IDF_TARGET_ESP32C6=y diff --git a/examples/platform/esp32/common/Esp32AppServer.cpp b/examples/platform/esp32/common/Esp32AppServer.cpp index 37dd7f4fe4adcf..8740f39cdbc080 100644 --- a/examples/platform/esp32/common/Esp32AppServer.cpp +++ b/examples/platform/esp32/common/Esp32AppServer.cpp @@ -40,18 +40,6 @@ #include #endif -#if CHIP_DEVICE_CONFIG_ENABLE_CHIPOBLE -#if CONFIG_BT_ENABLED -#include "esp_bt.h" -#if CONFIG_BT_NIMBLE_ENABLED -#if ESP_IDF_VERSION < ESP_IDF_VERSION_VAL(5, 0, 0) -#include "esp_nimble_hci.h" -#endif // ESP_IDF_VERSION < ESP_IDF_VERSION_VAL(5, 0, 0) -#include "nimble/nimble_port.h" -#endif // CONFIG_BT_NIMBLE_ENABLED -#endif // CONFIG_BT_ENABLED -#endif // CHIP_DEVICE_CONFIG_ENABLE_CHIPOBLE - #ifdef CONFIG_ENABLE_CHIP_SHELL #include #endif diff --git a/src/platform/ESP32/ConfigurationManagerImpl.cpp b/src/platform/ESP32/ConfigurationManagerImpl.cpp index 78446432c58b0a..00b07420704f5d 100644 --- a/src/platform/ESP32/ConfigurationManagerImpl.cpp +++ b/src/platform/ESP32/ConfigurationManagerImpl.cpp @@ -36,7 +36,9 @@ #include "esp_mac.h" #endif #include "esp_ota_ops.h" +#ifndef CONFIG_IDF_TARGET_ESP32P4 #include "esp_phy_init.h" +#endif #include "esp_wifi.h" #include "nvs.h" #include "nvs_flash.h" diff --git a/src/platform/ESP32/nimble/BLEManagerImpl.cpp b/src/platform/ESP32/nimble/BLEManagerImpl.cpp index ff48f5d9d6aa78..176fd81ee9f2c9 100644 --- a/src/platform/ESP32/nimble/BLEManagerImpl.cpp +++ b/src/platform/ESP32/nimble/BLEManagerImpl.cpp @@ -48,7 +48,9 @@ #include #include +#ifndef CONFIG_IDF_TARGET_ESP32P4 #include "esp_bt.h" +#endif #include "esp_log.h" #if ESP_IDF_VERSION < ESP_IDF_VERSION_VAL(5, 0, 0) @@ -1021,6 +1023,11 @@ CHIP_ERROR BLEManagerImpl::DeinitBLE() return MapBLEError(err); } +#ifdef CONFIG_IDF_TARGET_ESP32P4 +// Stub function to avoid link error +extern "C" void ble_transport_ll_deinit(void) {} +#endif + CHIP_ERROR BLEManagerImpl::ConfigureAdvertisingData(void) { CHIP_ERROR err;