Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

constexpr helpers to identify core version #5269

Merged
merged 10 commits into from
Nov 29, 2018
1 change: 1 addition & 0 deletions cores/esp8266/Arduino.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ extern "C" {
#include "esp8266_peri.h"
#include "twi.h"
#include "core_esp8266_features.h"
#include "core_esp8266_version.h"

#define HIGH 0x1
#define LOW 0x0
Expand Down
13 changes: 4 additions & 9 deletions cores/esp8266/Esp-version.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,28 +29,23 @@
#define STR(x) STRHELPER(x) // stringifier

static const char arduino_esp8266_git_ver [] PROGMEM = STR(ARDUINO_ESP8266_GIT_DESC);
#if LWIP_VERSION_MAJOR != 1
static const char lwip2_version [] PROGMEM = "/lwIP:" STR(LWIP_VERSION_MAJOR) "." STR(LWIP_VERSION_MINOR) "." STR(LWIP_VERSION_REVISION);
#endif
static const char bearssl_version [] PROGMEM = "/BearSSL:" STR(BEARSSL_GIT);

String EspClass::getFullVersion()
{
return String(F("SDK:")) + system_get_sdk_version()
+ F("/Core:") + FPSTR(arduino_esp8266_git_ver)
+ F("/Core:v") + String(CORE_ESP8266_VERSION) + F("-git:") + FPSTR(arduino_esp8266_git_ver)
#if LWIP_VERSION_MAJOR == 1
+ F("/lwIP:") + String(LWIP_VERSION_MAJOR) + "." + String(LWIP_VERSION_MINOR) + "." + String(LWIP_VERSION_REVISION)
#else
+ FPSTR(lwip2_version)
#endif
#if LWIP_VERSION_IS_DEVELOPMENT
+ F("-dev")
#endif
#if LWIP_VERSION_IS_RC
+ F("rc") + String(LWIP_VERSION_RC)
#endif
#ifdef LWIP_HASH_STR
+ "(" + F(LWIP_HASH_STR) + ")"
#else // LWIP_VERSION_MAJOR != 1
+ F("/lwIP:")
+ F(LWIP_HASH_STR)
#endif
+ FPSTR(bearssl_version)
;
Expand Down
30 changes: 30 additions & 0 deletions cores/esp8266/core_esp8266_version.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@

#ifndef __CORE_ESP8266_VERSION_H
#define __CORE_ESP8266_VERSION_H

#define CORE_ESP8266_MAJOR (2)
#define CORE_ESP8266_MINOR (4)
#define CORE_ESP8266_REVISION (2)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's partial overlap between these and the ones in core_version.h.

Can defines in core_version.h be written using these new ones?

#define CORE_ESP8266_RC (0)
#define CORE_ESP8266_DEVEL (1)

#define CORE_ESP8266_VERSION ((CORE_ESP8266_MAJOR*10000) + (CORE_ESP8266_MINOR*1000) + (CORE_ESP8266_REVISION*100) + (CORE_ESP8266_RC*10) + (CORE_ESP8266_DEVEL))

// CORE_ESP8266_VERSION:
// 2.4.3-dev (after 2.4.2 release), or 24201
// 2.5.0-dev (after 2.4.2 release) 24201
// 2.5.0-rc1 first release candidate 24210
// 2.5.0-rc1+ dev after first release candidate 24211
// 2.5.0-rc2 second release candidate 24220
// 2.5.0 release 25000
// 2.5.1-dev 25001
// 2.5.1-rc1 25010
// 2.5.1 release 25100

// for example:
// 24211 should read as:
// "dev after first RC after 2.4.2" (for 2.4.3 or 2.5.0)
// CORE_ESP8266_DEVEL must be increased whenever API changes 24201 -> 24202 -> 24203
// so one can always compare (#if CORE_ESP8266_VERSION < 24201 // previous api...)

#endif // __CORE_ESP8266_ESP8266_VERSION_H
4 changes: 4 additions & 0 deletions package/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ Here is an overview of the release process. See the section below for detailed i

* When done, put release notes into a private Gist and send the link to other maintainers for review.

* Update versions in cores/esp8266/core_esp8266_version.h -and- platform.txt, and commit
devyte marked this conversation as resolved.
Show resolved Hide resolved

2. Tag the latest commit on the master branch. In this project, tags have form `X.Y.Z`, e.g. `2.4.0`, or `X.Y.Z-rcN` for release versions. Notice that there's no `v`at the beginning of the tag. Tags must be annotated, not lightweight tags. To create a tag, use git command (assuming that the master branch is checked out):

```
Expand All @@ -81,6 +83,8 @@ Here is an overview of the release process. See the section below for detailed i

* The version in platform.txt file. This should correspond to the version of the *next* milestone, plus `-dev` suffix. E.g. `2.5.0-dev`.

* The version in cores/esp8266/core_esp8266_version.h. This should correspond to the current version + 1 (e.g. 24200 -> 24201)

* In main README.md:

- in "Contributing" section, update the "easy issues" link to point to the next milestone.
Expand Down