From 654124adf07159c83533f0704567b77a068f7a66 Mon Sep 17 00:00:00 2001 From: Ivan Grokhotkov Date: Fri, 2 Oct 2020 17:47:55 +0200 Subject: [PATCH] freertos: don't create timer task if timer APIs are not used Saves 2496 bytes of heap for the hello-world app on the ESP32, and 4080 bytes of heap on the ESP32-S2 (due to IRAM savings). --- components/freertos/tasks.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/components/freertos/tasks.c b/components/freertos/tasks.c index 1d07e6c8e1..765da197fd 100644 --- a/components/freertos/tasks.c +++ b/components/freertos/tasks.c @@ -5137,3 +5137,8 @@ TickType_t uxReturn; #include "tasks_test_access_functions.h" #endif +/* If timers.c is not referenced anywhere, don't create the timer task to save RAM */ +BaseType_t __attribute__((weak)) xTimerCreateTimerTask( void ) +{ + return pdPASS; +}