1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-04-21 10:26:06 +03:00

Fix Exception 2 when using printf or vprintf

ets_vprintf signature is not the same as vprintf, it takes an output function as a first argument.
This commit is contained in:
Ivan Grokhotkov 2016-04-17 02:12:01 +03:00
parent 797c78ddad
commit 4c587e28bc
2 changed files with 5 additions and 5 deletions

View File

@ -52,10 +52,9 @@ int ICACHE_RAM_ATTR putchar(int c) {
}
int ICACHE_RAM_ATTR printf(const char* format, ...) {
int ret;
va_list arglist;
va_start(arglist, format);
ret = ets_vprintf(format, arglist);
int ret = ets_vprintf(ets_putc, format, arglist);
va_end(arglist);
return ret;
}
@ -79,7 +78,7 @@ int ICACHE_RAM_ATTR snprintf(char* buffer, size_t size, const char* format, ...)
}
int ICACHE_RAM_ATTR vprintf(const char * format, va_list arg) {
return ets_vprintf(format, arg);
return ets_vprintf(ets_putc, format, arg);
}
int ICACHE_RAM_ATTR vsnprintf(char * buffer, size_t size, const char * format, va_list arg) {

View File

@ -155,7 +155,7 @@ inline uint32_t ETS_INTR_PENDING(void)
#define ETS_SDIO_INTR_DISABLE() \
ETS_INTR_DISABLE(ETS_SDIO_INUM)
void *pvPortMalloc(size_t xWantedSize, const char* file, int line) __attribute__((malloc, alloc_size(1)));
void *pvPortRealloc(void* ptr, size_t xWantedSize, const char* file, int line) __attribute__((alloc_size(2)));
@ -183,7 +183,8 @@ void ets_isr_attach(int intr, int_handler_t handler, void *arg);
void ets_intr_lock();
void ets_intr_unlock();
int ets_vsnprintf(char * s, size_t n, const char * format, va_list arg) __attribute__ ((format (printf, 3, 0)));
int ets_vprintf(const char * format, va_list arg) __attribute__ ((format (printf, 1, 0)));
int ets_vprintf(int (*print_function)(int), const char * format, va_list arg) __attribute__ ((format (printf, 2, 0)));
int ets_putc(int);
bool ets_task(ETSTask task, uint8 prio, ETSEvent *queue, uint8 qlen);
bool ets_post(uint8 prio, ETSSignal sig, ETSParam par);