mirror of
https://github.com/esp8266/Arduino.git
synced 2025-06-07 16:23:38 +03:00
provide full version descriptor, displayed in debug mode (#4467)
* provide full version descriptor, displayed in debug mode * unix: shows core version like under windows when git is unavailable * store strings in progmem * version string honours NDEBUG * 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 * lwip2: fix disconnection/reconnection issue also: improve version string remove useless message * lwip2: bump tag before 2.4.1 * lwip2: improve netif flags management on git side * full-version string: remove useless NDEBUG in separate source file * do not automatically enable sdk messages along with core messages * automatically reenable sdk messages along with core messages *before* setup not after * check serial port when showing version-string + move sdk messages enabler in hardware serial * + license header * updated and tested windows commands in platform.txt (without git) * updated and tested windows commands in platform.txt (without git) * update package builder accordingly
This commit is contained in:
parent
5b87c7b82d
commit
8053f285b1
54
cores/esp8266/Esp-version.cpp
Normal file
54
cores/esp8266/Esp-version.cpp
Normal file
@ -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 <Arduino.h>
|
||||||
|
#include <user_interface.h>
|
||||||
|
#include <core_version.h>
|
||||||
|
#include <lwip/init.h> // LWIP_VERSION_*
|
||||||
|
#include <lwipopts.h> // 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
|
||||||
|
;
|
||||||
|
}
|
@ -108,6 +108,7 @@ class EspClass {
|
|||||||
|
|
||||||
const char * getSdkVersion();
|
const char * getSdkVersion();
|
||||||
String getCoreVersion();
|
String getCoreVersion();
|
||||||
|
String getFullVersion();
|
||||||
|
|
||||||
uint8_t getBootVersion();
|
uint8_t getBootVersion();
|
||||||
uint8_t getBootMode();
|
uint8_t getBootMode();
|
||||||
|
@ -29,7 +29,7 @@
|
|||||||
#include <inttypes.h>
|
#include <inttypes.h>
|
||||||
#include "Arduino.h"
|
#include "Arduino.h"
|
||||||
#include "HardwareSerial.h"
|
#include "HardwareSerial.h"
|
||||||
|
#include "Esp.h"
|
||||||
|
|
||||||
HardwareSerial::HardwareSerial(int uart_nr)
|
HardwareSerial::HardwareSerial(int uart_nr)
|
||||||
: _uart_nr(uart_nr), _rx_size(256)
|
: _uart_nr(uart_nr), _rx_size(256)
|
||||||
@ -39,6 +39,14 @@ void HardwareSerial::begin(unsigned long baud, SerialConfig config, SerialMode m
|
|||||||
{
|
{
|
||||||
end();
|
end();
|
||||||
_uart = uart_init(_uart_nr, baud, (int) config, (int) mode, tx_pin, _rx_size);
|
_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()
|
void HardwareSerial::end()
|
||||||
|
@ -115,9 +115,6 @@ static void loop_wrapper() {
|
|||||||
preloop_update_frequency();
|
preloop_update_frequency();
|
||||||
if(!setup_done) {
|
if(!setup_done) {
|
||||||
setup();
|
setup();
|
||||||
#ifdef DEBUG_ESP_PORT
|
|
||||||
DEBUG_ESP_PORT.setDebugOutput(true);
|
|
||||||
#endif
|
|
||||||
setup_done = true;
|
setup_done = true;
|
||||||
}
|
}
|
||||||
loop();
|
loop();
|
||||||
@ -150,7 +147,6 @@ void init_done() {
|
|||||||
system_set_os_print(1);
|
system_set_os_print(1);
|
||||||
gdb_init();
|
gdb_init();
|
||||||
do_global_ctors();
|
do_global_ctors();
|
||||||
printf("\n%08x\n", core_version);
|
|
||||||
esp_schedule();
|
esp_schedule();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
#define ARDUINO_ESP8266_GIT_VER 0x00000000
|
#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 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 is used in the core internally. Please use ESP.getCoreVersion() function instead.
|
||||||
|
@ -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/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.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/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
|
> $outdir/platform.txt
|
||||||
|
|
||||||
# Put core version and short hash of git version into core_version.h
|
# Put core version and short hash of git version into core_version.h
|
||||||
ver_define=`echo $plain_ver | tr "[:lower:].\055" "[:upper:]_"`
|
ver_define=`echo $plain_ver | tr "[:lower:].\055" "[:upper:]_"`
|
||||||
echo Ver define: $ver_define
|
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_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
|
||||||
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
|
||||||
|
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
# https://github.com/arduino/Arduino/wiki/Arduino-IDE-1.5---3rd-party-Hardware-specification
|
# https://github.com/arduino/Arduino/wiki/Arduino-IDE-1.5---3rd-party-Hardware-specification
|
||||||
|
|
||||||
name=ESP8266 Modules
|
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.xtensa-lx106-elf-gcc.path={runtime.platform.path}/tools/xtensa-lx106-elf
|
||||||
runtime.tools.esptool.path={runtime.platform.path}/tools/esptool
|
runtime.tools.esptool.path={runtime.platform.path}/tools/esptool
|
||||||
@ -71,8 +71,10 @@ compiler.elf2hex.extra_flags=
|
|||||||
## generate file with git version number
|
## generate file with git version number
|
||||||
## needs bash, git, and echo
|
## 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"
|
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.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"
|
||||||
recipe.hooks.core.prebuild.1.pattern.windows=
|
## 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
|
## 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}"
|
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}"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user