Can we determine SDK version at compile time?

User avatar
kolban
Posts: 131
Joined: Tue Jun 16, 2015 1:09 pm
Location: Fort Worth, Texas, USA

Can we determine SDK version at compile time?

Postby kolban » Tue Sep 29, 2015 10:53 pm

Is there a published #define that can be used to implicitly determine the version of the SDK that is being used during compilation time?

I could imagine something like

#define ESP_SDK_VERSION "1.4.0"

being present ... and was curious if such a technique was already present in the SDK?

Neil

tve
Posts: 123
Joined: Sun Feb 15, 2015 4:33 pm

Re: Can we determine SDK version at compile time?

Postby tve » Wed Sep 30, 2015 12:53 pm

It's available at run-time: system_get_sdk_version();

For Esprunio users there's:

Code: Select all

>ESP8266WiFi.getState();
={
  "sdkVersion": "1.4.0",
  "cpuFrequency": 80, "freeHeap": 1520, "maxCon": 5 }

;-)

User avatar
kolban
Posts: 131
Joined: Tue Jun 16, 2015 1:09 pm
Location: Fort Worth, Texas, USA

Re: Can we determine SDK version at compile time?

Postby kolban » Wed Sep 30, 2015 1:12 pm

@tve
Thanks for that. That's good to know.

I was more thinking of the notion of compilation determination between SDK releases. It is probably a safe bet to assume that there will be future SDK releases which will change or add or remove APIs. If one wanted to create an application that would still compile cleanly against known SDK releases, it might be useful to know (at compile time), the release of SDK being compiled against.

It would be nice to assume that every future SDK release will always be backwards compatible with the last but I am more thinking about forward compatibility. For example, when a new release ships, it would be great to allow applications to compile against it ... but I would prefer to also provide support for the previous SDK (the one that we know works ... for example) ... and on occasion, the only way to achieve that is by knowing at compile time, the SDK level.

A concrete example would be "os_realloc" ... or your own experience with the 1st item in a scan callback list. These appear to diverge between releases.

Who is online

Users browsing this forum: No registered users and 27 guests