Skip to content

Commit d96c8f3

Browse files
Move some exception strings to PROGMEM (#5050)
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).
1 parent 831e75d commit d96c8f3

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

cores/esp8266/core_esp8266_postmortem.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ void __wrap_system_restart_local() {
166166

167167
// Use cap-X formatting to ensure the standard EspExceptionDecoder doesn't match the address
168168
if (umm_last_fail_alloc_addr) {
169-
ets_printf("\nlast failed alloc call: %08X(%d)\n", (uint32_t)umm_last_fail_alloc_addr, umm_last_fail_alloc_size);
169+
ets_printf_P("\nlast failed alloc call: %08X(%d)\n", (uint32_t)umm_last_fail_alloc_addr, umm_last_fail_alloc_size);
170170
}
171171

172172
custom_crash_callback( &rst_info, sp + offset, stack_end );

cores/esp8266/debug.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ extern "C" {
2323
#endif
2424

2525
void __panic_func(const char* file, int line, const char* func) __attribute__((noreturn));
26-
#define panic() __panic_func(__FILE__, __LINE__, __func__)
26+
#define panic() __panic_func(PSTR(__FILE__), __LINE__, __func__)
2727

2828
#ifdef __cplusplus
2929
}

0 commit comments

Comments
 (0)