From 724bf797b1e276409265bd9cc7094a654b51d0f8 Mon Sep 17 00:00:00 2001 From: Our Air Quality Date: Thu, 14 Dec 2017 07:42:22 +1100 Subject: [PATCH] Reuse the startup stack for the dynamic heap. Once scheduling has started, the startup stack is no longer usable, control can never return to that stack. So bump up the heap end in the first task that runs after scheduling has started. This gives back about 1k. --- core/app_main.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/core/app_main.c b/core/app_main.c index fb72cac..da910d8 100644 --- a/core/app_main.c +++ b/core/app_main.c @@ -339,10 +339,16 @@ void sdk_wdt_init(void) { sdk_pp_soft_wdt_init(); } +extern void *xPortSupervisorStackPointer; + // .irom0.text+0x474 void sdk_user_init_task(void *params) { int phy_ver, pp_ver; + /* The start up stack is not used after scheduling has started, so all of + * the top area of RAM which was stack can be used for the dynamic heap. */ + xPortSupervisorStackPointer = (void *)0x40000000; + sdk_ets_timer_init(); printf("\nESP-Open-SDK ver: %s compiled @ %s %s\n", OS_VERSION_STR, __DATE__, __TIME__); phy_ver = RTCMEM_BACKUP[RTCMEM_BACKUP_PHY_VER] >> 16;