Skip to content

Commit

Permalink
[ESP32] Option to configure the pool allocation from heap (#30764)
Browse files Browse the repository at this point in the history
* [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
  • Loading branch information
shubhamdp authored and shripad621git committed Sep 13, 2024
1 parent 82748b9 commit 7b740b5
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
20 changes: 20 additions & 0 deletions config/esp32/components/chip/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
6 changes: 6 additions & 0 deletions src/platform/ESP32/CHIPPlatformConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 7b740b5

Please sign in to comment.