Skip to content

Commit 6410e17

Browse files
committed
esp8266: Disable DEBUG_PRINTERS for 512k build.
Disabling this saves around 6000 bytes of code space and gets the 512k build fitting in the available flash again (it increased lately due to an increase in the size of the ESP8266 SDK).
1 parent db2bdad commit 6410e17

2 files changed

Lines changed: 17 additions & 0 deletions

File tree

ports/esp8266/main.c

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,3 +137,17 @@ void __assert(const char *file, int line, const char *expr) {
137137
for (;;) {
138138
}
139139
}
140+
141+
#if !MICROPY_DEBUG_PRINTERS
142+
// With MICROPY_DEBUG_PRINTERS disabled DEBUG_printf is not defined but it
143+
// is still needed by esp-open-lwip for debugging output, so define it here.
144+
#include <stdarg.h>
145+
int mp_vprintf(const mp_print_t *print, const char *fmt, va_list args);
146+
int DEBUG_printf(const char *fmt, ...) {
147+
va_list ap;
148+
va_start(ap, fmt);
149+
int ret = mp_vprintf(&MICROPY_DEBUG_PRINTER_DEST, fmt, ap);
150+
va_end(ap);
151+
return ret;
152+
}
153+
#endif

ports/esp8266/mpconfigport_512k.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@
55
#undef MICROPY_EMIT_INLINE_XTENSA
66
#define MICROPY_EMIT_INLINE_XTENSA (0)
77

8+
#undef MICROPY_DEBUG_PRINTERS
9+
#define MICROPY_DEBUG_PRINTERS (0)
10+
811
#undef MICROPY_ERROR_REPORTING
912
#define MICROPY_ERROR_REPORTING (MICROPY_ERROR_REPORTING_TERSE)
1013

0 commit comments

Comments
 (0)