From 6f107901ce3b28a24ec543bd165528dea43cad6f Mon Sep 17 00:00:00 2001 From: "Earle F. Philhower, III" Date: Wed, 15 Aug 2018 15:25:37 -0700 Subject: [PATCH] Move some exception strings to PROGMEM The memory allocation failure message was accidentally stored in RAM and not in PROGMEM. panic() did not place the __FILE__ string in PROGMEM, either. Move both to PROGMEM, save ~64 bytes of heap (depends on size of path of the Arduino core library). --- cores/esp8266/core_esp8266_postmortem.c | 2 +- cores/esp8266/debug.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/cores/esp8266/core_esp8266_postmortem.c b/cores/esp8266/core_esp8266_postmortem.c index 3878cf1b9d..e8e04f7756 100644 --- a/cores/esp8266/core_esp8266_postmortem.c +++ b/cores/esp8266/core_esp8266_postmortem.c @@ -166,7 +166,7 @@ void __wrap_system_restart_local() { // Use cap-X formatting to ensure the standard EspExceptionDecoder doesn't match the address if (umm_last_fail_alloc_addr) { - ets_printf("\nlast failed alloc call: %08X(%d)\n", (uint32_t)umm_last_fail_alloc_addr, umm_last_fail_alloc_size); + ets_printf_P("\nlast failed alloc call: %08X(%d)\n", (uint32_t)umm_last_fail_alloc_addr, umm_last_fail_alloc_size); } custom_crash_callback( &rst_info, sp + offset, stack_end ); diff --git a/cores/esp8266/debug.h b/cores/esp8266/debug.h index 92d1356dce..0a804e76b2 100644 --- a/cores/esp8266/debug.h +++ b/cores/esp8266/debug.h @@ -23,7 +23,7 @@ extern "C" { #endif void __panic_func(const char* file, int line, const char* func) __attribute__((noreturn)); -#define panic() __panic_func(__FILE__, __LINE__, __func__) +#define panic() __panic_func(PSTR(__FILE__), __LINE__, __func__) #ifdef __cplusplus }