mirror of
https://github.com/esp8266/Arduino.git
synced 2025-06-12 01:53:07 +03:00
Store git version of the core in the compiled binary (#2099)
* Store git version of the core in the compiled binary * Don't update version number when using boards manager package
This commit is contained in:
@ -158,6 +158,19 @@ uint32_t EspClass::getChipId(void)
|
||||
return system_get_chip_id();
|
||||
}
|
||||
|
||||
extern "C" uint32_t core_version;
|
||||
extern "C" const char* core_release;
|
||||
|
||||
String EspClass::getCoreVersion()
|
||||
{
|
||||
if (core_release != NULL) {
|
||||
return String(core_release);
|
||||
}
|
||||
char buf[12];
|
||||
snprintf(buf, sizeof(buf), "%08x", core_version);
|
||||
return String(buf);
|
||||
}
|
||||
|
||||
const char * EspClass::getSdkVersion(void)
|
||||
{
|
||||
return system_get_sdk_version();
|
||||
|
@ -106,6 +106,7 @@ class EspClass {
|
||||
uint32_t getChipId();
|
||||
|
||||
const char * getSdkVersion();
|
||||
String getCoreVersion();
|
||||
|
||||
uint8_t getBootVersion();
|
||||
uint8_t getBootMode();
|
||||
|
@ -31,6 +31,8 @@ extern "C" {
|
||||
#include "user_interface.h"
|
||||
#include "cont.h"
|
||||
}
|
||||
#include <core_version.h>
|
||||
|
||||
#define LOOP_TASK_PRIORITY 1
|
||||
#define LOOP_QUEUE_SIZE 1
|
||||
|
||||
@ -38,6 +40,16 @@ extern "C" {
|
||||
|
||||
struct rst_info resetInfo;
|
||||
|
||||
extern "C" {
|
||||
extern const uint32_t __attribute__((section(".ver_number"))) core_version = ARDUINO_ESP8266_GIT_VER;
|
||||
const char* core_release =
|
||||
#ifdef ARDUINO_ESP8266_RELEASE
|
||||
ARDUINO_ESP8266_RELEASE;
|
||||
#else
|
||||
NULL;
|
||||
#endif
|
||||
} // extern "C"
|
||||
|
||||
int atexit(void (*func)()) {
|
||||
return 0;
|
||||
}
|
||||
@ -134,6 +146,7 @@ void init_done() {
|
||||
system_set_os_print(1);
|
||||
gdb_init();
|
||||
do_global_ctors();
|
||||
printf("\n%08x\n", core_version);
|
||||
esp_schedule();
|
||||
}
|
||||
|
||||
|
6
cores/esp8266/core_version.h
Normal file
6
cores/esp8266/core_version.h
Normal file
@ -0,0 +1,6 @@
|
||||
#define ARDUINO_ESP8266_GIT_VER 0x00000000
|
||||
|
||||
// ARDUINO_ESP8266_RELEASE is defined for released versions as a string containing the version name, i.e. "2_3_0_RC1"
|
||||
// ARDUINO_ESP8266_RELEASE is used in the core internally. Please use ESP.getCoreVersion() function instead.
|
||||
|
||||
// ARDUINO_ESP8266_RELEASE_<version number> are defined for releases, for use in #ifdef... constructs
|
Reference in New Issue
Block a user