Skip to content

Commit 1dc99d6

Browse files
committed
add ARDUINO_ESP8266_GIT_DESC
restore ARDUINO_ESP8266_GIT_VER restore global variable "core_version" don't print full version on setDebugOutput(true) set platform.txt version to 2.4.1-pre hide irrelevant boot version fix typo
1 parent dbd0126 commit 1dc99d6

File tree

7 files changed

+54
-53
lines changed

7 files changed

+54
-53
lines changed

cores/esp8266/Esp-version.cpp

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
2+
#include <Arduino.h>
3+
#include <user_interface.h>
4+
#include <core_version.h>
5+
#include <lwip/init.h> // LWIP_VERSION_*
6+
#include <lwipopts.h> // LWIP_HASH_STR (lwip2)
7+
8+
#define STRHELPER(x) #x
9+
#define STR(x) STRHELPER(x) // stringifier
10+
11+
#ifdef NDEBUG
12+
13+
String EspClass::getFullVersion()
14+
{
15+
return String();
16+
}
17+
18+
#else // !NDEBUG
19+
20+
static const char arduino_esp8266_git_ver [] PROGMEM = STR(ARDUINO_ESP8266_GIT_DESC);
21+
#if LWIP_VERSION_MAJOR != 1
22+
static const char lwip2_version [] PROGMEM = "/lwIP:" STR(LWIP_VERSION_MAJOR) "." STR(LWIP_VERSION_MINOR) "." STR(LWIP_VERSION_REVISION);
23+
#endif
24+
25+
String EspClass::getFullVersion()
26+
{
27+
return String(F("SDK:")) + system_get_sdk_version()
28+
+ F("/Core:") + FPSTR(arduino_esp8266_git_ver)
29+
#if LWIP_VERSION_MAJOR == 1
30+
+ F("/lwIP:") + String(LWIP_VERSION_MAJOR) + "." + String(LWIP_VERSION_MINOR) + "." + String(LWIP_VERSION_REVISION)
31+
#else
32+
+ FPSTR(lwip2_version)
33+
#endif
34+
#if LWIP_VERSION_IS_DEVELOPMENT
35+
+ F("-dev")
36+
#endif
37+
#if LWIP_VERSION_IS_RC
38+
+ F("rc") + String(LWIP_VERSION_RC)
39+
#endif
40+
#ifdef LWIP_HASH_STR
41+
+ "(" + F(LWIP_HASH_STR) + ")"
42+
#endif
43+
;
44+
}
45+
46+
#endif // !NDEBUG

cores/esp8266/Esp.cpp

Lines changed: 0 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,6 @@
2424
#include <memory>
2525
#include "interrupts.h"
2626
#include "MD5Builder.h"
27-
#include <core_version.h>
28-
#include <lwip/init.h> // LWIP_VERSION_*
29-
#include <lwipopts.h> // LWIP_HASH_STR (lwip2)
30-
31-
#define STRHELPER(x) #x
32-
#define STR(x) STRHELPER(x) // stringifier
3327

3428
extern "C" {
3529
#include "user_interface.h"
@@ -556,41 +550,3 @@ String EspClass::getSketchMD5()
556550
result = md5.toString();
557551
return result;
558552
}
559-
560-
#ifdef NDEBUG
561-
562-
String EspClass::getFullVersion()
563-
{
564-
return String();
565-
}
566-
567-
#else // !NDEBUG
568-
569-
static const char arduino_esp8266_git_ver [] PROGMEM = STR(ARDUINO_ESP8266_GIT_VER);
570-
#if LWIP_VERSION_MAJOR != 1
571-
static const char lwip2_version [] PROGMEM = "/lwIP:" STR(LWIP_VERSION_MAJOR) "." STR(LWIP_VERSION_MINOR) "." STR(LWIP_VERSION_REVISION);
572-
#endif
573-
574-
String EspClass::getFullVersion()
575-
{
576-
return String(F("Boot:")) + system_get_boot_version()
577-
+ F("/SDK:") + system_get_sdk_version()
578-
+ F("/Core:") + FPSTR(arduino_esp8266_git_ver)
579-
#if LWIP_VERSION_MAJOR == 1
580-
+ F("/lwIP:") + String(LWIP_VERSION_MAJOR) + "." + String(LWIP_VERSION_MINOR) + "." + String(LWIP_VERSION_REVISION)
581-
#else
582-
+ FPSTR(lwip2_version)
583-
#endif
584-
#if LWIP_VERSION_IS_DEVELOPMENT
585-
+ F("-dev")
586-
#endif
587-
#if LWIP_VERSION_IS_RC
588-
+ F("rc") + String(LWIP_VERSION_RC)
589-
#endif
590-
#ifdef LWIP_HASH_STR
591-
+ "(" + F(LWIP_HASH_STR) + ")"
592-
#endif
593-
;
594-
}
595-
596-
#endif // !NDEBUG

