Merge pull request #14004 from gschorcht/cpu/esp32/fix_newlib_nano_printf_float

cpu/esp32: fix printf for float with newlib-nano
This commit is contained in:
Martine Lenders 2020-05-02 20:43:00 +02:00 committed by GitHub
commit ad89680c40
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 1 deletions

View File

@ -89,7 +89,7 @@ extern "C" {
#define CONFIG_SYSTEM_EVENT_TASK_STACK_SIZE 2048 #define CONFIG_SYSTEM_EVENT_TASK_STACK_SIZE 2048
#define CONFIG_NUMBER_OF_UNIVERSAL_MAC_ADDRESS 4 #define CONFIG_NUMBER_OF_UNIVERSAL_MAC_ADDRESS 4
#define CONFIG_NEWLIB_NANO_FORMAT 0 #define CONFIG_NEWLIB_NANO_FORMAT 1
#define CONFIG_ESP32_DEEP_SLEEP_WAKEUP_DELAY 2000 #define CONFIG_ESP32_DEEP_SLEEP_WAKEUP_DELAY 2000
/** /**

View File

@ -33,6 +33,7 @@
#include "soc/rtc_cntl_struct.h" #include "soc/rtc_cntl_struct.h"
#include "soc/timer_group_reg.h" #include "soc/timer_group_reg.h"
#include "soc/timer_group_struct.h" #include "soc/timer_group_struct.h"
#include "sdk_conf.h"
#include "xtensa/xtensa_api.h" #include "xtensa/xtensa_api.h"
#ifdef MODULE_ESP_IDF_HEAP #ifdef MODULE_ESP_IDF_HEAP
@ -97,6 +98,18 @@ static int _no_sys_func(struct _reent *r)
return -1; return -1;
} }
extern int _printf_float(struct _reent *rptr,
void *pdata,
FILE * fp,
int (*pfunc) (struct _reent *, FILE *,
_CONST char *, size_t len),
va_list * ap);
extern int _scanf_float(struct _reent *rptr,
void *pdata,
FILE *fp,
va_list *ap);
static struct syscall_stub_table s_stub_table = static struct syscall_stub_table s_stub_table =
{ {
.__getreent = &__getreent, .__getreent = &__getreent,