From 586e37c8644b71d7b7b79700a0ebc9370bb3d82d Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Tue, 31 Mar 2026 20:47:47 -1000 Subject: [PATCH] =?UTF-8?q?Use=20xQueueCreate=20=E2=80=94=20BK72xx=20FreeR?= =?UTF-8?q?TOS=20lacks=20static=20allocation?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit BK72xx's FreeRTOS does not enable configSUPPORT_STATIC_ALLOCATION, so xQueueCreateStatic is unavailable. Fall back to xQueueCreate which is a one-time heap allocation during setup. --- esphome/core/freertos_queue.h | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/esphome/core/freertos_queue.h b/esphome/core/freertos_queue.h index ccf99523d8..d264489663 100644 --- a/esphome/core/freertos_queue.h +++ b/esphome/core/freertos_queue.h @@ -18,9 +18,6 @@ * empty, full, size) but uses xQueue internally, which synchronizes via * FreeRTOS critical sections. * - * Uses xQueueCreateStatic so the queue storage lives in the object itself - * with no heap allocation, matching LockFreeQueue's static buffer approach. - * * @tparam T The type of elements stored in the queue (stored as pointers) * @tparam SIZE The maximum number of elements */ @@ -29,9 +26,7 @@ namespace esphome { template class FreeRTOSQueue { public: - FreeRTOSQueue() : dropped_count_(0) { - this->handle_ = xQueueCreateStatic(SIZE, sizeof(T *), this->storage_, &this->queue_buf_); - } + FreeRTOSQueue() : dropped_count_(0) { this->handle_ = xQueueCreate(SIZE, sizeof(T *)); } bool push(T *element) { if (element == nullptr) @@ -69,9 +64,6 @@ template class FreeRTOSQueue { size_t size() const { return uxQueueMessagesWaiting(this->handle_); } protected: - // Static storage for the queue - sized for SIZE pointer-sized items - uint8_t storage_[SIZE * sizeof(T *)]; - StaticQueue_t queue_buf_; QueueHandle_t handle_; volatile uint16_t dropped_count_; };