More SDK Strangeness

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 gmtime() or 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

 

 

Advertisements

2 thoughts on “More SDK Strangeness

  1. Hearty commiserations! I, too,have been struggling with the ESP – even more perhaps due to my ‘innocent inexperience’ with C. Anyway, I enjoy the witty expression of your frustrations – keep sharing 😀

    Like

  2. Admin, Thanks for your comment and encouragement. I do have something to add on this, which you may or may not feel is helpful (depending upon your “religion” 🙂 ). I’ve recently installed and started using the Arduino-ESP8266 package (available from GitHub) along with the Arduino IDE version 1.6.5. I’m -not- an Arduino user, so the nomenclature seems very strange to me, but it works very well in terms of shoehorning the largest amount of code into the smallest possible space (without making you jump through too many hoops). I’d definitely recommend giving it a try, anyway.

    -John-

    Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s