Only enable configSUPPORT_STATIC_ALLOCATION on BK72xx

RTL87xx loses 280 bytes heap with it enabled. BK72xx gains 712 bytes.
Keep it BK72xx-only where it's a clear win.
This commit is contained in:
J. Nick Koston
2026-03-31 22:06:35 -10:00
parent 08eccb081c
commit b726d108f8
2 changed files with 9 additions and 9 deletions
+7 -7
View File
@@ -438,13 +438,13 @@ async def component_to_code(config):
# 4-8KB flash). Even if linked, it would use locks, so explicit FreeRTOS
# mutexes are simpler and equivalent.
cg.add_define(ThreadModel.MULTI_NO_ATOMICS)
# Enable FreeRTOS static allocation APIs (xQueueCreateStatic, etc.).
# Moves FreeRTOS internal structures (timer command queue) from heap to BSS,
# and allows FreeRTOSQueue to use xQueueCreateStatic on BK72xx.
# LibreTiny's FreeRTOSConfig.h doesn't define this, defaulting to 0.
# The -D wins over the #ifndef default in FreeRTOS.h.
cg.add_build_flag("-DconfigSUPPORT_STATIC_ALLOCATION=1")
# Enable FreeRTOS static allocation so FreeRTOSQueue can use
# xQueueCreateStatic (queue storage in BSS, no heap allocation).
# Also moves FreeRTOS internal structures (timer command queue) to BSS.
# BK72xx's FreeRTOSConfig.h doesn't define this, defaulting to 0.
# The -D wins over the #ifndef default in FreeRTOS.h.
# Not enabled on RTL87xx/LN882x — costs more heap than it saves there.
cg.add_build_flag("-DconfigSUPPORT_STATIC_ALLOCATION=1")
# RTL8710B needs FreeRTOS 8.2.3+ for xTaskNotifyGive/ulTaskNotifyTake
# required by AsyncTCP 3.4.3+ (https://github.com/esphome/esphome/issues/10220)
@@ -10,7 +10,7 @@
* allowing queue storage to live in BSS with zero runtime heap allocation.
*/
#ifdef USE_LIBRETINY
#ifdef USE_BK72XX
#include <FreeRTOS.h>
#include <task.h>
@@ -45,4 +45,4 @@ void vApplicationGetTimerTaskMemory(StaticTask_t **ppxTimerTaskTCBBuffer, StackT
#endif /* configSUPPORT_STATIC_ALLOCATION */
#endif /* USE_LIBRETINY */
#endif /* USE_BK72XX */