Recently I read a post on the ESP8266 forum where the author was attempting to use the
powf() function call, but running out of memory during compile. That sounded very familiar to me, as I’ve been experimenting with the DS3231 RTC clock module recently (inside an MQTT application) and found that if I tried to use any of the standard “time.h” library functions, such as
localtime(), my compile would also bomb with the infamous “iram1_0_seg” out-of-memory errors. This would happen no matter how many
struct tm‘s worth of memory I freed up in the code, to the point where using time.h calls from within MQTT seemed to be an unworkable combination, even with the
eagle.app.v6.ld modifications for .literal. and .text. storage.
I don’t have a “silver bullet” answer to this problem (and, so far, according to the thread referenced above, neither does anyone else), but the latest SDK (V1.2 as of the time of writing) does seem to help, although not enough for most people, including me (see page 2 of the thread). In the end I modified a cut-down version of an Arduino C++ time.h lookalike (mem’s Arduino Playground Time.h) to add the functionality I wanted and still have memory left over for other things.
Kudos to mem for the original Arduino Time.h and my apologies for the terrible, slash-and-burn mess I’ve made of it. Gomen-ne! My exceedingly ugly versions are available here for anyone who is really, really desperate:- ESP8266/time.h_hacks