From 7b740b52d3f1b3a2cd2daf47de8a754cc540df1b Mon Sep 17 00:00:00 2001 From: Shubham Patil Date: Wed, 4 Sep 2024 08:01:31 +0530 Subject: [PATCH] [ESP32] Option to configure the pool allocation from heap (#30764) * [ESP32] Option to configure the system buffer pool allocation from heap * address reviews * minor adjustment to help text * some minor adjustments * Add notes regarding expected failures --- config/esp32/components/chip/Kconfig | 20 ++++++++++++++++++++ src/platform/ESP32/CHIPPlatformConfig.h | 6 ++++++ 2 files changed, 26 insertions(+) diff --git a/config/esp32/components/chip/Kconfig b/config/esp32/components/chip/Kconfig index a223e8323ed89a..096e3de95dd72d 100644 --- a/config/esp32/components/chip/Kconfig +++ b/config/esp32/components/chip/Kconfig @@ -157,6 +157,26 @@ menu "CHIP Core" help Option to enable/disable CHIP log level filtering APIs. + config CHIP_SYSTEM_CONFIG_POOL_USE_HEAP + bool "Use heap memory to allocate object pools" + default n + help + This option enables the use of heap memory to allocate object pools. + When enabled, object pools are not pre-allocated. + Additionally, the maximum number of entries that can be allocated is + only limited by the available heap memory. + + This option can be useful if you encounter static DRAM overflow. + + NOTE: Since there is no cap on pool sizes, this may lead to issues + where embedded code assumes the pool size is limited, and no other + mechanisms are in place to restrict the size of allocations. + + NOTE: If enabled and the free heap is exhausted, this may result in + undefined behavior, potential non-compliance with specifications, + or failure during certification tests. Even if it passes, it may fail + to function properly with actual controllers. + endmenu # "General Options" menu "Networking Options" diff --git a/src/platform/ESP32/CHIPPlatformConfig.h b/src/platform/ESP32/CHIPPlatformConfig.h index a086990bd2884f..5fb25370a507f3 100644 --- a/src/platform/ESP32/CHIPPlatformConfig.h +++ b/src/platform/ESP32/CHIPPlatformConfig.h @@ -133,3 +133,9 @@ #ifndef CHIP_CONFIG_RMP_DEFAULT_MAX_RETRANS #define CHIP_CONFIG_RMP_DEFAULT_MAX_RETRANS CONFIG_MRP_MAX_RETRANS #endif // CHIP_CONFIG_RMP_DEFAULT_MAX_RETRANS + +#ifdef CONFIG_CHIP_SYSTEM_CONFIG_POOL_USE_HEAP +#define CHIP_SYSTEM_CONFIG_POOL_USE_HEAP 1 +#else +#define CHIP_SYSTEM_CONFIG_POOL_USE_HEAP 0 +#endif