diff --git a/cores/esp8266/Esp-version.cpp b/cores/esp8266/Esp-version.cpp new file mode 100644 index 0000000000..a60616561c --- /dev/null +++ b/cores/esp8266/Esp-version.cpp @@ -0,0 +1,54 @@ +/* + Esp.cpp - ESP8266-specific APIs + Copyright (c) 2015 Ivan Grokhotkov. All rights reserved. + This file is part of the esp8266 core for Arduino environment. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include +#include +#include +#include // LWIP_VERSION_* +#include // LWIP_HASH_STR (lwip2) + +#define STRHELPER(x) #x +#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 + +String EspClass::getFullVersion() +{ + return String(F("SDK:")) + system_get_sdk_version() + + F("/Core:") + 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) + ")" +#endif + ; +} diff --git a/cores/esp8266/Esp.h b/cores/esp8266/Esp.h index e5d3a5f909..43842a6ae7 100644 --- a/cores/esp8266/Esp.h +++ b/cores/esp8266/Esp.h @@ -108,6 +108,7 @@ class EspClass { const char * getSdkVersion(); String getCoreVersion(); + String getFullVersion(); uint8_t getBootVersion(); uint8_t getBootMode(); diff --git a/cores/esp8266/HardwareSerial.cpp b/cores/esp8266/HardwareSerial.cpp index f2465be5a6..e5b0d79a8c 100644 --- a/cores/esp8266/HardwareSerial.cpp +++ b/cores/esp8266/HardwareSerial.cpp @@ -29,7 +29,7 @@ #include #include "Arduino.h" #include "HardwareSerial.h" - +#include "Esp.h" HardwareSerial::HardwareSerial(int uart_nr) : _uart_nr(uart_nr), _rx_size(256) @@ -39,6 +39,14 @@ void HardwareSerial::begin(unsigned long baud, SerialConfig config, SerialMode m { end(); _uart = uart_init(_uart_nr, baud, (int) config, (int) mode, tx_pin, _rx_size); +#if defined(DEBUG_ESP_PORT) && !defined(NDEBUG) + if (this == &DEBUG_ESP_PORT) + { + setDebugOutput(true); + println(); + println(ESP.getFullVersion()); + } +#endif } void HardwareSerial::end() diff --git a/cores/esp8266/core_esp8266_main.cpp b/cores/esp8266/core_esp8266_main.cpp index 25a4f3f24f..4a96eeec51 100644 --- a/cores/esp8266/core_esp8266_main.cpp +++ b/cores/esp8266/core_esp8266_main.cpp @@ -115,9 +115,6 @@ static void loop_wrapper() { preloop_update_frequency(); if(!setup_done) { setup(); -#ifdef DEBUG_ESP_PORT - DEBUG_ESP_PORT.setDebugOutput(true); -#endif setup_done = true; } loop(); @@ -150,7 +147,6 @@ void init_done() { system_set_os_print(1); gdb_init(); do_global_ctors(); - printf("\n%08x\n", core_version); esp_schedule(); } diff --git a/cores/esp8266/core_version.h b/cores/esp8266/core_version.h index 09e384c1fd..e4556d7e03 100644 --- a/cores/esp8266/core_version.h +++ b/cores/esp8266/core_version.h @@ -1,4 +1,5 @@ #define ARDUINO_ESP8266_GIT_VER 0x00000000 +#define ARDUINO_ESP8266_GIT_DESC unspecified // 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. diff --git a/package/build_boards_manager_package.sh b/package/build_boards_manager_package.sh index d5434b5ea8..32d4f9a004 100755 --- a/package/build_boards_manager_package.sh +++ b/package/build_boards_manager_package.sh @@ -81,13 +81,15 @@ $SED 's/runtime.tools.xtensa-lx106-elf-gcc.path={runtime.platform.path}\/tools\/ $SED 's/runtime.tools.esptool.path={runtime.platform.path}\/tools\/esptool//g' | \ $SED 's/tools.esptool.path={runtime.platform.path}\/tools\/esptool/tools.esptool.path=\{runtime.tools.esptool.path\}/g' | \ $SED 's/tools.mkspiffs.path={runtime.platform.path}\/tools\/mkspiffs/tools.mkspiffs.path=\{runtime.tools.mkspiffs.path\}/g' |\ -$SED 's/recipe.hooks.core.prebuild.1.pattern.*//g' \ +$SED 's/recipe.hooks.core.prebuild.1.pattern.*//g' |\ +$SED 's/recipe.hooks.core.prebuild.2.pattern.*//g' \ > $outdir/platform.txt # Put core version and short hash of git version into core_version.h ver_define=`echo $plain_ver | tr "[:lower:].\055" "[:upper:]_"` echo Ver define: $ver_define echo \#define ARDUINO_ESP8266_GIT_VER 0x`git rev-parse --short=8 HEAD 2>/dev/null` >$outdir/cores/esp8266/core_version.h +echo \#define ARDUINO_ESP8266_GIT_DESC `git describe --tags 2>/dev/null` >>$outdir/cores/esp8266/core_version.h echo \#define ARDUINO_ESP8266_RELEASE_$ver_define >>$outdir/cores/esp8266/core_version.h echo \#define ARDUINO_ESP8266_RELEASE \"$ver_define\" >>$outdir/cores/esp8266/core_version.h diff --git a/platform.txt b/platform.txt index 351279111b..d59921932f 100644 --- a/platform.txt +++ b/platform.txt @@ -6,7 +6,7 @@ # https://github.com/arduino/Arduino/wiki/Arduino-IDE-1.5---3rd-party-Hardware-specification name=ESP8266 Modules -version=2.5.0 +version=2.4.1-pre runtime.tools.xtensa-lx106-elf-gcc.path={runtime.platform.path}/tools/xtensa-lx106-elf runtime.tools.esptool.path={runtime.platform.path}/tools/esptool @@ -71,8 +71,10 @@ compiler.elf2hex.extra_flags= ## generate file with git version number ## needs bash, git, and echo 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" -## windows-compatible version may be added later -recipe.hooks.core.prebuild.1.pattern.windows= +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" +## windows-compatible version without git +recipe.hooks.core.prebuild.1.pattern.windows=cmd.exe /c mkdir {build.path}\core & (echo #define ARDUINO_ESP8266_GIT_VER 0x00000000 & echo #define ARDUINO_ESP8266_GIT_DESC win-{version} ) > {build.path}\core\core_version.h +recipe.hooks.core.prebuild.2.pattern.windows= ## Compile c files 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}" diff --git a/tools/sdk/lib/liblwip2.a b/tools/sdk/lib/liblwip2.a index 223ee7cb77..e681bdc398 100644 Binary files a/tools/sdk/lib/liblwip2.a and b/tools/sdk/lib/liblwip2.a differ diff --git a/tools/sdk/lib/liblwip2_1460.a b/tools/sdk/lib/liblwip2_1460.a index f0307b1826..8929c2d009 100644 Binary files a/tools/sdk/lib/liblwip2_1460.a and b/tools/sdk/lib/liblwip2_1460.a differ diff --git a/tools/sdk/lwip2/builder b/tools/sdk/lwip2/builder index bdd68addcf..a376280e35 160000 --- a/tools/sdk/lwip2/builder +++ b/tools/sdk/lwip2/builder @@ -1 +1 @@ -Subproject commit bdd68addcfed8f2e3b484b465369dac0407d3f5e +Subproject commit a376280e3567dff7d494d6fe3e54146f6125f5c6 diff --git a/tools/sdk/lwip2/include/gluedebug.h b/tools/sdk/lwip2/include/gluedebug.h index 03c9a17810..55d0e8d746 100644 --- a/tools/sdk/lwip2/include/gluedebug.h +++ b/tools/sdk/lwip2/include/gluedebug.h @@ -17,7 +17,7 @@ #define ULWIPDEBUG 0 // 0 or 1 (trigger lwip debug) #define ULWIPASSERT 0 // 0 or 1 (trigger lwip self-check, 0 saves flash) -#define STRING_IN_FLASH 0 // *print("fmt is stored in flash") +#define STRING_IN_FLASH 1 // *print("fmt is stored in flash") #define ROTBUFLEN_BIT 11 // (UDEBUGSTORE=1) doprint()'s buffer: 11=2048B @@ -82,10 +82,7 @@ int doprint_minus (const char* format, ...) __attribute__ ((format (printf, 1, 2 #define uprint(x...) do { (void)0; } while (0) #endif -#if UNDEBUG -#define uassert(assertion...) do { (void)0; } while (0) -#else // !defined(UNDEBUG) -#define uassert(assertion...) \ +#define udoassert(assertion...) \ do { if ((assertion) == 0) { \ static const char assrt[] ICACHE_RODATA_ATTR STORE_ATTR = #assertion " wrong@"; \ os_printf_plus(assrt); \ @@ -95,8 +92,15 @@ do { if ((assertion) == 0) { \ os_printf_plus(assrt_line, __LINE__); \ uhalt(); \ } } while (0) + +#if UNDEBUG +#define uassert(assertion...) do { (void)0; } while (0) +#else // !defined(UNDEBUG) +#define uassert(assertion...) udoassert(assertion) #endif // !defined(UNDEBUG) +#define ualwaysassert(assertion...) udoassert(assertion) + #define uerror(x...) do { doprint(x); } while (0) #define uhalt() do { *((int*)0) = 0; /* this triggers gdb */ } while (0) #define nl() do { uprint("\n"); } while (0) diff --git a/tools/sdk/lwip2/include/lwip-git-hash.h b/tools/sdk/lwip2/include/lwip-git-hash.h index 587ff5854c..2d1392e4e5 100644 --- a/tools/sdk/lwip2/include/lwip-git-hash.h +++ b/tools/sdk/lwip2/include/lwip-git-hash.h @@ -1,6 +1,5 @@ // generated by makefiles/make-lwip2-hash #ifndef LWIP_HASH_H #define LWIP_HASH_H -#define LWIP_HASH 0x92f23d6 -#define LWIP_HASH_STR "92f23d6(tag:STABLE-2_0_3_RELEASE)" +#define LWIP_HASH_STR "STABLE-2_0_3_RELEASE/glue:arduino-2.4.1" #endif // LWIP_HASH_H