SuperHouse / esp-open-rtos

Open source FreeRTOS-based ESP8266 software framework
BSD 3-Clause "New" or "Revised" License
1.53k stars 491 forks source link

printf() does not support %lld or PRIu64 as declared in <inttypes.h> #561

Open jeffsf opened 6 years ago

jeffsf commented 6 years ago

In trying to debug the SNTP implementation, I found that either "%20llu\n" or, the portable macro from <inttypes.h> of "%20" PRIu64 "\n" both result in printing lu

This can be replicated if you run examples/sntp which at sntp_fun.c:117 (at that time contained)

printf("\nRTC Adjust: drift = %lld ticks, cal = %d\n", (time_t)(sntp_correct - sntp_current), (uint32_t)cal);

which prints as

RTC Adjust: drift = ld ticks, cal = 1447550680
ourairquality commented 6 years ago

This is a limitation of the support build into newlib. You might want to obtain the source code and rebuild without the 'nano' printing support, if that fits, or just live with the nano version and work around it with some hacks.