cores/esp8266/HardwareSerial.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ void HardwareSerial::begin(unsigned long baud, SerialConfig config, SerialMode m
4040
end();
4141
_uart = uart_init(_uart_nr, baud, (int) config, (int) mode, tx_pin, _rx_size);
4242
#if defined(DEBUG_ESP_PORT) && !defined(NDEBUG)
43+
println();
4344
println(ESP.getFullVersion());
4445
#endif
4546
}
@@ -97,9 +98,6 @@ void HardwareSerial::setDebugOutput(bool en)
9798
if(en) {
9899
if(uart_tx_enabled(_uart)) {
99100
uart_set_debug(_uart_nr);
100-
#if !defined(DEBUG_ESP_PORT) && !defined(NDEBUG)
101-
os_printf("%s\r\n", ESP.getFullVersion().c_str());
102-
#endif
103101
} else {
104102
uart_set_debug(UART_NO);
105103
}

cores/esp8266/core_esp8266_main.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ extern "C" {
4141

4242
struct rst_info resetInfo;
4343

44-
#if 0
4544
extern "C" {
4645
extern const uint32_t __attribute__((section(".ver_number"))) core_version = ARDUINO_ESP8266_GIT_VER;
4746
const char* core_release =
@@ -51,7 +50,6 @@ const char* core_release =
5150
NULL;
5251
#endif
5352
} // extern "C"
54-
#endif
5553

5654
int atexit(void (*func)()) {
5755
(void) func;
@@ -152,7 +150,6 @@ void init_done() {
152150
system_set_os_print(1);
153151
gdb_init();
154152
do_global_ctors();
155-
//printf("\n%08x\n", core_version);
156153
esp_schedule();
157154
}
158155

cores/esp8266/core_version.h.no renamed to cores/esp8266/core_version.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#define ARDUINO_ESP8266_GIT_VER 0x00000000
2+
#define ARDUINO_ESP8266_GIT_DESC unspecified
23

34
// ARDUINO_ESP8266_RELEASE is defined for released versions as a string containing the version name, i.e. "2_3_0_RC1"
45
// ARDUINO_ESP8266_RELEASE is used in the core internally. Please use ESP.getCoreVersion() function instead.

package/build_boards_manager_package.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ $SED 's/recipe.hooks.core.prebuild.1.pattern.*//g' \
8888
ver_define=`echo $plain_ver | tr "[:lower:].\055" "[:upper:]_"`
8989
echo Ver define: $ver_define
9090
echo \#define ARDUINO_ESP8266_GIT_VER 0x`git rev-parse --short=8 HEAD 2>/dev/null` >$outdir/cores/esp8266/core_version.h
91+
echo \#define ARDUINO_ESP8266_GIT_DESC `git describe --tags 2>/dev/null` >>$outdir/cores/esp8266/core_version.h
9192
echo \#define ARDUINO_ESP8266_RELEASE_$ver_define >>$outdir/cores/esp8266/core_version.h
9293
echo \#define ARDUINO_ESP8266_RELEASE \"$ver_define\" >>$outdir/cores/esp8266/core_version.h
9394

platform.txt

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
# https://github.com/arduino/Arduino/wiki/Arduino-IDE-1.5---3rd-party-Hardware-specification
77

88
name=ESP8266 Modules
9-
version=2.4.0-post
9+
version=2.4.1-pre
1010

1111
runtime.tools.xtensa-lx106-elf-gcc.path={runtime.platform.path}/tools/xtensa-lx106-elf
1212
runtime.tools.esptool.path={runtime.platform.path}/tools/esptool
@@ -70,9 +70,11 @@ compiler.elf2hex.extra_flags=
7070

7171
## generate file with git version number
7272
## needs bash, git, and echo
73-
recipe.hooks.core.prebuild.1.pattern=bash -c "mkdir -p {build.path}/core && echo \#define ARDUINO_ESP8266_GIT_VER `cd {runtime.platform.path}; git describe --tags 2>/dev/null || echo nix-{version}` >{build.path}/core/core_version.h"
73+
recipe.hooks.core.prebuild.1.pattern=bash -c "mkdir -p {build.path}/core && echo \#define ARDUINO_ESP8266_GIT_VER 0x`git --git-dir {runtime.platform.path}/.git rev-parse --short=8 HEAD 2>/dev/null || echo ffffffff` >{build.path}/core/core_version.h"
74+
recipe.hooks.core.prebuild.2.pattern=bash -c "mkdir -p {build.path}/core && echo \#define ARDUINO_ESP8266_GIT_DESC `cd {runtime.platform.path}; git describe --tags 2>/dev/null || echo unix-{version}` >>{build.path}/core/core_version.h"
7475
## windows-compatible version may be added later - warn: this string below has only been tested with "wine cmd.exe"
75-
recipe.hooks.core.prebuild.1.pattern.windows=cmd /c echo #define ARDUINO_ESP8266_GIT_VER win-{version} > {build.path}\\core\\core_version.h
76+
recipe.hooks.core.prebuild.1.pattern.windows=cmd /c echo #define ARDUINO_ESP8266_GIT_VER 0x00000000 > {build.path}\\core\\core_version.h
77+
recipe.hooks.core.prebuild.2.pattern.windows=cmd /c echo #define ARDUINO_ESP8266_GIT_DESC win-{version} >> {build.path}\\core\\core_version.h
7678

7779
## Compile c files
7880
recipe.c.o.pattern="{compiler.path}{compiler.c.cmd}" {compiler.cpreprocessor.flags} {compiler.c.flags} -DF_CPU={build.f_cpu} {build.lwip_flags} {build.debug_port} {build.debug_level} -DARDUINO={runtime.ide.version} -DARDUINO_{build.board} -DARDUINO_ARCH_{build.arch} -DARDUINO_BOARD="{build.board}" {build.led} {compiler.c.extra_flags} {build.extra_flags} {includes} "{source_file}" -o "{object_file}"

0 commit comments

Comments
 (0)