1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-04-22 21:23:07 +03:00

Move debug constant strings to PROGMEM (#3478)

UMM debugging strings are normally placed in RODATA, which uses up scarse
memory.  Move them to PROGMEM and use macros to replace printf with a
version that can handle ROM strings.
This commit is contained in:
Earle F. Philhower, III 2017-08-07 05:43:28 -07:00 committed by Ivan Grokhotkov
parent ff4bb73084
commit 4bed115abd

View File

@ -493,6 +493,7 @@
#include <stdio.h>
#include <string.h>
#include <pgmspace.h>
#include "umm_malloc.h"
@ -512,6 +513,9 @@
# define DBG_LOG_LEVEL DBG_LOG_LEVEL
#endif
// Macro to place constant strings into PROGMEM and print them properly
#define printf(fmt, ...) do { static const char fstr[] PROGMEM = fmt; char rstr[sizeof(fmt)]; for (size_t i=0; i<sizeof(rstr); i++) rstr[i] = fstr[i]; printf(rstr, ##__VA_ARGS__); } while (0)
/* -- dbglog {{{ */
/* ----------------------------------------------------------------------------